Nicer name than 'var_name' for variable auto-renaming in Modbus
authorEdouard Tisserant
Wed, 10 Apr 2019 14:11:52 +0200
changeset 2589 d94d4f396bbf
parent 2587 c67488bd8134
child 2590 f8c66edffbd4
Nicer name than 'var_name' for variable auto-renaming in Modbus
modbus/modbus.py
--- a/modbus/modbus.py	Tue Apr 09 14:08:44 2019 +0200
+++ b/modbus/modbus.py	Wed Apr 10 14:11:52 2019 +0200
@@ -122,7 +122,7 @@
                 "type": LOCATION_VAR_MEMORY,
                 "size": datasize,
                 "IEC_type": datatype,
-                "var_name": "var_name",
+                "var_name": "MB_" + "".join([w[0] for w in dataname.split()]) + "_" + str(offset),
                 "location": datatacc + ".".join([str(i) for i in current_location]) + "." + str(offset),
                 "description": "description",
                 "children": []})
@@ -227,7 +227,7 @@
                 "type": LOCATION_VAR_MEMORY,
                 "size": datasize,
                 "IEC_type": datatype,
-                "var_name": "var_name",
+                "var_name": "MB_" + "".join([w[0] for w in dataname.split()]) + "_" + str(offset),
                 "location": datatacc + ".".join([str(i) for i in current_location]) + "." + str(offset),
                 "description": "description",
                 "children": []})