Runtime: STRING type for Python PLC Globals was making problem with strings, since generated code wasn't doing comparison properly.
authorEdouard Tisserant
Wed, 17 Jun 2020 14:30:55 +0200
changeset 2679 2783906d5792
parent 2678 45f1ff6a7f87
child 2680 6bfed6757495
Runtime: STRING type for Python PLC Globals was making problem with strings, since generated code wasn't doing comparison properly.
py_ext/PythonFileCTNMixin.py
--- a/py_ext/PythonFileCTNMixin.py	Tue Jun 16 15:53:52 2020 +0200
+++ b/py_ext/PythonFileCTNMixin.py	Wed Jun 17 14:30:55 2020 +0200
@@ -242,8 +242,8 @@
         varpubonchangefmt = """\
     if(!AtomicCompareExchange(&__%(name)s_rlock, 0, 1)){
         IEC_%(IECtype)s tmp = __GET_VAR(%(configname)s__%(uppername)s);
-        if(__%(name)s_rbuffer != tmp){
-            __%(name)s_rbuffer = %(configname)s__%(uppername)s.value;
+        if(NE_%(IECtype)s(1, NULL, __%(name)s_rbuffer, tmp)){
+            __%(name)s_rbuffer = tmp;
             PYTHON_POLL_body__(__%(name)s_notifier);
         }
         AtomicCompareExchange((long*)&__%(name)s_rlock, 1, 0);