whyclj
2020-09-19 02706f6f7a5962945c6eded9c0325aa02b93c7b6
WaterSystem_MonitorServer/src/com/modbus/data/MyModbusUtils.java
@@ -147,10 +147,18 @@
 
   public static BatchResults<Integer> readMutilRegisters(BatchRead<Integer> batch,MyModbusMaster master){
      batch.setContiguousRequests(false);
      boolean isSuccess = true;
      try {
         return master.getMaster().send(batch);
      } catch (ModbusTransportException | ErrorResponseException e) {
         e.printStackTrace();
         isSuccess = false;
      } finally {
         if(isSuccess) {
            master.clearError();
         }else {
            master.addErrorCount();
         }
      }
      return null;
   }