Python Runtime: order of execution of extension's init() and cleanup() now reflects order of appearance of extensions in configuration tree.
--- a/bacnet/bacnet.py Tue Dec 22 14:53:15 2020 +0100
+++ b/bacnet/bacnet.py Mon Jul 13 13:56:42 2020 +0200
@@ -790,6 +790,6 @@
runtimefile.close()
return ([(Generated_BACnet_c_mainfile_name, CFLAGS)], LDFLAGS, True,
- ("runtime_bacnet_websettings_%s.py" % location_str, open(runtimefile_path, "rb")),
+ ("runtime_%s_bacnet_websettings.py" % location_str, open(runtimefile_path, "rb")),
)
#return [(Generated_BACnet_c_mainfile_name, CFLAGS)], LDFLAGS, True, ('extrafile1.txt', extra_file_handle)
--- a/bacnet/web_settings.py Tue Dec 22 14:53:15 2020 +0100
+++ b/bacnet/web_settings.py Mon Jul 13 13:56:42 2020 +0200
@@ -295,7 +295,7 @@
# location_str is replaced by extension's value in CTNGenerateC call
-def _runtime_bacnet_websettings_%(location_str)s_init():
+def _runtime_%(location_str)s_bacnet_websettings_init():
"""
# Callback function, called (by PLCObject.py) when a new PLC program
# (i.e. XXX.so file) is transfered to the PLC runtime
@@ -383,7 +383,7 @@
# location_str is replaced by extension's value in CTNGenerateC call
-def _runtime_bacnet_websettings_%(location_str)s_cleanup():
+def _runtime_%(location_str)s_bacnet_websettings_cleanup():
"""
# Callback function, called (by PLCObject.py) when a PLC program is unloaded from memory
"""
--- a/etherlab/EthercatMaster.py Tue Dec 22 14:53:15 2020 +0100
+++ b/etherlab/EthercatMaster.py Mon Jul 13 13:56:42 2020 +0200
@@ -97,6 +97,8 @@
return ((["etherlab_ext"], [(Gen_etherlabfile_path, IECCFLAGS)], True), "",
("runtime_etherlab.py", open(GetLocalPath("runtime_etherlab.py"))))
+ # TODO : rename to match runtime_{location}_extname.py format
+
# --------------------------------------------------
# Ethercat MASTER
# --------------------------------------------------
--- a/etherlab/runtime_etherlab.py Tue Dec 22 14:53:15 2020 +0100
+++ b/etherlab/runtime_etherlab.py Mon Jul 13 13:56:42 2020 +0200
@@ -114,6 +114,7 @@
time.sleep(0.5)
+# TODO : rename to match _runtime_{location}_extname_init() format
def _runtime_etherlab_init():
global KMSGPollThread, StopKMSGThread
StopKMSGThread = False
@@ -121,6 +122,7 @@
KMSGPollThread.start()
+# TODO : rename to match _runtime_{location}_extname_cleanup() format
def _runtime_etherlab_cleanup():
global KMSGPollThread, StopKMSGThread, SDOThread
try:
--- a/modbus/modbus.py Tue Dec 22 14:53:15 2020 +0100
+++ b/modbus/modbus.py Mon Jul 13 13:56:42 2020 +0200
@@ -1006,5 +1006,5 @@
runtimefile.close()
return ([(Gen_MB_c_path, ' -I"' + ModbusPath + '"')], LDFLAGS, True,
- ("runtime_modbus_websettings_%s.py" % location_str, open(runtimefile_path, "rb")),
+ ("runtime_%s_modbus_websettings.py" % location_str, open(runtimefile_path, "rb")),
)
--- a/modbus/web_settings.py Tue Dec 22 14:53:15 2020 +0100
+++ b/modbus/web_settings.py Mon Jul 13 13:56:42 2020 +0200
@@ -526,7 +526,7 @@
-def _runtime_modbus_websettings_%(location_str)s_init():
+def _runtime_%(location_str)s_modbus_websettings_init():
"""
Callback function, called (by PLCObject.py) when a new PLC program
(i.e. XXX.so file) is transfered to the PLC runtime
@@ -609,7 +609,7 @@
-def _runtime_modbus_websettings_%(location_str)s_cleanup():
+def _runtime_%(location_str)s_modbus_websettings_cleanup():
"""
Callback function, called (by PLCObject.py) when a PLC program is unloaded from memory
"""