Extend python<->PLC global variable description "GlobalDesc" to support Initial value setting.
authorEdouard Tisserant
Wed, 10 Jan 2018 15:36:03 +0100
changeset 1897 62f9cae9a25f
parent 1896 2081de16e726
child 1898 d2dbdeffc426
Extend python<->PLC global variable description "GlobalDesc" to support Initial value setting.

Rebased from dporopat change "add initial value to runtime.py file", which means :
- GlobalDesc is used by some customized beremiz python runtime
- Those runtimes need to know what is initial value of these special variables
py_ext/PythonFileCTNMixin.py
--- a/py_ext/PythonFileCTNMixin.py	Wed Jan 10 14:35:04 2018 +0100
+++ b/py_ext/PythonFileCTNMixin.py	Wed Jan 10 15:36:03 2018 +0100
@@ -119,6 +119,7 @@
                 "configname": configname.upper(),
                 "uppername": variable.getname().upper(),
                 "IECtype": variable.gettype(),
+                "initial" : repr(variable.getinitial()),
                 "pyextname": pyextname
             },
             self.CodeFile.variables.variable)
@@ -136,6 +137,7 @@
 _%(pyextname)sGlobalsDesc.append((
     "%(name)s",
     "%(IECtype)s",
+    %(initial)s,
     %(desc)s,
     %(onchange)s,
     %(opts)s))