Skip to content

Commit 0d4ac65

Browse files
MBP-247: Save axis status variables as persistent
1 parent 7502455 commit 0d4ac65

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

solution/tc_project_app/POUs/MAIN.TcPOU

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,8 +365,20 @@ END_IF
365365
//Store encoder position BIAS at shutdown
366366
astAxesPersistent[iAxes].fEncoderBiasAtShutdown := afbReadPositionBias[iAxes].Value;
367367
368-
//Store homing status at shutdown
368+
//Store axis status at shutdown
369+
astAxesPersistent[iAxes].bInitialized := GVL.astAxes[iAxes].stStatus.bAxisInitialized;
369370
astAxesPersistent[iAxes].bHomedAtShutdown := GVL.astAxes[iAxes].stStatus.bHomed;
371+
astAxesPersistent[iAxes].stMotionState := GVL.astAxes[iAxes].Axis.Status.MotionState;
372+
astAxesPersistent[iAxes].bError := GVL.astAxes[iAxes].Axis.Status.Error;
373+
astAxesPersistent[iAxes].nErrorID := GVL.astAxes[iAxes].Axis.Status.ErrorID;
374+
astAxesPersistent[iAxes].bErrorStop := GVL.astAxes[iAxes].Axis.Status.ErrorStop;
375+
astAxesPersistent[iAxes].bStandStill := GVL.astAxes[iAxes].Axis.Status.StandStill;
376+
astAxesPersistent[iAxes].bHasBeenStopped := GVL.astAxes[iAxes].Axis.Status.HasBeenStopped;
377+
astAxesPersistent[iAxes].bDisabled := GVL.astAxes[iAxes].Axis.Status.Disabled;
378+
astAxesPersistent[iAxes].bMoving := GVL.astAxes[iAxes].Axis.Status.Moving;
379+
380+
astAxesPersistent[iAxes].nCycles := astAxesPersistent[iAxes].nCycles + 1;
381+
astAxesPersistent[iAxes].fPositionDifference := ABS(afCurrentPosition[iAxes] - astAxesPersistent[iAxes].fPositionAtShutdown);
370382
371383
//Store value of moving at shutdown
372384
IF GVL.astAxes[iAxes].Axis.Status.Disabled OR astAxesPersistent[iAxes].fPositionDifference < fPositionDifferenceLimit THEN

0 commit comments

Comments
 (0)