diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2020-12-01 07:47:08 +0200 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2020-12-01 07:47:08 +0200 |
| commit | 33fdc77f6c7f63a56ca887ba59d5edd8674004f1 (patch) | |
| tree | 4f6871801477cd1fd1d96540363d7852a5839a2a /Software/Embedded_SW/Embedded | |
| parent | 44ba64fd849a9d6ae987559b3b2622ba9bff26e5 (diff) | |
| download | Tango-33fdc77f6c7f63a56ca887ba59d5edd8674004f1.tar.gz Tango-33fdc77f6c7f63a56ca887ba59d5edd8674004f1.zip | |
simplify job end
Diffstat (limited to 'Software/Embedded_SW/Embedded')
| -rw-r--r-- | Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c | 56 |
1 files changed, 18 insertions, 38 deletions
diff --git a/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c b/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c index 75507b180..18579a338 100644 --- a/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c +++ b/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c @@ -1228,17 +1228,8 @@ void SendJobProgress(double ProcessedLength, int SegmentId, bool done, char *Mes JobStopReporting(); JobMessageStruc JobMessage; - if(JobEndReason == JOB_OK) - { - JobMessage.messageId = PrintingResultsOk; - } - else - { - JobMessage.messageId = PrintingResultsFail; - } - JobMessage.msglen = MAX_MSG_LEN; - if (JobmsgQ != NULL) - Mailbox_post(JobmsgQ , &JobMessage, BIOS_NO_WAIT); + HandleJobEnd(JobEndReason); + } // if (responseContainer.data.data) // my_free(responseContainer.data.data); @@ -1378,6 +1369,22 @@ void StartJob(void *JobDetails) Mailbox_post(JobmsgQ , &Message, BIOS_NO_WAIT); } +void HandleJobEnd(JobEndReasonEnum JobEndReason) +{ + JobActive = false; + JobResumed = false; + setmachineActive(false); + SetMachineStatus(MACHINE_STATE__Ready); + IDS_Dispenser_Store_Data(); + resetIdleCounter(); + CurrentJob = NULL; + if (IFS_Clearing_SuctionWaiting == true) + WHS_Set_IFS_Clearing_Suction(NUM_OF_MIDTANKS); + SuspendLargeMessages = false; + Report("Job Ended ", __FILE__, __LINE__, JobEndReason, RpMessage, 0, 0); + ExitState(NULL); +} + /****************************************************************************** * ======== messageTsk ======== * Task for this function is created statically. See the project's .cfg file. @@ -1429,34 +1436,7 @@ Void jobTask(UArg arg0, UArg arg1) PrintSTMMsgHandler(&Message); break; case PrintingResultsOk: - JobActive = false; - JobResumed = false; - setmachineActive(false); - SetMachineStatus(MACHINE_STATE__Ready); - IDS_Dispenser_Store_Data(); - resetIdleCounter(); - CurrentJob = NULL; - if (IFS_Clearing_SuctionWaiting == true) - WHS_Set_IFS_Clearing_Suction(NUM_OF_MIDTANKS); - SuspendLargeMessages = false; - Report("Job Ended PrintingResultsOk",__FILE__,__LINE__, 4,RpMessage,0,0); - //DiagnosticsStart(); - //CleanState(CurrentJob); - break; case PrintingResultsFail: - JobActive = false; - JobResumed = false; - setmachineActive(false); - //SetMachineStatus(MACHINE_STATE__Error); - SetMachineStatus(MACHINE_STATE__Ready); - resetIdleCounter(); - CurrentJob = NULL; - SuspendLargeMessages = false; - if (IFS_Clearing_SuctionWaiting == true) - WHS_Set_IFS_Clearing_Suction(NUM_OF_MIDTANKS); - Report("Job Ended PrintingResultsFail",__FILE__,__LINE__, 4,RpError,JobEndReason,0); - //send message data as a validation error message to host - ExitState(Message.messageData); break; case CleaningResultsOk: //send message data as a validation error message to host |
