From 48dafb43a47327faebfd0cca4eec300e8c99d02b Mon Sep 17 00:00:00 2001 From: Federico Rojas Date: Fri, 3 Apr 2020 15:14:25 +0200 Subject: [PATCH] Change GVL_APP.nAxisNum to GVL_APP.nAXIS_NUM because it is a constant --- solution/tc_project_app/GVLs/GVL_APP.TcGVL | 2 +- solution/tc_project_app/POUs/MAIN.TcPOU | 22 +++++++++++----------- solution/tc_project_app/tc_mca_std_lib | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/solution/tc_project_app/GVLs/GVL_APP.TcGVL b/solution/tc_project_app/GVLs/GVL_APP.TcGVL index d6f0aab..a423ad2 100644 --- a/solution/tc_project_app/GVLs/GVL_APP.TcGVL +++ b/solution/tc_project_app/GVLs/GVL_APP.TcGVL @@ -7,7 +7,7 @@ VAR_GLOBAL END_VAR VAR_GLOBAL CONSTANT - nAxisNum : UINT:=0; + nAXIS_NUM : UINT:=0; END_VAR]]> \ No newline at end of file diff --git a/solution/tc_project_app/POUs/MAIN.TcPOU b/solution/tc_project_app/POUs/MAIN.TcPOU index 76b6960..c0a18e8 100644 --- a/solution/tc_project_app/POUs/MAIN.TcPOU +++ b/solution/tc_project_app/POUs/MAIN.TcPOU @@ -4,7 +4,7 @@ - @@ -100,7 +100,7 @@ END_IF IF bRestoreExecute AND NOT bPositionRestoreDone THEN //Cycle through function blocks that read the encoder reference system i.e. whether axis is incremental or absolute //Result stored in Value, 0=Inc 1=Abs, execute set during the case statement - FOR iAxes := 1 TO GVL_APP.nAxisNum DO + FOR iAxes := 1 TO GVL_APP.nAXIS_NUM DO afbReadEncRefSys[iAxes]( Axis := GVL.astAxes[iAxes].Axis, Enable := bExecuteReadEncRefSys, @@ -109,7 +109,7 @@ IF bRestoreExecute AND NOT bPositionRestoreDone THEN END_FOR //Cycle through set position function blocks for each axis - FOR iAxes := 1 TO GVL_APP.nAxisNum DO + FOR iAxes := 1 TO GVL_APP.nAXIS_NUM DO afbRestorePosition[iAxes]( Axis := GVL.astAxes[iAxes].Axis, Position := astAxesPersistent[iAxes].fPositionAtShutdown); @@ -132,7 +132,7 @@ IF bRestoreExecute AND NOT bPositionRestoreDone THEN //Check the encoder reference system has been read for all axis -> if busy then continue with PLC cycle and check again next time. //If afbReadEncRefSys not started then go back a step. //If any axes result in an error the code will get stuck here, this happens if GVL_APP.nAxisNum is not set correctly - FOR iAxes := 1 TO GVL_APP.nAxisNum DO + FOR iAxes := 1 TO GVL_APP.nAXIS_NUM DO IF afbReadEncRefSys[iAxes].Valid = FALSE THEN IF afbReadEncRefSys[iAxes].Busy = TRUE THEN //Exit MAIN.STARTUP Action and wait till next cycle, needs to cycle through whole program in order for data to update @@ -153,7 +153,7 @@ IF bRestoreExecute AND NOT bPositionRestoreDone THEN eExecuteRestore: //Execute position restore by setting afbRestorePosition.execute = TRUE - FOR iAxes := 1 TO GVL_APP.nAxisNum DO + FOR iAxes := 1 TO GVL_APP.nAXIS_NUM DO IF afbReadEncRefSys[iAxes].Valid = TRUE AND afbReadEncRefSys[iAxes].Value = 0 AND NOT(astAxesPersistent[iAxes].bMovingAtShutdown) THEN IF GVL.astAxes[iAxes].stConfig.eRestorePosition = E_RestorePosition.eRestoreWithoutHome THEN afbRestorePosition[iAxes].Execute := TRUE; @@ -166,7 +166,7 @@ IF bRestoreExecute AND NOT bPositionRestoreDone THEN //Check the set position fbs are finished //Nothing actually happens if the restore is not done, the code just returns from here each cycle and the //bPositionRestoreDone will never get set to TRUE and will take up cycle time - FOR iAxes := 1 TO GVL_APP.nAxisNum DO + FOR iAxes := 1 TO GVL_APP.nAXIS_NUM DO IF afbReadEncRefSys[iAxes].Valid = TRUE AND afbReadEncRefSys[iAxes].Value = 0 AND NOT(astAxesPersistent[iAxes].bMovingAtShutdown) THEN IF GVL.astAxes[iAxes].stConfig.eRestorePosition = E_RestorePosition.eRestoreWithoutHome THEN IF NOT afbRestorePosition[iAxes].Done THEN @@ -179,7 +179,7 @@ IF bRestoreExecute AND NOT bPositionRestoreDone THEN eFinishRestore: //Remove execute = TRUE for afbRestorePosition - FOR iAxes := 1 TO GVL_APP.nAxisNum DO + FOR iAxes := 1 TO GVL_APP.nAXIS_NUM DO afbRestorePosition[iAxes].Execute := FALSE; END_FOR bPositionRestoreDone := TRUE; @@ -190,7 +190,7 @@ END_IF]]> - 0 THEN astAxesPersistent[iAxes].bMovingAtShutdown := TRUE; diff --git a/solution/tc_project_app/tc_mca_std_lib b/solution/tc_project_app/tc_mca_std_lib index 51ab59a..08a5fd1 160000 --- a/solution/tc_project_app/tc_mca_std_lib +++ b/solution/tc_project_app/tc_mca_std_lib @@ -1 +1 @@ -Subproject commit 51ab59a9140f8f7a745eae34f1e0654bac3a1cfc +Subproject commit 08a5fd1399ee7f333765229a2737919377ea0e6e