diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2019-10-31 10:16:10 +0200 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2019-10-31 10:16:10 +0200 |
| commit | cd18fb27a2499072f18cb0320ddeb85a0500a93e (patch) | |
| tree | b1bf1984813bc70ea4784e0e956497fd4fd35805 /Software/Embedded_SW/Embedded/StateMachines | |
| parent | 4aca8247565596d6c12ba73242d599dc42887625 (diff) | |
| download | Tango-cd18fb27a2499072f18cb0320ddeb85a0500a93e.tar.gz Tango-cd18fb27a2499072f18cb0320ddeb85a0500a93e.zip | |
version 1.4.6.0 - going forward
Diffstat (limited to 'Software/Embedded_SW/Embedded/StateMachines')
4 files changed, 36 insertions, 19 deletions
diff --git a/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c b/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c index cb30919bf..fe6f12053 100644 --- a/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c +++ b/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c @@ -116,8 +116,8 @@ uint32_t Start_InitSequence(void) { MachineStateDetail = MACHINE_STATE_HW_CONFIG; SetMachineStatus(MACHINE_STATE__Initializing); - HWControlId = AddControlCallback( InitSequenceCallBackFunction, 4* eOneSecond, TemplateDataReadCBFunction,0,0, 0 ); - InitSchedulerControlId = AddControlCallback( InitScheduler, eOneSecond, TemplateDataReadCBFunction,0,0, 0 ); + HWControlId = AddControlCallback("Init HW Init", InitSequenceCallBackFunction, 4* eOneSecond, TemplateDataReadCBFunction,0,0, 0 ); + InitSchedulerControlId = AddControlCallback("InitScheduler", InitScheduler, eOneSecond, TemplateDataReadCBFunction,0,0, 0 ); return OK; } void InitSequenceResetReason(void) @@ -211,13 +211,13 @@ uint32_t InitSequenceInitialBlowerActivation(void) Control_Voltage_To_Blower(BlowerCfg.voltage); else Control_Voltage_To_Blower(3000); - HWControlId = AddControlCallback( InitSequenceBlowerCallBackFunction, 10* eOneSecond, TemplateDataReadCBFunction,0,0, 0 ); + HWControlId = AddControlCallback("Init Blower", InitSequenceBlowerCallBackFunction, 10* eOneSecond, TemplateDataReadCBFunction,0,0, 0 ); /*if (RdInkCartridgeSensor()) //if there is a cartridge in the ink slot skip the valves procedure { MidTankOperationCounter = 32; Report("There is a cartridge in the ink slot. skipping the valves procedure",__FILE__,__LINE__,(int)MidTankOperationCounter,RpWarning,(int)InitStages,0); }*/ - MidTankControlId = AddControlCallback( InitSequenceMidTankCallBackFunction, 300/*eHundredMillisecond*/, TemplateDataReadCBFunction,0,0, 0 ); + MidTankControlId = AddControlCallback("Init Midtank", InitSequenceMidTankCallBackFunction, 300/*eHundredMillisecond*/, TemplateDataReadCBFunction,0,0, 0 ); return OK; } @@ -265,6 +265,7 @@ 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 @@ -287,7 +288,7 @@ uint32_t InitSequenceStartHeating(void) if (ProcessParamsInit() ==OK) { MachineStateDetail = MACHINE_STATE_HEATING_STARTED; - HWControlId = AddControlCallback( InitSequenceStartHeatingCallBackFunction, 2*eOneSecond, TemplateDataReadCBFunction,0,0, 0 ); + HWControlId = AddControlCallback("Init Heating", InitSequenceStartHeatingCallBackFunction, 2*eOneSecond, TemplateDataReadCBFunction,0,0, 0 ); //start heaters with predefined / store process parameters } else diff --git a/Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerIdle.c b/Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerIdle.c index 3cf2a363d..df2f3705c 100644 --- a/Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerIdle.c +++ b/Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerIdle.c @@ -94,7 +94,7 @@ uint32_t PowerIdleCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag) } void PowerIdleInit(void) { - IdleControlId = AddControlCallback( PowerIdleCallBackFunction, eOneSecond, TemplateDataReadCBFunction,0,0, 0 ); + IdleControlId = AddControlCallback("IdleCounter", PowerIdleCallBackFunction, eOneSecond, TemplateDataReadCBFunction,0,0, 0 ); if (IdleControlId == 0xFF) Report("AddControlCallback failed",__FILE__,__LINE__,(int)IdleControlId,RpWarning,(int)0,0); Report("PowerIdleInit ",__FILE__,__LINE__,(int)powerIdleSecondsLimit,RpWarning,(int)0,0); @@ -128,7 +128,7 @@ void PowerIdleOutOfIdleState(void) return ; } if (IdleControlId == 0xFF) - IdleControlId = AddControlCallback( PowerIdleCallBackFunction, eOneSecond, TemplateDataReadCBFunction,0,0, 0 ); + IdleControlId = AddControlCallback("IdleCounter", PowerIdleCallBackFunction, eOneSecond, TemplateDataReadCBFunction,0,0, 0 ); if (IdleControlId == 0xFF) Report("AddControlCallback failed",__FILE__,__LINE__,(int)IdleControlId,RpWarning,(int)0,0); SetMachineStatus(MACHINE_STATE__Ready); diff --git a/Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerOffSequence.c b/Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerOffSequence.c index 94567a1c7..67e86397c 100644 --- a/Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerOffSequence.c +++ b/Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerOffSequence.c @@ -90,7 +90,7 @@ uint32_t PowerOffInit(void) StopInitSequence(); setmachineActive(true); PowerOffInProcess = true; - PowerOffControlId = AddControlCallback( PowerOffScheduler, eOneSecond, TemplateDataReadCBFunction,0,0, 0 ); + PowerOffControlId = AddControlCallback("PowerOff", PowerOffScheduler, eOneSecond, TemplateDataReadCBFunction,0,0, 0 ); SetMachineStatus(MACHINE_STATE__PowerOff); return OK; } @@ -133,7 +133,7 @@ uint32_t PowerOffHeadClean(void) PowerOffHeadCleanControlId = 0xFF; //return ERROR; } - PowerOffHeadCleanControlId = AddControlCallback( PowerOffHeadCleanCallback,eOneSecond , TemplateDataReadCBFunction,0,0, 0 ); + PowerOffHeadCleanControlId = AddControlCallback(NULL, PowerOffHeadCleanCallback,eOneSecond , TemplateDataReadCBFunction,0,0, 0 ); } else { @@ -187,7 +187,7 @@ uint32_t PowerOffMixerFlushDispenserStopCallback(void) { REPORT_MSG (PowerOffMachineState, "PowerOffMixerFlushDispenserStopCallback"); IDS_Dispenser_Start_Motor_and_Open_Valve(TI_DISPENSER_ID,DEFAULT_MIXER_CLEANING_SPEED,NULL); - PowerOffHeadCleanControlId = AddControlCallback( PowerOffMixerFlushCallback,DEFAULT_MIXER_CLEANING_TIMEOUT , TemplateDataReadCBFunction,0,0, 0 ); + PowerOffHeadCleanControlId = AddControlCallback("Poweroff cleaning", PowerOffMixerFlushCallback,DEFAULT_MIXER_CLEANING_TIMEOUT , TemplateDataReadCBFunction,0,0, 0 ); return OK; } /*******************************************************************************************************/ @@ -296,7 +296,7 @@ uint32_t PowerOffWaitForProcesses(void) { WaitForProcessCounter = 0; //15 minutes wait REPORT_MSG (PowerOffMachineState, "Ongoing processes, wait for end of process"); - WaitForProcessControlId = AddControlCallback( PowerOffWaitForProcessesCallback, eOneSecond, TemplateDataReadCBFunction,0,0, 0 ); + WaitForProcessControlId = AddControlCallback("ongoing processes", PowerOffWaitForProcessesCallback, eOneSecond, TemplateDataReadCBFunction,0,0, 0 ); } else { @@ -373,7 +373,7 @@ uint32_t PowerOffWaitForTemperature(void) if (WaitForProcessControlId == 0xFF) { WaitForProcessCounter = 0; - WaitForProcessControlId = AddControlCallback( PowerOffWaitForTemperatureCallback, eOneSecond, TemplateDataReadCBFunction,0,0, 0 ); + WaitForProcessControlId = AddControlCallback("poweroff cooling", PowerOffWaitForTemperatureCallback, eOneSecond, TemplateDataReadCBFunction,0,0, 0 ); } //TBD return OK; diff --git a/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c b/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c index 3cdc4d1b8..1f6ff685e 100644 --- a/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c +++ b/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c @@ -102,7 +102,7 @@ JobUploadStrategy uploadstrategy = JOB_UPLOAD_STRATEGY__Default; ModuleStateEnum PrepareWaiting[MAX_SYSTEM_MODULES] = {ModuleIdle,ModuleIdle,ModuleIdle,ModuleIdle,ModuleIdle}; -uint16_t job_length = 0; +double job_length = 0.0; /******************************************************************************************** * functions describes motor operation flow and movement state during profile execution @@ -517,7 +517,23 @@ void ThreadJoggingRequestFunc(MessageContainer* requestContainer) ThreadJoggingResponse response = THREAD_JOGGING_RESPONSE__INIT; - status = ThreadJoggingFunc(request->speed); + if (JobIsActive() == true) + { + AbortJob(0); + //set the job handler to handle heaters, ids and waste in the state machine + Task_sleep(100); //let the job end procedure role before returning the configuration to normal. + usnprintf(ErrorMsg, 80,"Copy Configured T %d W %d I %d H %d W %d",CopyConfigured[Module_Thread],CopyConfigured[Module_Winder],CopyConfigured[Module_IDS],CopyConfigured[Module_Heaters],CopyConfigured[Module_Waste]); + Report(ErrorMsg, __FILE__, __LINE__, 0, RpWarning, 0, 0); + + + my_free(Ticket.segments); + my_free(TSegment); + my_free(Tspool); + } + else + { + status = ThreadJoggingFunc(request->speed); + } responseContainer = createContainer(MESSAGE_TYPE__ThreadJoggingResponse, requestContainer->token, true, &response, &thread_jogging_response__pack, &thread_jogging_response__get_packed_size); if (status!= OK) @@ -536,7 +552,7 @@ void ThreadJoggingRequestFunc(MessageContainer* requestContainer) } void ThreadAbortJoggingFunc(void) { - if (JobIsActive() == true) +/* if (JobIsActive() == true) { AbortJob(0); //set the job handler to handle heaters, ids and waste in the state machine @@ -549,7 +565,7 @@ void ThreadAbortJoggingFunc(void) my_free(TSegment); my_free(Tspool); } - +*/ } void ThreadAbortJoggingRequestFunc(MessageContainer* requestContainer) { @@ -640,7 +656,7 @@ void Stub_JobRequest(MessageContainer* requestContainer) StubLength = Ticket->length*100; StubLengthCounter = 0; ustrncpy (JobToken, requestContainer->token,36); - StubControlId = AddControlCallback( SendStubJobProgress, eOneSecond,TemplateDataReadCBFunction,0,0,0); + StubControlId = AddControlCallback(NULL, SendStubJobProgress, eOneSecond,TemplateDataReadCBFunction,0,0,0); jobStatus.has_progress = true; jobStatus.progress = 0.0; @@ -753,9 +769,9 @@ void JobRequestFunc(MessageContainer* requestContainer) if (JobAlarmReason ==OK) { n_unit_segments = n_segments; - if ((Ticket->has_units)&&(Ticket->units > 1)) + if ((Ticket->has_numberofunits)&&(Ticket->numberofunits > 1)) { - n_units = Ticket->units; + n_units = Ticket->numberofunits; } if (n_units>1) { |
