Skip to content

Commit ecbe96b

Browse files
authored
Allow reading/writing address 0 in the simulator (#1552)
1 parent 8329392 commit ecbe96b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pymodbus/datastore/simulator.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,8 +554,9 @@ def validate(self, func_code, address, count=1):
554554
# Bit count, correct to register count
555555
count = int((count + WORD_SIZE - 1) / WORD_SIZE)
556556
address = int(address / 16)
557+
557558
real_address = self.fc_offset[func_code] + address
558-
if real_address <= 0 or real_address > self.register_count:
559+
if real_address < 0 or real_address > self.register_count:
559560
return False
560561

561562
fx_write = func_code in self._write_func_code

0 commit comments

Comments
 (0)