Commit 50632aea authored by wanghao's avatar wanghao

1 写自检后 判断下 是否写成功

parent 107a82cf
...@@ -1067,7 +1067,7 @@ public class Modbus4jUtils { ...@@ -1067,7 +1067,7 @@ public class Modbus4jUtils {
// 20251206 写完时间写自检,写自检就在时间后边写就行,不管时间写不写成功 // 20251206 写完时间写自检,写自检就在时间后边写就行,不管时间写不写成功
try { try {
Modbus4jUtils.writeRegister(master, deviceId, 15, (short) 1); Modbus4jUtils.writeRegister(master, deviceId, 15, (short) 1);
Thread.sleep(2000); Thread.sleep(1000);
int[] ints = Modbus4jUtils.readDeviceRegisters(master, deviceId); int[] ints = Modbus4jUtils.readDeviceRegisters(master, deviceId);
if (ints[15] == 1) { if (ints[15] == 1) {
return 1; return 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment