aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/StateMachines
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2019-11-03 11:05:41 +0200
committerShlomo Hecht <shlomo@twine-s.com>2019-11-03 11:05:41 +0200
commit732d7aaededc72fd28eca57e5a5ffb89ab29a9ef (patch)
tree13db6b044ccdae6a93d79d9ce59cee7f3f405928 /Software/Embedded_SW/Embedded/StateMachines
parentef601f78d1e17cefc5bb4df82b4108d93cdea9dc (diff)
downloadTango-732d7aaededc72fd28eca57e5a5ffb89ab29a9ef.tar.gz
Tango-732d7aaededc72fd28eca57e5a5ffb89ab29a9ef.zip
add job end error codes. turn off safety alarms when cleared.improve idle/power on/off sequences
Diffstat (limited to 'Software/Embedded_SW/Embedded/StateMachines')
-rw-r--r--Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c4
-rw-r--r--Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerIdle.c32
-rw-r--r--Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerOffSequence.c5
-rw-r--r--Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c3
-rw-r--r--Software/Embedded_SW/Embedded/StateMachines/Printing/PrintingSTM.h3
5 files changed, 38 insertions, 9 deletions
diff --git a/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c b/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c
index fe6f12053..a6e0f7d12 100644
--- a/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c
+++ b/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c
@@ -265,7 +265,6 @@ uint32_t InitSequenceStartHeatingCallBackFunction(uint32_t IfIndex, uint32_t Bus
if (HeaterCheckReady()==true)
{
MachineStateDetail = MACHINE_STATE_MACHINE_READY_TO_DYE;
- SetMachineStatus(MACHINE_STATE__Ready);
if (SafeRemoveControlCallback(HWControlId, InitSequenceStartHeatingCallBackFunction )==OK)
HWControlId = 0xFF;
else
@@ -294,12 +293,15 @@ uint32_t InitSequenceStartHeating(void)
else
{
MachineStateDetail = MACHINE_STATE_NO_PROCESS_PARAMS;
+ SetMachineStatus(MACHINE_STATE__Ready);
+ REPORT_MSG(MachineStateDetail,"InitSequenceStateMachine no processparameters file");
}
}
else
{
REPORT_MSG(InitialHeating,"InitSequenceStateMachine InitialHeating is OFF");
MachineStateDetail = MACHINE_STATE_MACHINE_READY_TO_DYE;
+ InitStages++;
}
if (AutoHoming_Config >= AutoHoming_PowerOn_off )
{
diff --git a/Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerIdle.c b/Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerIdle.c
index df2f3705c..9fb7e097d 100644
--- a/Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerIdle.c
+++ b/Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerIdle.c
@@ -37,7 +37,8 @@ uint32_t IdleMixerTemperature = 0;
bool powerIdleState = false;
bool machineActive = false;
uint32_t IdleControlId = 0xFF;
-ProcessParameters ActiveProcessParameters;
+uint32_t IdleHeatingControlId = 0xFF;
+ProcessParameters ActiveProcessParameters,ProcessParametersClear;
void PowerIdleSetIdle(void)
{
memcpy (&ActiveProcessParameters,&ProcessParametersKeep,sizeof(ProcessParameters));
@@ -103,9 +104,10 @@ void PowerIdleInit(void)
void PowerIdleSetParameters(uint32_t switchtoidletimeinseconds,uint32_t idledriertemperature,uint32_t idleheadtemperature,uint32_t idlemixertemperature)
{
powerIdleSecondsLimit = switchtoidletimeinseconds;
- IdleDrierTemperature = idledriertemperature*100;
- IdleHeadTemperature = idleheadtemperature*100;
- IdleMixerTemperature = idlemixertemperature*100;
+ IdleDrierTemperature = idledriertemperature;
+ IdleHeadTemperature = idleheadtemperature;
+ IdleMixerTemperature = idlemixertemperature;
+ Report("Power Idle Set Parameters",__FILE__,powerIdleSecondsLimit,(int)idledriertemperature,RpWarning,(int)idleheadtemperature,0);
}
int getIdleCounter (void) {return powerIdleSecondsCounter;}
@@ -114,6 +116,22 @@ void setmachineActive(bool Active){machineActive = Active;}
void resetIdleCounter (void) {powerIdleSecondsCounter = 0;}
bool getIdleState (void) {return powerIdleState;}
+uint32_t PowerIdleStartHeatingCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag)
+{
+ if (HeaterCheckReady()==true)
+ {
+ //MachineStateDetail = MACHINE_STATE_MACHINE_READY_TO_DYE;
+ if (SafeRemoveControlCallback(IdleHeatingControlId, PowerIdleStartHeatingCallBackFunction )==OK)
+ IdleHeatingControlId = 0xFF;
+ else
+ Report("Remove control callback failed",__FILE__,__LINE__,(int)IdleHeatingControlId,RpWarning,(int)PowerIdleStartHeatingCallBackFunction,0);
+ //InitSequenceStateMachine(InitStages);
+ SetMachineStatus(MACHINE_STATE__Ready);
+ }
+
+ return OK;
+}
+
void PowerIdleOutOfIdleState(void)
{
Report("PowerIdle Out of Idle ",__FILE__,__LINE__,(int)powerIdleSecondsLimit,RpWarning,(int)powerIdleSecondsCounter,0);
@@ -128,10 +146,12 @@ void PowerIdleOutOfIdleState(void)
return ;
}
if (IdleControlId == 0xFF)
- IdleControlId = AddControlCallback("IdleCounter", PowerIdleCallBackFunction, eOneSecond, TemplateDataReadCBFunction,0,0, 0 );
+ IdleControlId = AddControlCallback( "NULL",PowerIdleCallBackFunction, eOneSecond, TemplateDataReadCBFunction,0,0, 0 );
if (IdleControlId == 0xFF)
Report("AddControlCallback failed",__FILE__,__LINE__,(int)IdleControlId,RpWarning,(int)0,0);
- SetMachineStatus(MACHINE_STATE__Ready);
+ SetMachineStatus(MACHINE_STATE__Initializing);
+ IdleHeatingControlId = AddControlCallback("Heating Out of Idle", PowerIdleStartHeatingCallBackFunction, 2*eOneSecond, TemplateDataReadCBFunction,0,0, 0 );
+
}
diff --git a/Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerOffSequence.c b/Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerOffSequence.c
index 67e86397c..285c6ee74 100644
--- a/Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerOffSequence.c
+++ b/Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerOffSequence.c
@@ -89,6 +89,7 @@ uint32_t PowerOffInit(void)
PowerOffMachineState++;
StopInitSequence();
setmachineActive(true);
+ PowerIdleOutOfIdleState();
PowerOffInProcess = true;
PowerOffControlId = AddControlCallback("PowerOff", PowerOffScheduler, eOneSecond, TemplateDataReadCBFunction,0,0, 0 );
SetMachineStatus(MACHINE_STATE__PowerOff);
@@ -114,7 +115,7 @@ uint32_t PowerOffHeadCleanCallback(uint32_t DispenserId, uint32_t ReadValue)
SafeRemoveControlCallback(PowerOffHeadCleanControlId, PowerOffHeadCleanCallback );
PowerOffHeadCleanControlId = 0xFF;
PowerOffMachineState++;
-
+ SetMachineStatus(MACHINE_STATE__PowerOff);
}
return OK;
}
@@ -139,6 +140,7 @@ uint32_t PowerOffHeadClean(void)
{
LOG_ERROR(0,"Clean job failed");
PowerOffMachineState++;
+ SetMachineStatus(MACHINE_STATE__PowerOff);
}
// if ( PowerOffHeadCleanControlId == 0xFF)
// return ERROR;
@@ -311,6 +313,7 @@ uint32_t PowerOffStopRunningJob(void)
if (JobIsActive())
{
REPORT_MSG (PowerOffMachineState, "Stop running job");
+ JobEndReason = JOB_ABORTED_BY_USER;
AbortJob("Power off pressed");
}
PowerOffMachineState++;
diff --git a/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c b/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c
index 1f6ff685e..58d82e428 100644
--- a/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c
+++ b/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c
@@ -82,7 +82,7 @@ JobEndReasonEnum JobEndReason = JOB_OK;
ErrorCode JobError_to_ErrorCode[JOB_ERRORS_MAX+1] = {ERROR_CODE__NONE,ERROR_CODE__JOB_UNSPECIFIED_ERROR,ERROR_CODE__JOB_THREAD_BREAK,ERROR_CODE__JOB_WINDER_DANCER_FAIL,
ERROR_CODE__JOB_POOLER_DANCER_FAIL,ERROR_CODE__JOB_FEEDER_DANCER_FAIL,ERROR_CODE__JOB_OUT_OF_DYE,ERROR_CODE__JOB_OTHER_ALARM,
ERROR_CODE__JOB_TEMPERATURE_ALARM,ERROR_CODE__JOB_LS_ALARM,ERROR_CODE__JOB_PRESSURE_ALARM,ERROR_CODE__JOB_CURRENT_ALARM,
- ERROR_CODE__JOB_MOTOR_ALARM,ERROR_CODE__JOB_OTHER_ALARM};
+ ERROR_CODE__JOB_MOTOR_ALARM,ERROR_CODE__JOB_LIDS_OPEN,ERROR_CODE__JOB_ABORTED_BY_USER,ERROR_CODE__JOB_SAFETY_ALARM,ERROR_CODE__JOB_OTHER_ALARM};
JobTicket *CurrentJob = NULL;
JobRequest *CurrentRequest = NULL;
@@ -353,6 +353,7 @@ void JobAbortFunc(MessageContainer* requestContainer)
my_free(responseContainer.data.data);
SendChars((char*)container_buffer, container_size);
abort_job_request__free_unpacked(request,NULL);
+ JobEndReason = JOB_ABORTED_BY_USER;
JobAbortedByUser = true;
AbortJob("Job Aborted by user");
//We keep the job request until it is done
diff --git a/Software/Embedded_SW/Embedded/StateMachines/Printing/PrintingSTM.h b/Software/Embedded_SW/Embedded/StateMachines/Printing/PrintingSTM.h
index 85f5a61c7..bd9998a31 100644
--- a/Software/Embedded_SW/Embedded/StateMachines/Printing/PrintingSTM.h
+++ b/Software/Embedded_SW/Embedded/StateMachines/Printing/PrintingSTM.h
@@ -97,6 +97,9 @@ typedef enum
JOB_CURRENT_ALARM,
JOB_MOTOR_ALARM,
JOB_TAMPER_ALARM,
+ JOB_LIDS_OPEN,
+ JOB_ABORTED_BY_USER,
+ JOB_SAFETY_CRITICAL_ALARM,
JOB_ERRORS_MAX
}JobEndReasonEnum;
extern JobEndReasonEnum JobEndReason;