modbus/mb_utils.py
changeset 3733 d1acf20e8e7c
parent 2713 680ea4684209
child 3750 f62625418bff
--- a/modbus/mb_utils.py	Wed Sep 28 09:19:07 2022 +0200
+++ b/modbus/mb_utils.py	Sun Feb 19 08:37:27 2023 +0000
@@ -140,10 +140,10 @@
     params: child - the correspondent subplugin in Beremiz
     """
     node_init_template = '''/*node %(locnodestr)s*/
-{"%(locnodestr)s", "%(config_name)s", "%(device)s", "", {naf_rtu, {.rtu = {NULL, %(baud)s /*baud*/, %(parity)s /*parity*/, 8 /*data bits*/, %(stopbits)s, 0 /* ignore echo */}}}, -1 /* mb_nd */, 0 /* init_state */, %(coms_period)s /* communication period */}'''
-
-    location = ".".join(map(str, child.GetCurrentLocation()))
-    config_name, device, baud, parity, stopbits, coms_period = GetCTVals(child, range(6))
+{"%(locnodestr)s", "%(config_name)s", "%(device)s", "", {naf_rtu, {.rtu = {NULL, %(baud)s /*baud*/, %(parity)s /*parity*/, 8 /*data bits*/, %(stopbits)s, 0 /* ignore echo */}}}, -1 /* mb_nd */, 0 /* init_state */, %(coms_period)s /* communication period  (ms)*/, %(coms_delay)s /* inter request delay (ms)*/, 0 /* prev_error */}'''
+
+    location = ".".join(map(str, child.GetCurrentLocation()))
+    config_name, device, baud, parity, stopbits, coms_period, coms_delay = GetCTVals(child, range(7))
 
     node_dict = {"locnodestr": location,
                  "config_name": config_name,
@@ -151,7 +151,8 @@
                  "baud": baud,
                  "parity": modbus_serial_parity_dict[parity],
                  "stopbits": stopbits,
-                 "coms_period": coms_period}
+                 "coms_period": coms_period,
+                 "coms_delay": coms_delay}
     return node_init_template % node_dict
 
 
@@ -161,16 +162,17 @@
     params: child - the correspondent subplugin in Beremiz
     """
     node_init_template = '''/*node %(locnodestr)s*/
-{"%(locnodestr)s", "%(config_name)s", "%(host)s", "%(port)s", {naf_tcp, {.tcp = {NULL, NULL, DEF_CLOSE_ON_SILENCE}}}, -1 /* mb_nd */, 0 /* init_state */, %(coms_period)s /* communication period */, 0 /* prev_error */}'''
-
-    location = ".".join(map(str, child.GetCurrentLocation()))
-    config_name, host, port, coms_period = GetCTVals(child, range(4))
+{"%(locnodestr)s", "%(config_name)s", "%(host)s", "%(port)s", {naf_tcp, {.tcp = {NULL, NULL, DEF_CLOSE_ON_SILENCE}}}, -1 /* mb_nd */, 0 /* init_state */, %(coms_period)s /* communication period (ms)*/, %(coms_delay)s /* inter request delay (ms)*/, 0 /* prev_error */}'''
+
+    location = ".".join(map(str, child.GetCurrentLocation()))
+    config_name, host, port, coms_period, coms_delay = GetCTVals(child, range(5))
 
     node_dict = {"locnodestr": location,
                  "config_name": config_name,
                  "host": host,
                  "port": port,
-                 "coms_period": coms_period}
+                 "coms_period": coms_period,
+                 "coms_delay": coms_delay}
     return node_init_template % node_dict