张世豪
昨天 ef78717c5b956a26b360de44f774fc2b804296c2
src/publicway/ProtocolParser01.java
@@ -116,9 +116,9 @@
            String receivedCRC = hexData.substring(hexData.length() - 6);
            byte[] cmdBytes = HexUtil.hexStringToBytes(hexData.replace(receivedCRC,""));
            String crc = HexUtil.calculate(cmdBytes)+"00"; 
            System.out.println("收到的完整数据是:"+hexData);
            System.out.println("收到数据校验码是:"+receivedCRC);
            System.out.println("校验码是:"+crc);
            //System.out.println("收到的完整数据是:"+hexData);
            //System.out.println("收到数据校验码是:"+receivedCRC);
            //System.out.println("校验码是:"+crc);
            return receivedCRC.equalsIgnoreCase(crc);            
        } catch (Exception e) {
            System.err.println("CRC校验异常: " + e.getMessage());
@@ -515,7 +515,7 @@
            sb.append("9. 电压: ").append(String.format("%.2f", voltage));
            sb.append("10. 电流: ").append(String.format("%.2f", current));
            sb.append("数据长度: ").append(dataLength).append(" 字节"); 
//            System.out.println(sb.toString());
//            //System.out.println(sb.toString());
            return sb.toString();           
        }