Remove MAIN.SHUTDOWN from ordinary PLC cycle
This created a problem in that MAIN.STARTUP wasn't working correctly because it takes a couple of cycles to complete and MAIN.SHUTDOWN was overriding the values stored after a power loss. Thus the restore won't work for a user cold reset. It can be catered for by adding it back into the ordinary PLC cycle but only executing if bPositionRestoreDone is set.
This commit is contained in:
@@ -69,13 +69,12 @@ END_IF
|
||||
STARTUP();
|
||||
PROG();
|
||||
AXES();
|
||||
ERROR();
|
||||
SHUTDOWN();]]></ST>
|
||||
ERROR();]]></ST>
|
||||
</Implementation>
|
||||
<Action Name="AXES" Id="{7eb32732-9b53-4934-8cd9-20ba971dd8ff}">
|
||||
<Implementation>
|
||||
<ST><![CDATA[gvl.axes[1].config.eRestorePosition:=RestorePosition.RestoreWithoutHome;
|
||||
gvl.axes[2].config.eRestorePosition:=RestorePosition.RestoreWithHome;
|
||||
<ST><![CDATA[gvl.axes[1].config.eRestorePosition:=RestorePosition.DontRestore;
|
||||
gvl.axes[2].config.eRestorePosition:=RestorePosition.RestoreWithoutHome;
|
||||
|
||||
FOR GVL.iAxis:=1 TO gvl_app.axisNum DO
|
||||
aFbAxes[GVL.iAxis](stAxisStruct:=gvl.axes[GVL.iAxis]);
|
||||
@@ -223,7 +222,7 @@ IF bPositionRestoreDone = FALSE THEN
|
||||
PrepareToRestore:
|
||||
// Prepare to home for axes that opt in for mode 2 RestoreWithHome i.e. normal direct home
|
||||
FOR i:=1 TO gvl_app.axisNum DO
|
||||
IF fbReadEncRefSys[i].Value=0 AND NOT(bMovingAtShutdown[i]) AND gvl.axes[i].config.eRestorePosition=2 THEN
|
||||
IF fbReadEncRefSys[i].Value=0 AND NOT(bMovingAtShutdown[i]) AND gvl.axes[i].config.eRestorePosition=RestorePosition.RestoreWithHome THEN
|
||||
gvl.axes[i].control.eCommand:=MotionFunctions.Home;
|
||||
gvl.axes[i].config.nHomeSeq:=15;
|
||||
gvl.axes[i].config.fHomePosition:=iPositionAtShutdown[i];
|
||||
@@ -279,7 +278,6 @@ END_IF]]></ST>
|
||||
<LineId Id="135" Count="0" />
|
||||
<LineId Id="134" Count="0" />
|
||||
<LineId Id="81" Count="1" />
|
||||
<LineId Id="241" Count="0" />
|
||||
</LineIds>
|
||||
<LineIds Name="MAIN.AXES">
|
||||
<LineId Id="19" Count="1" />
|
||||
|
||||
Reference in New Issue
Block a user