fix sending next pdu before we have parsed the last response

This commit is contained in:
Stefan Allius
2024-05-18 23:11:49 +02:00
parent 9c39ea27f7
commit d25173e591

View File

@@ -165,10 +165,10 @@ class Modbus():
logging.info(f'Modbus: len error {elmlen} != {self.last_len}')
self.err = 4
return
self.stop_timer()
first_reg = self.last_reg # save last_reg before sending next pdu
self.stop_timer() # stop timer and send next pdu
for i in range(0, elmlen):
addr = self.last_reg+i
addr = first_reg+i
if addr in self.map:
row = self.map[addr]
info_id = row['reg']