lpcmanager

LPCCommand : switch to wx.Timer instead of regular python timer for the rapidfire protection. With regular python timers, some refresh order could pile eventloop when interacting with the GUI while doing initial loading of signals.
<?xml version='1.0' encoding='utf-8'?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.plcopen.org/xml/tc6_0201" xmlns:xhtml="http://www.w3.org/1999/xhtml" xsi:schemaLocation="http://www.plcopen.org/xml/tc6_0201">
<fileHeader companyName="Beremiz" productName="Beremiz" productVersion="0.0" creationDateTime="2008-12-14T16:53:26"/>
<contentHeader name="Beremiz non-standard POUs library" modificationDateTime="2018-09-06T13:45:38">
<coordinateInfo>
<fbd>
<scaling x="0" y="0"/>
</fbd>
<ld>
<scaling x="0" y="0"/>
</ld>
<sfc>
<scaling x="0" y="0"/>
</sfc>
</coordinateInfo>
</contentHeader>
<types>
<dataTypes/>
<pous>
<pou name="getRTCString" pouType="functionBlock">
<interface>
<inputVars>
<variable name="TRIG">
<type>
<BOOL/>
</type>
</variable>
</inputVars>
<outputVars>
<variable name="ACK">
<type>
<BOOL/>
</type>
</variable>
<variable name="DT_STR">
<type>
<string/>
</type>
</variable>
</outputVars>
<localVars>
<variable name="eval">
<type>
<derived name="python_eval"/>
</type>
</variable>
</localVars>
</interface>
<body>
<ST>
<xhtml:p><![CDATA[(* Get time from RTC *)
eval(TRIG:=TRIG, CODE:='GetRTC()', ACK => ACK, RESULT => DT_STR);]]></xhtml:p>
</ST>
</body>
<documentation>
<xhtml:p><![CDATA[Sample time from RTC on raising edge of TRIG. Outputs a formated string in DT_STR and sets ACK to TRUE when output is ready.
Format:
YYYY-mm-dd HH:MM:SS w v
Last two numbers are :
w: week day
v: valid flag
Example:
2018-07-28 11:24:07 6 1]]></xhtml:p>
</documentation>
</pou>
<pou name="getRTC" pouType="functionBlock">
<interface>
<inputVars>
<variable name="TRIG">
<type>
<BOOL/>
</type>
</variable>
</inputVars>
<outputVars>
<variable name="ACK">
<type>
<BOOL/>
</type>
</variable>
<variable name="VALID">
<type>
<BOOL/>
</type>
</variable>
<variable name="YEAR">
<type>
<UINT/>
</type>
</variable>
<variable name="MONTH">
<type>
<UINT/>
</type>
</variable>
<variable name="DAY">
<type>
<UINT/>
</type>
</variable>
<variable name="WDAY">
<type>
<UINT/>
</type>
</variable>
<variable name="HOUR">
<type>
<UINT/>
</type>
</variable>
<variable name="MINUTE">
<type>
<UINT/>
</type>
</variable>
<variable name="SECOND">
<type>
<UINT/>
</type>
</variable>
</outputVars>
<localVars>
<variable name="eval">
<type>
<derived name="python_eval"/>
</type>
</variable>
<variable name="rtrig">
<type>
<derived name="R_TRIG"/>
</type>
</variable>
<variable name="COMPUTE">
<type>
<BOOL/>
</type>
</variable>
<variable name="DT_STR">
<type>
<string/>
</type>
</variable>
</localVars>
</interface>
<body>
<ST>
<xhtml:p><![CDATA[(* Get time from RTC *)
eval(TRIG:=TRIG, CODE:='GetRTC()', ACK => ACK, RESULT => DT_STR);
rtrig(CLK := ACK, Q => COMPUTE);
IF COMPUTE OR (TRIG & ACK ) THEN
IF COMPUTE THEN
VALID:=STRING_TO_BOOL(IN:=MID(IN:=DT_STR,L:=1,P:=23));
YEAR:=STRING_TO_UINT(IN:=MID(IN:=DT_STR,L:=4,P:=1));
MONTH:=STRING_TO_UINT(IN:=MID(IN:=DT_STR,L:=2,P:=6));
DAY:=STRING_TO_UINT(IN:=MID(IN:=DT_STR,L:=2,P:=9));
WDAY:=STRING_TO_UINT(IN:=MID(IN:=DT_STR,L:=1,P:=21));
HOUR:=STRING_TO_UINT(IN:=MID(IN:=DT_STR,L:=2,P:=12));
MINUTE:=STRING_TO_UINT(IN:=MID(IN:=DT_STR,L:=2,P:=15));
SECOND:=STRING_TO_UINT(IN:=MID(IN:=DT_STR,L:=2,P:=18));
END_IF;
ELSE
VALID:=FALSE;
END_IF;
]]></xhtml:p>
</ST>
</body>
<documentation>
<xhtml:p><![CDATA[Sample time from RTC on raising edge of TRIG. Outputs time as separate values and sets ACK to TRUE when output is ready. VALID is FALSE if hardware clock had a power failure and time is incorrect, TRUE otherwise.]]></xhtml:p>
</documentation>
</pou>
<pou name="setRTC" pouType="functionBlock">
<interface>
<inputVars>
<variable name="TRIG">
<type>
<BOOL/>
</type>
</variable>
<variable name="YEAR">
<type>
<UINT/>
</type>
</variable>
<variable name="MONTH">
<type>
<UINT/>
</type>
</variable>
<variable name="DAY">
<type>
<UINT/>
</type>
</variable>
<variable name="HOUR">
<type>
<UINT/>
</type>
</variable>
<variable name="MINUTE">
<type>
<UINT/>
</type>
</variable>
<variable name="SECOND">
<type>
<UINT/>
</type>
</variable>
</inputVars>
<outputVars>
<variable name="ACK">
<type>
<BOOL/>
</type>
</variable>
<variable name="VALID">
<type>
<BOOL/>
</type>
</variable>
</outputVars>
<localVars>
<variable name="eval">
<type>
<derived name="python_eval"/>
</type>
</variable>
<variable name="rtrig">
<type>
<derived name="R_TRIG"/>
</type>
</variable>
<variable name="COMPUTE">
<type>
<BOOL/>
</type>
</variable>
<variable name="INPUT_ARGS">
<type>
<string/>
</type>
</variable>
<variable name="INPUT_VALUE_CODE">
<type>
<string/>
</type>
</variable>
<variable name="RESULT">
<type>
<string/>
</type>
</variable>
</localVars>
</interface>
<body>
<ST>
<xhtml:p><![CDATA[(* Set RTC time *)
rtrig(CLK := TRIG, Q => COMPUTE);
IF COMPUTE THEN
INPUT_VALUE_CODE:=CONCAT(
'SetRTC(',
UINT_TO_STRING(YEAR), ',',
UINT_TO_STRING(MONTH), ',',
UINT_TO_STRING(DAY), ',',
UINT_TO_STRING(HOUR), ',',
UINT_TO_STRING(MINUTE), ',',
UINT_TO_STRING(SECOND), ')');
END_IF;
eval(TRIG := TRIG, CODE := INPUT_VALUE_CODE, ACK => ACK, RESULT => RESULT);
IF ACK THEN
VALID := RESULT = 'True';
END_IF;
]]></xhtml:p>
</ST>
</body>
<documentation>
<xhtml:p><![CDATA[Set RTC time on raising edge of TRIG]]></xhtml:p>
</documentation>
</pou>
</pous>
</types>
<instances>
<configurations/>
</instances>
</project>