From cf49f9b7af8cb4ad0376157d27ef208eca6d1304 Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Thu, 23 Jul 2020 18:54:20 +0300 Subject: some small changes, mostly in drier loading --- .../Embedded_SW/Embedded/Modules/Control/control.c | 3 ++ .../Modules/Diagnostics/DiagnosticActions.c | 6 +++ .../Modules/Diagnostics/DiagnosticsHoming.c | 11 ++--- .../Embedded/Modules/Heaters/Heaters_print.c | 16 +++++-- .../Embedded_SW/Embedded/Modules/IDS/IDS_print.c | 11 +---- .../Embedded/Modules/Stubs_Handler/Progress.c | 4 +- .../Embedded/Modules/Thread/ThreadLoad.c | 49 +++++++++++++++++----- .../Embedded_SW/Embedded/Modules/Waste/Waste_ex.h | 1 + .../Embedded/Modules/Waste/Waste_maint.c | 21 ++++++++++ 9 files changed, 94 insertions(+), 28 deletions(-) (limited to 'Software/Embedded_SW/Embedded/Modules') diff --git a/Software/Embedded_SW/Embedded/Modules/Control/control.c b/Software/Embedded_SW/Embedded/Modules/Control/control.c index 26fba0194..14275533e 100644 --- a/Software/Embedded_SW/Embedded/Modules/Control/control.c +++ b/Software/Embedded_SW/Embedded/Modules/Control/control.c @@ -597,6 +597,9 @@ uint32_t ControlLowLoop(uint32_t tick) continue; if (ControlArray[ControlLowDevice_i].ControlTiming == eOneMillisecond) continue; + if (ControlArray[ControlLowDevice_i].StartTick == tick) + continue; + if (((tick - ControlArray[ControlLowDevice_i].StartTick)%ControlArray[ControlLowDevice_i].ControlTiming)<=skipped_ticks) // run the control on exact intervals { ControlBacklog[backlogindex]=ControlLowDevice_i; diff --git a/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticActions.c b/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticActions.c index 4d3344ce7..7bda97734 100644 --- a/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticActions.c +++ b/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticActions.c @@ -24,6 +24,7 @@ #include #include +#include #include "drivers/FPGA/FPGA_GPIO/FPGA_GPIO.h" #include "drivers/I2C_Communication/DAC/blower.h" #include "drivers/I2C_Communication/ADC_MUX/ADC_MUX.h" @@ -214,6 +215,11 @@ uint32_t SetDigitalOutRequestRequestFunc(MessageContainer* requestContainer) Trigger_SetWHSValveWatseCartridge(request->value); break; case INTERFACE_IOS__GPO_WHS_WTANKPUMP2: + if ((IFS_Availability[1] == IFS_RECOGNIZED)&&(IFS_Availability[2] == IFS_RECOGNIZED)) //ifs installed -check cartridges + { + if (NoCartAvailable()) + return ERROR; + } SetWastePump( request->value); break; case INTERFACE_IOS__GPO_SPARE_SSR12_CTRL: diff --git a/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsHoming.c b/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsHoming.c index a439a8715..93bf916b2 100644 --- a/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsHoming.c +++ b/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsHoming.c @@ -480,18 +480,20 @@ uint32_t Diagnostics_Dryer_UnLoading_Callback(uint32_t MotorId, uint32_t ReadVal uint32_t temp = Read_Dryer_ENC_Position(); Report("Diagnostics_Dryer_UnLoading_Callback",__FILE__,ReadValue,temp,RpMessage,D_DrierPrevLocation,0); //Report("Diagnostics_Dryer_UnLoading_Callback details",__FILE__,(int)(TotalLoadedLen),D_numberOfCycles,RpMessage,CallbackCounter,0); - if (ReadValue == NOTBUSY) // OK - take another round + if ((abs (temp -D_DrierPrevLocation)>1000 )&&(ReadValue == NOTBUSY)) // OK - take another round +// if (ReadValue == NOTBUSY) // OK - take another round { D_DrierPrevLocation = temp; Report("Diagnostics_Dryer_UnLoading cycles",__FILE__,D_numberOfCycles,LoadArmRounds,RpMessage,0,0); if (D_numberOfCycles50 )&&(ReadValue == NOTBUSY)) { @@ -618,7 +631,7 @@ } else { - MotorMovetoEncoderPosition(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM,Thread_Load_Dryer_MovetoEncoderPosition_Callback,30000); + MotorMovetoEncoderPosition(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM,Thread_Load_Dryer_MovetoEncoderPosition_Callback,30000,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize); MCU_E2PromProgram(EEPROM_STORAGE_DRYER_CYCLES,numberOfCycles); Report("Store Number of cycles in drier",__FILE__,__LINE__,numberOfCycles,RpMessage,LoadArmRounds,0); } @@ -803,6 +816,7 @@ } uint32_t Thread_Load_Dryer_UnLoading_Callback(uint32_t MotorId, uint32_t ReadValue) { + bool direction; numberOfCycles++; uint32_t temp = Read_Dryer_ENC_Position(); Report("Thread_Load_Dryer_UnLoading_Callback",__FILE__,ReadValue,temp,RpMessage,DrierPrevLocation,0); @@ -823,7 +837,7 @@ } else //done enough cycles, go to the center point { - MotorMovetoEncoderPosition(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM,Thread_Load_Set_Load_Arm_To_Stopper_Callback,30000); + MotorMovetoEncoderPosition(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM,Thread_Load_Set_Load_Arm_To_Stopper_Callback,30000,1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize); MCU_E2PromProgram(EEPROM_STORAGE_DRYER_CYCLES,0); Report("Store Number of cycles in drier",__FILE__,__LINE__,numberOfCycles,RpMessage,LoadArmRounds,0); } @@ -831,7 +845,23 @@ else //timeout or no movement { Report("Store Number of cycles in drier - halted",__FILE__,__LINE__,numberOfCycles,RpMessage,LoadArmRounds,0); - MCU_E2PromProgram(EEPROM_STORAGE_DRYER_CYCLES,LoadArmRounds-numberOfCycles); + if (SecondTry == true) + MCU_E2PromProgram(EEPROM_STORAGE_DRYER_CYCLES,0); + else + MCU_E2PromProgram(EEPROM_STORAGE_DRYER_CYCLES,LoadArmRounds-numberOfCycles); + if (abs(temp -DrierPrevLocation)<200) + { + if (temp MotorControlConfig[index].m_ingnoreValue) + //if (fabs(calculated_speed-CurrentControlledSpeed[index])> MotorControlConfig[index].m_ingnoreValue) { CurrentControlledSpeed[index] = calculated_speed; MotorSetSpeed(ThreadMotorIdToMotorId[index], calculated_speed); diff --git a/Software/Embedded_SW/Embedded/Modules/Waste/Waste_ex.h b/Software/Embedded_SW/Embedded/Modules/Waste/Waste_ex.h index 308de0bd0..af4bd5e08 100644 --- a/Software/Embedded_SW/Embedded/Modules/Waste/Waste_ex.h +++ b/Software/Embedded_SW/Embedded/Modules/Waste/Waste_ex.h @@ -33,6 +33,7 @@ void cartFILLING_END(void); //{set state of ACTIVE to FULL} CartridgeStateEnum cartGetState (WasteCartridgeEnum); bool cartGetPresence (WasteCartridgeEnum CartId); bool cartCart_door();//Polled by polling function. Notify waste. Poll each 1 second. During active filling poll each 100msec +bool NoCartAvailable(); void Waste_Init(); void Waste_StateMachine(void); diff --git a/Software/Embedded_SW/Embedded/Modules/Waste/Waste_maint.c b/Software/Embedded_SW/Embedded/Modules/Waste/Waste_maint.c index 7d358cfc2..40e23e0b3 100644 --- a/Software/Embedded_SW/Embedded/Modules/Waste/Waste_maint.c +++ b/Software/Embedded_SW/Embedded/Modules/Waste/Waste_maint.c @@ -499,3 +499,24 @@ void Waste_StateMachine(void) break; } } +void Waste_Prepare(void) +{ + //check if the waste is ready to run - waste level not above overflow level and no cartridge in the slots + if (wasteLevel > wasteLevelOverflow) + { + Report("cannot start a job with waste tank overflow", __FILE__, __LINE__, wasteLevel, RpMessage, wasteLevelOverflow, 0); + PrepareReady(Module_Waste,ModuleFail); + return; + } + if ((WHS_IsEmptying())||(NoCartAvailable())) + { + PrepareReady(Module_Waste,ModuleDone); + } + else + { + Report("cannot start a job with cartridges in the IFS", __FILE__, __LINE__, wasteLevel, RpMessage, wasteLevelOverflow, 0); + PrepareReady(Module_Waste,ModuleFail); + } + return; + +} -- cgit v1.3.1