Added first hmi interface implementation

This commit is contained in:
2026-02-19 00:20:05 +01:00
parent 0c40092d8f
commit a3ad956f0d
29 changed files with 591 additions and 240 deletions

View File

@@ -13,6 +13,9 @@ STRUCT
stBtnUnhold : ST_HMI_CONTROL_BUTTON;
stBtnUnsuspend : ST_HMI_CONTROL_BUTTON;
stBtnManualMode : ST_HMI_CONTROL_BUTTON;
stBtnProdMode : ST_HMI_CONTROL_BUTTON;
eCurrentState : E_PackMLState;
eCurrentMode : E_PackMLUnitMode;
END_STRUCT

View File

@@ -4,6 +4,7 @@
<Declaration><![CDATA[FUNCTION_BLOCK FB_PackMLGeneric
VAR_INPUT
stCommand : ST_PMLc;
stPackMLHMIInterface : REFERENCE TO ST_HMI_PackML;
END_VAR
VAR_OUTPUT
// Unit status
@@ -12,9 +13,6 @@ VAR_OUTPUT
// Admin data
stAdmin : ST_PMLa;
END_VAR
VAR_IN_OUT
stPackMLHMIInterface : ST_HMI_PackML;
END_VAR
VAR
// State machine handler
_fbStateMachine : FB_PackMLStateMachine;
@@ -57,7 +55,7 @@ IF _rtChangeCmdRequest.Q THEN
_eCmd := stCommand.eCntrlCmd;
END_IF
// Hande mode change request
// Handle mode change request
_rtChangeModeRequest(CLK := stCommand.xUnitModeChangeRequest);
IF _rtChangeModeRequest.Q THEN
@@ -151,7 +149,32 @@ A_HandleHMIOutput();]]></ST>
<Folder Name="States" Id="{2cf25144-1e5c-4db8-ba57-9d98461c53ce}" />
<Action Name="A_HandleHMIInput" Id="{723844ed-d531-4820-b577-cf5a7662c8f5}">
<Implementation>
<ST><![CDATA[// Handle clear button
<ST><![CDATA[// Check for valid hmi interface reference
IF (NOT __ISVALIDREF(stPackMLHMIInterface)) THEN
RETURN;
END_IF
// Handle manual mode button
IF stPackMLHMIInterface.stBtnManualMode.xRequest THEN
stPackMLHMIInterface.stBtnManualMode.xRequest := FALSE;
IF stPackMLHMIInterface.stBtnManualMode.xRelease THEN
M_ChangeToManual();
END_IF
END_IF
// Handle production mode button
IF stPackMLHMIInterface.stBtnProdMode.xRequest THEN
stPackMLHMIInterface.stBtnProdMode.xRequest := FALSE;
IF stPackMLHMIInterface.stBtnProdMode.xRelease THEN
M_ChangeToProd();
END_IF
END_IF
// Handle clear button
IF stPackMLHMIInterface.stBtnClear.xRequest THEN
stPackMLHMIInterface.stBtnClear.xRequest := FALSE;
@@ -235,7 +258,28 @@ END_IF]]></ST>
</Action>
<Action Name="A_HandleHMIOutput" Id="{73c47dbe-0382-4e83-8c9e-e4744dd66394}">
<Implementation>
<ST><![CDATA[// Handle clear button
<ST><![CDATA[// Check for valid hmi interface reference
IF (NOT __ISVALIDREF(stPackMLHMIInterface)) THEN
RETURN;
END_IF
// Handle manual mode button
stPackMLHMIInterface.stBtnManualMode.xRelease := (stStatus.eStateCurrent = E_PackMLState.STOPPED) OR (stStatus.eStateCurrent = E_PackMLState.ABORTED);
IF stStatus.eUnitModeCurrent = E_PackMLUnitMode.MANUAL THEN
stPackMLHMIInterface.stBtnManualMode.eFeedback := E_HMI_BUTTON_FEEDBACK.ACTIVE;
ELSE
stPackMLHMIInterface.stBtnManualMode.eFeedback := E_HMI_BUTTON_FEEDBACK.NONE;
END_IF
// Handle production mode button
stPackMLHMIInterface.stBtnProdMode.xRelease := (stStatus.eStateCurrent = E_PackMLState.STOPPED) OR (stStatus.eStateCurrent = E_PackMLState.ABORTED);
IF stStatus.eUnitModeCurrent = E_PackMLUnitMode.PRODUCTION THEN
stPackMLHMIInterface.stBtnProdMode.eFeedback := E_HMI_BUTTON_FEEDBACK.ACTIVE;
ELSE
stPackMLHMIInterface.stBtnProdMode.eFeedback := E_HMI_BUTTON_FEEDBACK.NONE;
END_IF
// Handle clear button
stPackMLHMIInterface.stBtnClear.xRelease := (stStatus.eStateCurrent = E_PackMLState.ABORTED);
IF stStatus.eStateCurrent = E_PackMLState.CLEARING THEN
stPackMLHMIInterface.stBtnClear.eFeedback := E_HMI_BUTTON_FEEDBACK.ACTIVE;
@@ -345,6 +389,28 @@ END_IF]]></ST>
<ST><![CDATA[M_StateComplete();]]></ST>
</Implementation>
</Method>
<Method Name="M_ChangeToManual" Id="{c8cc7ed4-1875-4691-b0ed-83c905e5b965}" FolderPath="Commands\">
<Declaration><![CDATA[METHOD M_ChangeToManual : BOOL
VAR_INPUT
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[IF (stStatus.eStateCurrent = E_PackMLState.STOPPED) OR (stStatus.eStateCurrent = E_PackMLState.ABORTED) THEN
_eMode := E_PackMLUnitMode.MANUAL;
END_IF]]></ST>
</Implementation>
</Method>
<Method Name="M_ChangeToProd" Id="{84f37ed0-0634-44e0-9515-b7938cb81a06}" FolderPath="Commands\">
<Declaration><![CDATA[METHOD M_ChangeToProd : BOOL
VAR_INPUT
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[IF (stStatus.eStateCurrent = E_PackMLState.STOPPED) OR (stStatus.eStateCurrent = E_PackMLState.ABORTED) THEN
_eMode := E_PackMLUnitMode.PRODUCTION;
END_IF]]></ST>
</Implementation>
</Method>
<Method Name="M_Clear" Id="{1ae1174f-acb8-4f8a-bc73-ec233f6637b2}" FolderPath="Commands\">
<Declaration><![CDATA[METHOD M_Clear : BOOL