Browse Source

串口数据异常时清空已经收到的数据内容

master
sige 1 year ago
parent
commit
465a8b4753
  1. 4
      src/src/main/java/com/my/graphiteDigesterBg/diframe/connection/DiConSerialPort.java

4
src/src/main/java/com/my/graphiteDigesterBg/diframe/connection/DiConSerialPort.java

@ -116,7 +116,9 @@ public class DiConSerialPort implements DiDeviceConnection {
} else if ( 0x02 == messageType ) { // error message
throw new RuntimeException("error message received: " + DiByteBuffer.toHex(this.receivedData));
} else {
throw new RuntimeException("unknown message type : " + messageType + " <= " + DiByteBuffer.toHex(this.receivedData));
var hex = DiByteBuffer.toHex(this.receivedData);
this.receivedData = null;
throw new RuntimeException("unknown message type : " + messageType + " <= " + hex);
}
}

Loading…
Cancel
Save