Modbus plugin: fix bug: was checking user configuration against wrong limits
authorMario de Sousa <msousa@fe.up.pt>
Sun, 07 Jun 2020 19:33:32 +0100
changeset 2664 a26a8e182190
parent 2663 54f5b8e5c8d2
child 2665 978cf239c689
Modbus plugin: fix bug: was checking user configuration against wrong limits
modbus/mb_utils.py
--- a/modbus/mb_utils.py	Sun Jun 07 18:34:32 2020 +0100
+++ b/modbus/mb_utils.py	Sun Jun 07 19:33:32 2020 +0100
@@ -95,7 +95,7 @@
             "Modbus plugin: Invalid Start Address in server memory area node %(locreqstr)s (Must be in the range [0..65535])\nModbus plugin: Aborting C code generation for this node\n" % request_dict)
         return None
     request_dict["count"] = GetCTVal(child, 1)
-    if int(request_dict["count"]) not in xrange(1, 65536):
+    if int(request_dict["count"]) not in xrange(1, 65537):
         self.GetCTRoot().logger.write_error(
             "Modbus plugin: Invalid number of channels in server memory area node %(locreqstr)s (Must be in the range [1..65536-start_address])\nModbus plugin: Aborting C code generation for this node\n" % request_dict)
         return None