Add check in MAIN.RESTOR_POSITIONS

Add check when resetting bRestoreOnStartup flag to only reset
if the UPS is OK. Otherwise during a power loss it is set and then reset before
getting to the end of the PLC cycle.
This was a result of moving some code that was previously in MAIN to an ACT
and the RETURN command does not work the same. I believe it only returns
from the current act and not the whole code. Originally it was supposed to
prevent the rest of the code from executing in the event of a power failure but
this is no longer the case.
This commit is contained in:
Paul Barron
2020-02-12 11:56:26 +01:00
parent 06fff58f08
commit 8433721ea4

View File

@@ -6,6 +6,7 @@ VAR
sVersion: STRING:='1.0.0';
i : UINT; //index variable for AXES()
aFbAxes: ARRAY [1..gvl_app.axisNum] OF FB_Axis;
hmiAxisSelection : INT:=1; //Not possible to use local hmi variables for array indexes
(******Outputs: Power for Limit switches and Home Sensors (every 4th output)********)
@@ -158,7 +159,7 @@ END_IF]]></ST>
// Note from Beckhoff: "A maximum of 1 MB persistent data can be reliably saved over the entire service life."
///#########################################################
IF bRestoreOnStartup THEN
IF bRestoreOnStartup AND eGlobalSUpsState = eSUPS_PowerOK THEN
bRestoreOnStartup:=FALSE;
bRestoreExecute:=TRUE;
END_IF
@@ -273,7 +274,7 @@ END_FOR]]></ST>
</Implementation>
</Action>
<LineIds Name="MAIN">
<LineId Id="444" Count="0" />
<LineId Id="505" Count="0" />
<LineId Id="134" Count="0" />
<LineId Id="81" Count="1" />
</LineIds>