From 4edc3e6bb67de10b0912522f5583c0463dfa4e16 Mon Sep 17 00:00:00 2001 From: ft-Demo <fischertechnik-team@fischer.de> Date: Tue, 8 Nov 2022 10:21:36 +0000 Subject: [PATCH] commit by robo pro coding --- lib/NodeRED.blockly | 176 ++++++++++++++++++++++---------------------- lib/NodeRED.py | 40 +++++----- 2 files changed, 108 insertions(+), 108 deletions(-) diff --git a/lib/NodeRED.blockly b/lib/NodeRED.blockly index 4bc0991..b7e6a85 100644 --- a/lib/NodeRED.blockly +++ b/lib/NodeRED.blockly @@ -17,10 +17,10 @@ <variable id="aQ:d%c!ilWYQz|GZ5N0~">gtyp_Setup_w_Threshold_White_Red</variable> <variable id="A{`)A3~(6e.5r^y~X;S1">gtyp_Setup_w_Threshold_Red_Blue</variable> <variable id="1R^uniMizt=l7#?^bm$c">gtyp_Setup_di_Pos_Rotate</variable> - <variable id="TZ7zEdrg=Q,vG9XutiCF">gtyp_SSC_w_Threshold_Red_Blue</variable> - <variable id="z}xxgCaN^$Fn.vEFUV}F">gtyp_SLD_w_Threshold_Red_Blue</variable> <variable id="-XOZ;@M!{qgTA%xgUef-">gtyp_SSC_w_Threshold_White_Red</variable> <variable id="x43W3)orCB:l1qw2dLN`">gtyp_SLD_w_Threshold_White_Red</variable> + <variable id="TZ7zEdrg=Q,vG9XutiCF">gtyp_SSC_w_Threshold_Red_Blue</variable> + <variable id="z}xxgCaN^$Fn.vEFUV}F">gtyp_SLD_w_Threshold_Red_Blue</variable> <variable id="mvCEZ!N=009NymF/qM7c">gtyp_Setup_di_Pos_Vertical</variable> <variable id="SxENFYiA)D/cgAH0A!|E">ts</variable> <variable id="5A|5#!$f-*CkU%!}@r8|">controller_name</variable> @@ -1447,44 +1447,44 @@ <block type="util_python" id="soiv=1GYGk1x%q@maBVQ" inline="true"> <field name="value">logging.debug('1')</field> <next> - <block type="variables_set" id="#qTi4fJvDN/gHpGR,QZL"> - <field name="VAR" id="TZ7zEdrg=Q,vG9XutiCF">gtyp_SSC_w_Threshold_Red_Blue</field> + <block type="variables_set" id="D:=f2wh[w8ZBWyd[g(7}"> + <field name="VAR" id="-XOZ;@M!{qgTA%xgUef-">gtyp_SSC_w_Threshold_White_Red</field> <value name="VALUE"> - <block type="lists_getIndex" id="XHjGd8WI?lk^D`I(D#b="> + <block type="lists_getIndex" id="wdG`|Kmg=qcF]7y]s%/Y"> <mutation statement="false" at="true"/> <field name="MODE">GET</field> <field name="WHERE">FROM_START</field> <value name="VALUE"> - <block type="import_function_return" id="sY?[vd+tT0Nu7cz+s-nI"> + <block type="import_function_return" id="nkoTt5*j.7AKXq.ht:mP"> <mutation parentId="Q9p7dhe-|x*[t`L^}||B"/> <field name="name">get_calib_data_DPS</field> <data>Q9p7dhe-|x*[t`L^}||B</data> </block> </value> <value name="AT"> - <block type="math_number" id="0*d]I4B_:$fDgz,^vuWz"> + <block type="math_number" id="{2;D6h`S7C3wQ-4YG}9K"> <field name="NUM">1</field> </block> </value> </block> </value> <next> - <block type="variables_set" id="D:=f2wh[w8ZBWyd[g(7}"> - <field name="VAR" id="-XOZ;@M!{qgTA%xgUef-">gtyp_SSC_w_Threshold_White_Red</field> + <block type="variables_set" id="#qTi4fJvDN/gHpGR,QZL"> + <field name="VAR" id="TZ7zEdrg=Q,vG9XutiCF">gtyp_SSC_w_Threshold_Red_Blue</field> <value name="VALUE"> - <block type="lists_getIndex" id="wdG`|Kmg=qcF]7y]s%/Y"> + <block type="lists_getIndex" id="XHjGd8WI?lk^D`I(D#b="> <mutation statement="false" at="true"/> <field name="MODE">GET</field> <field name="WHERE">FROM_START</field> <value name="VALUE"> - <block type="import_function_return" id="nkoTt5*j.7AKXq.ht:mP"> + <block type="import_function_return" id="sY?[vd+tT0Nu7cz+s-nI"> <mutation parentId="Q9p7dhe-|x*[t`L^}||B"/> <field name="name">get_calib_data_DPS</field> <data>Q9p7dhe-|x*[t`L^}||B</data> </block> </value> <value name="AT"> - <block type="math_number" id="{2;D6h`S7C3wQ-4YG}9K"> + <block type="math_number" id="0*d]I4B_:$fDgz,^vuWz"> <field name="NUM">2</field> </block> </value> @@ -1597,44 +1597,44 @@ <block type="util_python" id="x0s]$+:+=z@PJ!naMKFJ" inline="true"> <field name="value">logging.debug('2')</field> <next> - <block type="variables_set" id="A;mMGOnf}=G4)(mUTBXB"> - <field name="VAR" id="z}xxgCaN^$Fn.vEFUV}F">gtyp_SLD_w_Threshold_Red_Blue</field> + <block type="variables_set" id="V$q[G}}_EqKbXxUdXZ?y"> + <field name="VAR" id="x43W3)orCB:l1qw2dLN`">gtyp_SLD_w_Threshold_White_Red</field> <value name="VALUE"> - <block type="lists_getIndex" id="l8(^@0LFn@VRt!9bbB@y"> + <block type="lists_getIndex" id="-dw.:I!+I-1Z}iqg+9wq"> <mutation statement="false" at="true"/> <field name="MODE">GET</field> <field name="WHERE">FROM_START</field> <value name="VALUE"> - <block type="import_function_return" id="[.lX-%{ZA`0XE/8@wh;6"> + <block type="import_function_return" id="BynbVL(FDhK[^6E+Y]|%"> <mutation parentId="b|1;0mU=wNNO2Ry{f6,Z"/> <field name="name">get_calib_data_SLD</field> <data>b|1;0mU=wNNO2Ry{f6,Z</data> </block> </value> <value name="AT"> - <block type="math_number" id="#RosQS*Pqqky0x=BGHqe"> + <block type="math_number" id="xKD0g;L20Gs#1K{x-1;t"> <field name="NUM">1</field> </block> </value> </block> </value> <next> - <block type="variables_set" id="V$q[G}}_EqKbXxUdXZ?y"> - <field name="VAR" id="x43W3)orCB:l1qw2dLN`">gtyp_SLD_w_Threshold_White_Red</field> + <block type="variables_set" id="A;mMGOnf}=G4)(mUTBXB"> + <field name="VAR" id="z}xxgCaN^$Fn.vEFUV}F">gtyp_SLD_w_Threshold_Red_Blue</field> <value name="VALUE"> - <block type="lists_getIndex" id="-dw.:I!+I-1Z}iqg+9wq"> + <block type="lists_getIndex" id="l8(^@0LFn@VRt!9bbB@y"> <mutation statement="false" at="true"/> <field name="MODE">GET</field> <field name="WHERE">FROM_START</field> <value name="VALUE"> - <block type="import_function_return" id="BynbVL(FDhK[^6E+Y]|%"> + <block type="import_function_return" id="[.lX-%{ZA`0XE/8@wh;6"> <mutation parentId="b|1;0mU=wNNO2Ry{f6,Z"/> <field name="name">get_calib_data_SLD</field> <data>b|1;0mU=wNNO2Ry{f6,Z</data> </block> </value> <value name="AT"> - <block type="math_number" id="xKD0g;L20Gs#1K{x-1;t"> + <block type="math_number" id="#RosQS*Pqqky0x=BGHqe"> <field name="NUM">2</field> </block> </value> @@ -1812,8 +1812,48 @@ </shadow> </value> <next> - <block type="util_thread" id=")SPIj;?BLx$B!m^#*GxD"> - <field name="dropdown_event">qn*eC1u~xJda3N0eHbi7</field> + <block type="variables_set" id="S2G]dx)f~jgzuW0k^kNp"> + <field name="VAR" id="-XOZ;@M!{qgTA%xgUef-">gtyp_SSC_w_Threshold_White_Red</field> + <value name="VALUE"> + <block type="math_number" id="C=d/[ap2uVxKy:e^MI:Z"> + <field name="NUM">0</field> + </block> + </value> + <next> + <block type="variables_set" id="9x5:lZLpAx9wmr9(j=_s"> + <field name="VAR" id="TZ7zEdrg=Q,vG9XutiCF">gtyp_SSC_w_Threshold_Red_Blue</field> + <value name="VALUE"> + <block type="math_number" id="gz]b+,C1~FgTaNK~=r,5"> + <field name="NUM">0</field> + </block> + </value> + <next> + <block type="variables_set" id="=~039uS6s1=!E3E6zijO"> + <field name="VAR" id="x43W3)orCB:l1qw2dLN`">gtyp_SLD_w_Threshold_White_Red</field> + <value name="VALUE"> + <block type="math_number" id="s(Z7II`Fld+4)J.OPb9T"> + <field name="NUM">0</field> + </block> + </value> + <next> + <block type="variables_set" id="K8LkNm#7hFX|dJ!z6$7i"> + <field name="VAR" id="z}xxgCaN^$Fn.vEFUV}F">gtyp_SLD_w_Threshold_Red_Blue</field> + <value name="VALUE"> + <block type="math_number" id="ke^5kEWYDF/S$ln@)=%_"> + <field name="NUM">0</field> + </block> + </value> + <next> + <block type="util_thread" id=")SPIj;?BLx$B!m^#*GxD"> + <field name="dropdown_event">qn*eC1u~xJda3N0eHbi7</field> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> </block> </next> </block> @@ -1930,44 +1970,44 @@ </block> </value> <next> - <block type="variables_set" id="!Oq+x$%5d+!s%GW^IL1)"> - <field name="VAR" id="TZ7zEdrg=Q,vG9XutiCF">gtyp_SSC_w_Threshold_Red_Blue</field> + <block type="variables_set" id="h#uurdd|D)N@)6fb}y]Y"> + <field name="VAR" id="-XOZ;@M!{qgTA%xgUef-">gtyp_SSC_w_Threshold_White_Red</field> <value name="VALUE"> - <block type="lists_getIndex" id=":5TIrIqi]}Xb}jT@l$*w"> + <block type="lists_getIndex" id="Zo@.F4}A.L8jh?*%otDt"> <mutation statement="false" at="true"/> <field name="MODE">GET</field> <field name="WHERE">FROM_START</field> <value name="VALUE"> - <block type="import_function_return" id="h!xFYCh(nNmH9sqSAI$I"> + <block type="import_function_return" id="#X_2y^P,9@Y_NC9O|pIA"> <mutation parentId="Q9p7dhe-|x*[t`L^}||B"/> <field name="name">get_calib_data_DPS</field> <data>Q9p7dhe-|x*[t`L^}||B</data> </block> </value> <value name="AT"> - <block type="math_number" id="a,{!zAt=;F22-Yz8L!CI"> + <block type="math_number" id="B@LxNrLbeQR?25F?uYyW"> <field name="NUM">1</field> </block> </value> </block> </value> <next> - <block type="variables_set" id="`DHgbw8C:@@@VX1-ZfUz"> - <field name="VAR" id="-XOZ;@M!{qgTA%xgUef-">gtyp_SSC_w_Threshold_White_Red</field> + <block type="variables_set" id="!Oq+x$%5d+!s%GW^IL1)"> + <field name="VAR" id="TZ7zEdrg=Q,vG9XutiCF">gtyp_SSC_w_Threshold_Red_Blue</field> <value name="VALUE"> - <block type="lists_getIndex" id="ydb%=g-IQpfs)69]XP$a"> + <block type="lists_getIndex" id=":5TIrIqi]}Xb}jT@l$*w"> <mutation statement="false" at="true"/> <field name="MODE">GET</field> <field name="WHERE">FROM_START</field> <value name="VALUE"> - <block type="import_function_return" id=".Z=/O/yxPs..1ytF/wXZ"> + <block type="import_function_return" id="h!xFYCh(nNmH9sqSAI$I"> <mutation parentId="Q9p7dhe-|x*[t`L^}||B"/> <field name="name">get_calib_data_DPS</field> <data>Q9p7dhe-|x*[t`L^}||B</data> </block> </value> <value name="AT"> - <block type="math_number" id="uIk7]pVcrtg=,ua0zVPi"> + <block type="math_number" id="a,{!zAt=;F22-Yz8L!CI"> <field name="NUM">2</field> </block> </value> @@ -2017,44 +2057,44 @@ </block> </value> <next> - <block type="variables_set" id="1Jy`?Na^yUC3;Z|gB3c7"> - <field name="VAR" id="z}xxgCaN^$Fn.vEFUV}F">gtyp_SLD_w_Threshold_Red_Blue</field> + <block type="variables_set" id="7W9V2j6i4OTDkbN?9g~C"> + <field name="VAR" id="x43W3)orCB:l1qw2dLN`">gtyp_SLD_w_Threshold_White_Red</field> <value name="VALUE"> - <block type="lists_getIndex" id="~fs!uVi1E8lRO)4=5;z["> + <block type="lists_getIndex" id="jgWLl%?ue-EK/xR2IF7X"> <mutation statement="false" at="true"/> <field name="MODE">GET</field> <field name="WHERE">FROM_START</field> <value name="VALUE"> - <block type="import_function_return" id="}Q-$}6fTF1GYJT1Po,K,"> + <block type="import_function_return" id="NgJyh*u),a?oiws6P3Ve"> <mutation parentId="b|1;0mU=wNNO2Ry{f6,Z"/> <field name="name">get_calib_data_SLD</field> <data>b|1;0mU=wNNO2Ry{f6,Z</data> </block> </value> <value name="AT"> - <block type="math_number" id="amR(f,!]|GX_?d]8_w:."> + <block type="math_number" id="{e+d,:6:KIfmj|nsK,LV"> <field name="NUM">1</field> </block> </value> </block> </value> <next> - <block type="variables_set" id="7W9V2j6i4OTDkbN?9g~C"> - <field name="VAR" id="x43W3)orCB:l1qw2dLN`">gtyp_SLD_w_Threshold_White_Red</field> + <block type="variables_set" id="1Jy`?Na^yUC3;Z|gB3c7"> + <field name="VAR" id="z}xxgCaN^$Fn.vEFUV}F">gtyp_SLD_w_Threshold_Red_Blue</field> <value name="VALUE"> - <block type="lists_getIndex" id="jgWLl%?ue-EK/xR2IF7X"> + <block type="lists_getIndex" id="~fs!uVi1E8lRO)4=5;z["> <mutation statement="false" at="true"/> <field name="MODE">GET</field> <field name="WHERE">FROM_START</field> <value name="VALUE"> - <block type="import_function_return" id="NgJyh*u),a?oiws6P3Ve"> + <block type="import_function_return" id="}Q-$}6fTF1GYJT1Po,K,"> <mutation parentId="b|1;0mU=wNNO2Ry{f6,Z"/> <field name="name">get_calib_data_SLD</field> <data>b|1;0mU=wNNO2Ry{f6,Z</data> </block> </value> <value name="AT"> - <block type="math_number" id="{e+d,:6:KIfmj|nsK,LV"> + <block type="math_number" id="amR(f,!]|GX_?d]8_w:."> <field name="NUM">2</field> </block> </value> @@ -2117,50 +2157,10 @@ </block> </value> <next> - <block type="variables_set" id="S2G]dx)f~jgzuW0k^kNp"> - <field name="VAR" id="-XOZ;@M!{qgTA%xgUef-">gtyp_SSC_w_Threshold_White_Red</field> - <value name="VALUE"> - <block type="math_number" id="C=d/[ap2uVxKy:e^MI:Z"> - <field name="NUM">0</field> - </block> - </value> - <next> - <block type="variables_set" id="9x5:lZLpAx9wmr9(j=_s"> - <field name="VAR" id="TZ7zEdrg=Q,vG9XutiCF">gtyp_SSC_w_Threshold_Red_Blue</field> - <value name="VALUE"> - <block type="math_number" id="gz]b+,C1~FgTaNK~=r,5"> - <field name="NUM">0</field> - </block> - </value> - <next> - <block type="variables_set" id="=~039uS6s1=!E3E6zijO"> - <field name="VAR" id="x43W3)orCB:l1qw2dLN`">gtyp_SLD_w_Threshold_White_Red</field> - <value name="VALUE"> - <block type="math_number" id="s(Z7II`Fld+4)J.OPb9T"> - <field name="NUM">0</field> - </block> - </value> - <next> - <block type="variables_set" id="K8LkNm#7hFX|dJ!z6$7i"> - <field name="VAR" id="z}xxgCaN^$Fn.vEFUV}F">gtyp_SLD_w_Threshold_Red_Blue</field> - <value name="VALUE"> - <block type="math_number" id="ke^5kEWYDF/S$ln@)=%_"> - <field name="NUM">0</field> - </block> - </value> - <next> - <block type="import_function_noreturn" id="IJy_!,2i)(ygN%+GHla}"> - <mutation parentId="[VeFt!3!rIfU$B.I(^(^"/> - <field name="name">stopSLD</field> - <data>[VeFt!3!rIfU$B.I(^(^</data> - </block> - </next> - </block> - </next> - </block> - </next> - </block> - </next> + <block type="import_function_noreturn" id="IJy_!,2i)(ygN%+GHla}"> + <mutation parentId="[VeFt!3!rIfU$B.I(^(^"/> + <field name="name">stopSLD</field> + <data>[VeFt!3!rIfU$B.I(^(^</data> </block> </next> </block> diff --git a/lib/NodeRED.py b/lib/NodeRED.py index 84f8994..6a7c0f1 100644 --- a/lib/NodeRED.py +++ b/lib/NodeRED.py @@ -37,10 +37,10 @@ state_positioning = None gtyp_Setup_w_Threshold_White_Red = None gtyp_Setup_w_Threshold_Red_Blue = None gtyp_Setup_di_Pos_Rotate = None -gtyp_SSC_w_Threshold_Red_Blue = None -gtyp_SLD_w_Threshold_Red_Blue = None gtyp_SSC_w_Threshold_White_Red = None gtyp_SLD_w_Threshold_White_Red = None +gtyp_SSC_w_Threshold_Red_Blue = None +gtyp_SLD_w_Threshold_Red_Blue = None gtyp_Setup_di_Pos_Vertical = None ts = None controller_name = None @@ -48,7 +48,7 @@ gtyp_Setup_di_Pos_Horizontal = None def thread_updateColorValue(): - global topic, m_decode, client, userdata, flags, rc, msg, gtyp_Setup_x_Set_Pos_Activ, gtyp_Setup_i_Pos_Selection, payload, gtyp_Setup_x_Color_Sensor_Calibration, gtyp_Setup_i_Color_Sensor_Selection, gtyp_Setup_w_Actual_ColorValue, state_positioning, gtyp_Setup_w_Threshold_White_Red, gtyp_Setup_w_Threshold_Red_Blue, gtyp_Setup_di_Pos_Rotate, gtyp_SSC_w_Threshold_Red_Blue, gtyp_SLD_w_Threshold_Red_Blue, gtyp_SSC_w_Threshold_White_Red, gtyp_SLD_w_Threshold_White_Red, gtyp_Setup_di_Pos_Vertical, ts, controller_name, gtyp_Setup_di_Pos_Horizontal + global topic, m_decode, client, userdata, flags, rc, msg, gtyp_Setup_x_Set_Pos_Activ, gtyp_Setup_i_Pos_Selection, payload, gtyp_Setup_x_Color_Sensor_Calibration, gtyp_Setup_i_Color_Sensor_Selection, gtyp_Setup_w_Actual_ColorValue, state_positioning, gtyp_Setup_w_Threshold_White_Red, gtyp_Setup_w_Threshold_Red_Blue, gtyp_Setup_di_Pos_Rotate, gtyp_SSC_w_Threshold_White_Red, gtyp_SLD_w_Threshold_White_Red, gtyp_SSC_w_Threshold_Red_Blue, gtyp_SLD_w_Threshold_Red_Blue, gtyp_Setup_di_Pos_Vertical, ts, controller_name, gtyp_Setup_di_Pos_Horizontal while True: if gtyp_Setup_i_Color_Sensor_Selection == 1: logging.debug('1') @@ -62,7 +62,7 @@ def thread_updateColorValue(): def processReceivedMessage(topic, m_decode): - global client, userdata, flags, rc, msg, gtyp_Setup_x_Set_Pos_Activ, gtyp_Setup_i_Pos_Selection, payload, gtyp_Setup_x_Color_Sensor_Calibration, gtyp_Setup_i_Color_Sensor_Selection, gtyp_Setup_w_Actual_ColorValue, state_positioning, gtyp_Setup_w_Threshold_White_Red, gtyp_Setup_w_Threshold_Red_Blue, gtyp_Setup_di_Pos_Rotate, gtyp_SSC_w_Threshold_Red_Blue, gtyp_SLD_w_Threshold_Red_Blue, gtyp_SSC_w_Threshold_White_Red, gtyp_SLD_w_Threshold_White_Red, gtyp_Setup_di_Pos_Vertical, ts, controller_name, gtyp_Setup_di_Pos_Horizontal + global client, userdata, flags, rc, msg, gtyp_Setup_x_Set_Pos_Activ, gtyp_Setup_i_Pos_Selection, payload, gtyp_Setup_x_Color_Sensor_Calibration, gtyp_Setup_i_Color_Sensor_Selection, gtyp_Setup_w_Actual_ColorValue, state_positioning, gtyp_Setup_w_Threshold_White_Red, gtyp_Setup_w_Threshold_Red_Blue, gtyp_Setup_di_Pos_Rotate, gtyp_SSC_w_Threshold_White_Red, gtyp_SLD_w_Threshold_White_Red, gtyp_SSC_w_Threshold_Red_Blue, gtyp_SLD_w_Threshold_Red_Blue, gtyp_Setup_di_Pos_Vertical, ts, controller_name, gtyp_Setup_di_Pos_Horizontal logging.log(logging.TRACE0, '%s %s', topic, m_decode) if topic == 'gtyp_Setup/x_Set_Pos_Activ': logging.debug('activate') @@ -167,15 +167,15 @@ def processReceivedMessage(topic, m_decode): client.publish(topic='gtyp_Setup/w_Threshold_Red_Blue', payload=gtyp_Setup_w_Threshold_Red_Blue, qos=2, retain=False) if gtyp_Setup_i_Color_Sensor_Selection == 1: logging.debug('1') - gtyp_SSC_w_Threshold_Red_Blue = (get_calib_data_DPS())[0] - gtyp_SSC_w_Threshold_White_Red = (get_calib_data_DPS())[1] + gtyp_SSC_w_Threshold_White_Red = (get_calib_data_DPS())[0] + gtyp_SSC_w_Threshold_Red_Blue = (get_calib_data_DPS())[1] set_calib_data_DPS([gtyp_SSC_w_Threshold_White_Red, gtyp_SSC_w_Threshold_Red_Blue]) client.publish(topic='gtyp_SSC/w_Threshold_White_Red', payload=gtyp_SSC_w_Threshold_White_Red, qos=2, retain=False) client.publish(topic='gtyp_SSC/w_Threshold_Red_Blue', payload=gtyp_SSC_w_Threshold_Red_Blue, qos=2, retain=False) elif gtyp_Setup_i_Color_Sensor_Selection == 2: logging.debug('2') - gtyp_SLD_w_Threshold_Red_Blue = (get_calib_data_SLD())[0] - gtyp_SLD_w_Threshold_White_Red = (get_calib_data_SLD())[1] + gtyp_SLD_w_Threshold_White_Red = (get_calib_data_SLD())[0] + gtyp_SLD_w_Threshold_Red_Blue = (get_calib_data_SLD())[1] set_calib_data_SLD([gtyp_SLD_w_Threshold_White_Red, gtyp_SLD_w_Threshold_Red_Blue]) client.publish(topic='gtyp_SLD/w_Threshold_White_Red', payload=gtyp_SLD_w_Threshold_White_Red, qos=2, retain=False) client.publish(topic='gtyp_SLD/w_Threshold_Red_Blue', payload=gtyp_SLD_w_Threshold_Red_Blue, qos=2, retain=False) @@ -188,6 +188,10 @@ def processReceivedMessage(topic, m_decode): if gtyp_Setup_x_Color_Sensor_Calibration == 'true': set_lights_mode(7) display.set_attr("txt_status_indicator.active", str(True).lower()) + gtyp_SSC_w_Threshold_White_Red = 0 + gtyp_SSC_w_Threshold_Red_Blue = 0 + gtyp_SLD_w_Threshold_White_Red = 0 + gtyp_SLD_w_Threshold_Red_Blue = 0 threading.Thread(target=thread_updateColorValue, daemon=True).start() else: set_lights_mode(0) @@ -200,14 +204,14 @@ def processReceivedMessage(topic, m_decode): if gtyp_Setup_i_Color_Sensor_Selection == 1: logging.debug('1') gtyp_Setup_w_Actual_ColorValue = readDPSColorValue() - gtyp_SSC_w_Threshold_Red_Blue = (get_calib_data_DPS())[0] - gtyp_SSC_w_Threshold_White_Red = (get_calib_data_DPS())[1] + gtyp_SSC_w_Threshold_White_Red = (get_calib_data_DPS())[0] + gtyp_SSC_w_Threshold_Red_Blue = (get_calib_data_DPS())[1] stopSLD() elif gtyp_Setup_i_Color_Sensor_Selection == 2: logging.debug('2') gtyp_Setup_w_Actual_ColorValue = readColorValue() - gtyp_SLD_w_Threshold_Red_Blue = (get_calib_data_SLD())[0] - gtyp_SLD_w_Threshold_White_Red = (get_calib_data_SLD())[1] + gtyp_SLD_w_Threshold_White_Red = (get_calib_data_SLD())[0] + gtyp_SLD_w_Threshold_Red_Blue = (get_calib_data_SLD())[1] startSLD() else: logging.debug('none') @@ -215,10 +219,6 @@ def processReceivedMessage(topic, m_decode): set_calibvalue_white(0) set_calibvalue_red(0) set_calibvalue_blue(0) - gtyp_SSC_w_Threshold_White_Red = 0 - gtyp_SSC_w_Threshold_Red_Blue = 0 - gtyp_SLD_w_Threshold_White_Red = 0 - gtyp_SLD_w_Threshold_Red_Blue = 0 stopSLD() client.publish(topic='gtyp_Setup/w_Actual_ColorValue', payload=gtyp_Setup_w_Actual_ColorValue, qos=2, retain=False) client.publish(topic='gtyp_Setup/w_Calib_ColorValue_White', payload=(get_calibvalue_list())[0], qos=2, retain=False) @@ -248,7 +248,7 @@ def processReceivedMessage(topic, m_decode): def initMQTTLocal(): - global topic, m_decode, client, userdata, flags, rc, msg, gtyp_Setup_x_Set_Pos_Activ, gtyp_Setup_i_Pos_Selection, payload, gtyp_Setup_x_Color_Sensor_Calibration, gtyp_Setup_i_Color_Sensor_Selection, gtyp_Setup_w_Actual_ColorValue, state_positioning, gtyp_Setup_w_Threshold_White_Red, gtyp_Setup_w_Threshold_Red_Blue, gtyp_Setup_di_Pos_Rotate, gtyp_SSC_w_Threshold_Red_Blue, gtyp_SLD_w_Threshold_Red_Blue, gtyp_SSC_w_Threshold_White_Red, gtyp_SLD_w_Threshold_White_Red, gtyp_Setup_di_Pos_Vertical, ts, controller_name, gtyp_Setup_di_Pos_Horizontal + global topic, m_decode, client, userdata, flags, rc, msg, gtyp_Setup_x_Set_Pos_Activ, gtyp_Setup_i_Pos_Selection, payload, gtyp_Setup_x_Color_Sensor_Calibration, gtyp_Setup_i_Color_Sensor_Selection, gtyp_Setup_w_Actual_ColorValue, state_positioning, gtyp_Setup_w_Threshold_White_Red, gtyp_Setup_w_Threshold_Red_Blue, gtyp_Setup_di_Pos_Rotate, gtyp_SSC_w_Threshold_White_Red, gtyp_SLD_w_Threshold_White_Red, gtyp_SSC_w_Threshold_Red_Blue, gtyp_SLD_w_Threshold_Red_Blue, gtyp_Setup_di_Pos_Vertical, ts, controller_name, gtyp_Setup_di_Pos_Horizontal gtyp_Setup_x_Set_Pos_Activ = 0 gtyp_Setup_i_Pos_Selection = 0 gtyp_Setup_x_Color_Sensor_Calibration = 0 @@ -266,7 +266,7 @@ def initMQTTLocal(): def thread_MQTTLocal(): - global topic, m_decode, client, userdata, flags, rc, msg, gtyp_Setup_x_Set_Pos_Activ, gtyp_Setup_i_Pos_Selection, payload, gtyp_Setup_x_Color_Sensor_Calibration, gtyp_Setup_i_Color_Sensor_Selection, gtyp_Setup_w_Actual_ColorValue, state_positioning, gtyp_Setup_w_Threshold_White_Red, gtyp_Setup_w_Threshold_Red_Blue, gtyp_Setup_di_Pos_Rotate, gtyp_SSC_w_Threshold_Red_Blue, gtyp_SLD_w_Threshold_Red_Blue, gtyp_SSC_w_Threshold_White_Red, gtyp_SLD_w_Threshold_White_Red, gtyp_Setup_di_Pos_Vertical, ts, controller_name, gtyp_Setup_di_Pos_Horizontal + global topic, m_decode, client, userdata, flags, rc, msg, gtyp_Setup_x_Set_Pos_Activ, gtyp_Setup_i_Pos_Selection, payload, gtyp_Setup_x_Color_Sensor_Calibration, gtyp_Setup_i_Color_Sensor_Selection, gtyp_Setup_w_Actual_ColorValue, state_positioning, gtyp_Setup_w_Threshold_White_Red, gtyp_Setup_w_Threshold_Red_Blue, gtyp_Setup_di_Pos_Rotate, gtyp_SSC_w_Threshold_White_Red, gtyp_SLD_w_Threshold_White_Red, gtyp_SSC_w_Threshold_Red_Blue, gtyp_SLD_w_Threshold_Red_Blue, gtyp_Setup_di_Pos_Vertical, ts, controller_name, gtyp_Setup_di_Pos_Horizontal logging.debug('-') #client.loop_forever() client.loop_start() @@ -275,7 +275,7 @@ def thread_MQTTLocal(): def on_connect(client, userdata, flags, rc): - global topic, m_decode, msg, gtyp_Setup_x_Set_Pos_Activ, gtyp_Setup_i_Pos_Selection, payload, gtyp_Setup_x_Color_Sensor_Calibration, gtyp_Setup_i_Color_Sensor_Selection, gtyp_Setup_w_Actual_ColorValue, state_positioning, gtyp_Setup_w_Threshold_White_Red, gtyp_Setup_w_Threshold_Red_Blue, gtyp_Setup_di_Pos_Rotate, gtyp_SSC_w_Threshold_Red_Blue, gtyp_SLD_w_Threshold_Red_Blue, gtyp_SSC_w_Threshold_White_Red, gtyp_SLD_w_Threshold_White_Red, gtyp_Setup_di_Pos_Vertical, ts, controller_name, gtyp_Setup_di_Pos_Horizontal + global topic, m_decode, msg, gtyp_Setup_x_Set_Pos_Activ, gtyp_Setup_i_Pos_Selection, payload, gtyp_Setup_x_Color_Sensor_Calibration, gtyp_Setup_i_Color_Sensor_Selection, gtyp_Setup_w_Actual_ColorValue, state_positioning, gtyp_Setup_w_Threshold_White_Red, gtyp_Setup_w_Threshold_Red_Blue, gtyp_Setup_di_Pos_Rotate, gtyp_SSC_w_Threshold_White_Red, gtyp_SLD_w_Threshold_White_Red, gtyp_SSC_w_Threshold_Red_Blue, gtyp_SLD_w_Threshold_Red_Blue, gtyp_Setup_di_Pos_Vertical, ts, controller_name, gtyp_Setup_di_Pos_Horizontal print("Connection returned result: "+mqtt.connack_string(rc)) client.subscribe("#") #client.subscribe("$SYS/#") @@ -292,7 +292,7 @@ def on_connect(client, userdata, flags, rc): def on_message(client, userdata, msg): - global topic, m_decode, flags, rc, gtyp_Setup_x_Set_Pos_Activ, gtyp_Setup_i_Pos_Selection, payload, gtyp_Setup_x_Color_Sensor_Calibration, gtyp_Setup_i_Color_Sensor_Selection, gtyp_Setup_w_Actual_ColorValue, state_positioning, gtyp_Setup_w_Threshold_White_Red, gtyp_Setup_w_Threshold_Red_Blue, gtyp_Setup_di_Pos_Rotate, gtyp_SSC_w_Threshold_Red_Blue, gtyp_SLD_w_Threshold_Red_Blue, gtyp_SSC_w_Threshold_White_Red, gtyp_SLD_w_Threshold_White_Red, gtyp_Setup_di_Pos_Vertical, ts, controller_name, gtyp_Setup_di_Pos_Horizontal + global topic, m_decode, flags, rc, gtyp_Setup_x_Set_Pos_Activ, gtyp_Setup_i_Pos_Selection, payload, gtyp_Setup_x_Color_Sensor_Calibration, gtyp_Setup_i_Color_Sensor_Selection, gtyp_Setup_w_Actual_ColorValue, state_positioning, gtyp_Setup_w_Threshold_White_Red, gtyp_Setup_w_Threshold_Red_Blue, gtyp_Setup_di_Pos_Rotate, gtyp_SSC_w_Threshold_White_Red, gtyp_SLD_w_Threshold_White_Red, gtyp_SSC_w_Threshold_Red_Blue, gtyp_SLD_w_Threshold_Red_Blue, gtyp_Setup_di_Pos_Vertical, ts, controller_name, gtyp_Setup_di_Pos_Horizontal #print("Received message '" + str(msg.payload) + "' on topic '" + msg.topic + "' with QoS " + str(msg.qos)) topic = msg.topic -- GitLab