Merged in federicor/add-check-to-pipeline (pull request #75)
Federicor/add check to pipeline Approved-by: Torsten Bögershausen
This commit is contained in:
19
.gitattributes
vendored
19
.gitattributes
vendored
@@ -11,8 +11,23 @@
|
||||
|
||||
# Tc files must be CRLF
|
||||
*.plcproj text eol=crlf
|
||||
*.Tc* text eol=crlf
|
||||
*.tsproj text eol=crlf
|
||||
*.Tc* text eol=crlf filter=cleanCode
|
||||
*.tsproj text eol=crlf filter=ignoreNetId
|
||||
*.txt text eol=crlf
|
||||
*.xml text eol=crlf
|
||||
*.xti text eol=crlf
|
||||
|
||||
|
||||
# Configure the following in TwinCAT:
|
||||
# TOOLS -> Options -> TwinCAT -> PLC Environment -> Write Options -> Separate LineIDS : True
|
||||
# To activate the filter, run
|
||||
#git config filter.ignoreNetId.clean 'sed -b -f filter/ignoreTargetNetId.sed'
|
||||
#git config filter.cleanCode.clean 'sed -b -f filter/cleanCode.sed'
|
||||
|
||||
# the check if the filter is there by running
|
||||
# cat ../../../../.git/modules/solution/tc_project_app/tc_pils/tc_pils_generic/config
|
||||
|
||||
#[filter "ignoreNetId"]
|
||||
# clean = sed -f filter/ignoreTargetNetId.sed
|
||||
#[filter "cleanCode"]
|
||||
# clean = sed -f filter/cleanCode.sed
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
image: python:3.7.3
|
||||
options:
|
||||
max-time: 1
|
||||
pipelines:
|
||||
default:
|
||||
- step:
|
||||
script:
|
||||
- git submodule update --init
|
||||
- python twincat_version_manager.py
|
||||
- python check_fix_white_space.py
|
||||
image: python:3.7.3
|
||||
options:
|
||||
max-time: 1
|
||||
pipelines:
|
||||
default:
|
||||
- step:
|
||||
script:
|
||||
- git submodule update --init
|
||||
- python twincat_version_manager.py
|
||||
- python check_fix_white_space.py
|
||||
- ./check_no_lineids.sh
|
||||
- ./check_code_before_sq_brackets.sh
|
||||
|
||||
|
||||
6
check_code_before_sq_brackets.sh
Executable file
6
check_code_before_sq_brackets.sh
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
git grep '.\]\]>' *.Tc*
|
||||
if test $? -ne 1; then
|
||||
echo >&2 "code before double square brackets found"
|
||||
exit 1
|
||||
fi
|
||||
6
check_no_lineids.sh
Executable file
6
check_no_lineids.sh
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
git grep '<LineIds' *.Tc*
|
||||
if test $? -ne 1; then
|
||||
echo >&2 "LineIds found"
|
||||
exit 1
|
||||
fi
|
||||
10
filter/cleanCode.sed
Normal file
10
filter/cleanCode.sed
Normal file
@@ -0,0 +1,10 @@
|
||||
# remove LineIds
|
||||
/<LineId/d
|
||||
/<\/LineId/d
|
||||
# Add a line after ]]
|
||||
/.\]\]>/s/]]>/\r\n]]>/g
|
||||
# convert tab to space
|
||||
/\t/s/\t/ /g
|
||||
# remove trailing space
|
||||
s/[[:blank:]]*$//
|
||||
s/[[:blank:]]*\r$/\r/
|
||||
5
filter/gitconfig
Normal file
5
filter/gitconfig
Normal file
@@ -0,0 +1,5 @@
|
||||
[filter "ignoreNetId"]
|
||||
clean = sed -b -f filter/ignoreTargetNetId.sed
|
||||
[filter "cleanCode"]
|
||||
clean = sed -b -f filter/cleanCode.sed
|
||||
|
||||
1
filter/ignoreTargetNetId.sed
Normal file
1
filter/ignoreTargetNetId.sed
Normal file
@@ -0,0 +1 @@
|
||||
s/}\" TargetNetId=\"[0-9.]+\"/}\" /g
|
||||
@@ -8,6 +8,7 @@ END_VAR
|
||||
VAR_GLOBAL CONSTANT
|
||||
nAXIS_NUM: UINT := 0; (*~ (OPC: 1 : available for OPC-clients)(OPC_PROP[0005]: 1 : OPC_PROP_RIGHTS, here read only)*)
|
||||
nPNEUMATIC_AXIS_NUM: UINT := 0;
|
||||
END_VAR]]></Declaration>
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
</GVL>
|
||||
</TcPlcObject>
|
||||
@@ -8,7 +8,8 @@ END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[//Program any specific code or safety code for an specific application when it involves multiple axes
|
||||
//Eg. Collision avoidance, interlocks, sequencing, etc.]]></ST>
|
||||
//Eg. Collision avoidance, interlocks, sequencing, etc.
|
||||
]]></ST>
|
||||
</Implementation>
|
||||
</POU>
|
||||
</TcPlcObject>
|
||||
@@ -8,7 +8,8 @@ VAR
|
||||
|
||||
//Hardware interlocks
|
||||
//bInterlockFwdOK AT %I*: BOOL;
|
||||
END_VAR]]></Declaration>
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[//Initial parameters of an Axis
|
||||
(*IF _TaskInfo[fbGetCurTaskIndex.index].FirstCycle THEN
|
||||
@@ -21,7 +22,8 @@ END_IF*)
|
||||
|
||||
//Define ACTIONS() or write exclusive code for an specific axis.
|
||||
(*Eg. Stop when temperature reaches certain values, reduce speed if a signal is activated, etc.
|
||||
Eg. GVL.astAxes[x].stControl.bInterlockFwd := NOT bInterlockFwdOK;*)]]></ST>
|
||||
Eg. GVL.astAxes[x].stControl.bInterlockFwd := NOT bInterlockFwdOK;*)
|
||||
]]></ST>
|
||||
</Implementation>
|
||||
</POU>
|
||||
</TcPlcObject>
|
||||
@@ -27,11 +27,13 @@ END_VAR
|
||||
|
||||
VAR PERSISTENT
|
||||
bRestoreOnStartup: BOOL;
|
||||
END_VAR]]></Declaration>
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[POSITION_RECOVERY();
|
||||
PROG();
|
||||
AXES();]]></ST>
|
||||
AXES();
|
||||
]]></ST>
|
||||
</Implementation>
|
||||
<Folder Name="POSITION_RECOVERY" Id="{3561f6ef-e145-4ed3-9839-f17334bd2d97}" />
|
||||
<Action Name="AXES" Id="{7eb32732-9b53-4934-8cd9-20ba971dd8ff}">
|
||||
@@ -56,7 +58,8 @@ END_FOR
|
||||
//Execute Pneumatic Axis logic
|
||||
FOR GVL.iPneumaticAxis := 1 TO GVL_APP.nPNEUMATIC_AXIS_NUM DO
|
||||
afbPneumaticAxes[GVL.iPneumaticAxis](stPneumaticAxisStruct := GVL.astPneumaticAxes[GVL.iPneumaticAxis]);
|
||||
END_FOR]]></ST>
|
||||
END_FOR
|
||||
]]></ST>
|
||||
</Implementation>
|
||||
</Action>
|
||||
<Action Name="CHECK_UPS" Id="{f0f28f50-53b8-4f73-b0f5-6d7ce4c1636f}" FolderPath="POSITION_RECOVERY\">
|
||||
@@ -83,7 +86,8 @@ ELSIF eGlobalSUpsState <> eSUPS_PowerOK THEN
|
||||
//next cycles of powerfailure
|
||||
//skip regular code execution for the remaining cycles of the powerfailure/writing of persistent data/quick shutdown...
|
||||
RETURN;
|
||||
END_IF]]></ST>
|
||||
END_IF
|
||||
]]></ST>
|
||||
</Implementation>
|
||||
</Action>
|
||||
<Action Name="POSITION_RECOVERY" Id="{28e203b7-aea5-42d0-980d-12a6841f9d22}" FolderPath="POSITION_RECOVERY\">
|
||||
@@ -92,7 +96,8 @@ END_IF]]></ST>
|
||||
IF (fbGetDeviceIdentification.stDevIdent.strHardwareSerialNo <> '') THEN
|
||||
CHECK_UPS();
|
||||
RESTORE_POSITIONS();
|
||||
END_IF]]></ST>
|
||||
END_IF
|
||||
]]></ST>
|
||||
</Implementation>
|
||||
</Action>
|
||||
<Action Name="PROG" Id="{5d03ebbb-2a47-4890-ad6d-e82daf72dc51}">
|
||||
@@ -108,7 +113,8 @@ GVL.fbGetCurTaskIndex();
|
||||
//Pneumatics_Template();
|
||||
|
||||
//Application program calls
|
||||
//Application_Template();]]></ST>
|
||||
//Application_Template();
|
||||
]]></ST>
|
||||
</Implementation>
|
||||
</Action>
|
||||
<Action Name="RESTORE_POSITIONS" Id="{0c7ee537-7bd9-4833-b428-c17cbb57e893}" FolderPath="POSITION_RECOVERY\">
|
||||
@@ -260,7 +266,8 @@ IF bRestoreExecute AND NOT bPositionRestoreDone THEN
|
||||
bRestoreExecute := FALSE;
|
||||
END_FOR
|
||||
END_CASE
|
||||
END_IF]]></ST>
|
||||
END_IF
|
||||
]]></ST>
|
||||
</Implementation>
|
||||
</Action>
|
||||
<Action Name="STORE_PERSISTENT" Id="{cb5c9254-2e5f-47b1-9baa-10e728a961b0}" FolderPath="POSITION_RECOVERY\">
|
||||
@@ -278,7 +285,8 @@ END_IF]]></ST>
|
||||
ELSE
|
||||
astAxesPersistent[iAxes].bMovingAtShutdown := TRUE;
|
||||
END_IF
|
||||
END_FOR]]></ST>
|
||||
END_FOR
|
||||
]]></ST>
|
||||
</Implementation>
|
||||
</Action>
|
||||
</POU>
|
||||
|
||||
Reference in New Issue
Block a user