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/Modules/Thread/ThreadLoad.c | 49 +++++++++++++++++----- 1 file changed, 39 insertions(+), 10 deletions(-) (limited to 'Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c') diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c index f5bc45d85..2c8db8b6c 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c @@ -226,6 +226,19 @@ } return OK; } + uint32_t Thread_Load_Set_Load_Arm_To_Stopper_OnError_Callback(uint32_t deviceID, uint32_t BusyFlag) + { + + Report("Thread_Load_Set_Load_Arm_To_Stopper_OnError_Callback time",__FILE__,msec_millisecondCounter - UnloadingStart,msec_millisecondCounter,RpMessage,UnloadingStart,0); + + Report("Thread_Load_Set_Load_Arm_To_Stopper_OnError_Callback",__FILE__,__LINE__,LoadStages,RpMessage,CallbackCounter,0); + NumberOfDrierLoaderCycles=0; + //storeLoadArmParameters(); + MotorStop(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM,Hard_Stop); + SetMotHome(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM); //set this point as the spool home + + return OK; + } uint32_t Thread_Load_Set_Load_Arm_To_Stopper_Callback(uint32_t deviceID, uint32_t BusyFlag) { @@ -600,7 +613,7 @@ { numberOfCycles++; - Report("Thread_Load_Dryer_Loading_Callback",__FILE__,(int)TotalLoadedLen,(int)DrierPrevLocation,RpMessage,ReadValue,0); + Report("Thread_Load_Dryer_Loading_Callback",__FILE__,(int)TotalLoadedLen,(int)DrierPrevLocation,RpMessage,numberOfCycles,0); if ((fabs (TotalLoadedLen -DrierPrevLocation)>50 )&&(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); -- cgit v1.3.1 From 4afe631a74c19db1fe7d06d3ea7732decc69f82b Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Sun, 26 Jul 2020 19:03:22 +0300 Subject: loading improved, actoator relocated. waste alarms --- .../I2C_Communication/Head_Card/IO_Ports/Head_IO.c | 35 ++++++++++---- .../Modules/Diagnostics/DiagnosticActions.c | 5 +- .../Embedded/Modules/IDS/IDS_Cleaning.c | 5 +- .../Embedded_SW/Embedded/Modules/Thread/Thread.h | 3 ++ .../Embedded/Modules/Thread/ThreadLoad.c | 55 ++++++++++++++-------- .../Embedded/Modules/Thread/Thread_init.c | 2 +- .../Embedded/Modules/Waste/Waste_maint.c | 12 ++--- 7 files changed, 80 insertions(+), 37 deletions(-) (limited to 'Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c') diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/IO_Ports/Head_IO.c b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/IO_Ports/Head_IO.c index 691f1c455..1ac0e439b 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/IO_Ports/Head_IO.c +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/IO_Ports/Head_IO.c @@ -547,6 +547,12 @@ uint32_t HeadCard_ActStubCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag) / ACTUATORS Act_ID = (ACTUATORS)(IfIndex); + if (SafeRemoveControlCallback(ActControlId, HeadCard_ActStubCallBackFunction )==OK) + ActControlId = 0xFF; + else + Report("Remove control callback failed",__FILE__,__LINE__,(int)ActControlId,RpWarning,(int)HeadCard_ActStubCallBackFunction,0); + + Report("HeadCard_ActStubCallBackFunction",__FILE__,__LINE__,(int)ActControlId,RpWarning,(int)Act_ID,0); if(Act_ID == ACTIN)//0 { Head_I2C_EXP4_0x46.bits.OUTPUT_ACTLOW_ACTIN_ON = HIGH; @@ -563,6 +569,7 @@ uint32_t HeadCard_ActStubCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag) / uint32_t HeadCard_Actuators_Stub(ACTUATORS Act_ID, bool Enable, bool Direction)//ENABLE/DISABLE, DOWN/UP/DONTCARE { uint32_t status = OK; + Report("HeadCard_Actuators_Stub",__FILE__,Act_ID,(int)Enable,RpWarning,(int)Direction,0); if(Enable == true) { @@ -580,7 +587,8 @@ uint32_t HeadCard_Actuators_Stub(ACTUATORS Act_ID, bool Enable, bool Direction)/ } //100msec delay - (need short command - Active LOW ) - ActControlId = AddControlCallback("ctuatorControl", HeadCard_ActStubCallBackFunction, (eHundredMillisecond), TemplateDataReadCBFunction,Act_ID,0, 0 ); + if (ActControlId == 0xFF) + ActControlId = AddControlCallback("ctuatorControl", HeadCard_ActStubCallBackFunction, (eHundredMillisecond), TemplateDataReadCBFunction,Act_ID,0, 0 ); } else { @@ -594,6 +602,10 @@ uint32_t HeadCard_Actuators_Stub(ACTUATORS Act_ID, bool Enable, bool Direction)/ { Head_I2C_EXP4_0x46.bits.OUTPUT_ACTLOW_ACTOT_ON = HIGH; } + if (RemoveControlCallback(ActControlId, HeadCard_ActStubCallBackFunction )==OK) + ActControlId = 0xFF; + else + Report("Remove control callback failed",__FILE__,__LINE__,(int)ActControlId,RpWarning,(int)HeadCard_ActStubCallBackFunction,0); } status |= Head_Write_IO_Reg(0x42,HIGH); @@ -693,7 +705,7 @@ uint8_t Head_Test_IO() return status; } -#define ACTUATOR_RELOCATING_MOVEUP_TIME 160 +#define ACTUATOR_RELOCATING_MOVEUP_TIME 16//160 typedef enum { @@ -725,31 +737,38 @@ bool isActuatorOnLowestLocation(void) // Give indication if the actuator stopped uint32_t HeadCard_Actuators_Relocate_callback(uint32_t IfIndex, uint32_t BusyFlag) // use IfIndex for Act_ID { count_time++; + //ReportWithPackageFilter(ThreadFilter,"actuators relocation",__FILE__,msec_millisecondCounter,ActuatorLocating,RpMessage,count_time,0); switch (ActuatorLocating) { case ActuatorIdle: break; case ActuatorMoveDown: - Trigger_Head_Actuators_Stub(ACTIN, ENABLE, DOWN); - ActuatorLocating = ActuatorWait; - ReportWithPackageFilter(ThreadFilter,"actuators relocation",__FILE__,msec_millisecondCounter,ActuatorLocating,RpMessage,count_time,0); + if (count_time <=1) + Trigger_Head_Actuators_Stub(ACTIN, ENABLE, DOWN); + if (count_time > 10) + { + ReportWithPackageFilter(ThreadFilter,"actuators relocation",__FILE__,msec_millisecondCounter,ActuatorLocating,RpMessage,count_time,0); + ActuatorLocating = ActuatorWait; + } break; case ActuatorWait: if (isActuatorOnLowestLocation())//read the inputs in Hundred_msTick { - ActuatorLocating = ActuatorMoveUp; Trigger_Head_Actuators_Stub(ACTIN, ENABLE, UP); moveuptime = count_time; ReportWithPackageFilter(ThreadFilter,"actuators relocation",__FILE__,msec_millisecondCounter,ActuatorLocating,RpMessage,count_time,0); + ActuatorLocating = ActuatorMoveUp; } break; case ActuatorMoveUp: if (count_time>=(moveuptime+MovingUpTime)) { Trigger_Head_Actuators_Stub(ACTIN, DISABLE, DONTCARE); - ActuatorLocating = ActuatorLocated; ReportWithPackageFilter(ThreadFilter,"actuators relocation",__FILE__,msec_millisecondCounter,ActuatorLocating,RpMessage,count_time,0); + ActuatorLocating = ActuatorLocated; } + else + Trigger_Head_Actuators_Stub(ACTIN, ENABLE, UP); break; case ActuatorLocated: if (SafeRemoveControlCallback(ActuatorLocatingControl, HeadCard_Actuators_Relocate_callback )==OK) @@ -770,7 +789,7 @@ uint32_t HeadCard_Actuators_Relocate(void) ActuatorLocating = ActuatorMoveDown; count_time = 0; ReportWithPackageFilter(ThreadFilter,"actuators relocation",__FILE__,msec_millisecondCounter,ActuatorLocating,RpMessage,count_time,0); - ActuatorLocatingControl = AddControlCallback("Actuator Location", HeadCard_Actuators_Relocate_callback, eOneMillisecond, TemplateDataReadCBFunction,0,0, 0 ); + ActuatorLocatingControl = AddControlCallback("Actuator Location", HeadCard_Actuators_Relocate_callback, eTenMillisecond, TemplateDataReadCBFunction,0,0, 0 ); } return ActuatorLocatingControl; } diff --git a/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticActions.c b/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticActions.c index 7bda97734..9e7ab1e56 100644 --- a/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticActions.c +++ b/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticActions.c @@ -232,7 +232,10 @@ uint32_t SetDigitalOutRequestRequestFunc(MessageContainer* requestContainer) Pumps_Control(WASTECH_PUMP2, request->value); break; case INTERFACE_IOS__GPO_LED3: - Trigger_Head_Actuators_Control(ACTIN, LOW,request->value); + if (request->value == true) + Trigger_Head_Actuators_Control(ACTIN, LOW,request->value); + else + HeadCard_Actuators_Relocate(); break; case INTERFACE_IOS__GPO_LED4: Trigger_Head_Actuators_Control(ACTOT, LOW,request->value); diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_Cleaning.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_Cleaning.c index 0be1e7ebe..c9e9afdde 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_Cleaning.c +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_Cleaning.c @@ -101,8 +101,9 @@ uint32_t IDS_Cleaning_Center_And_Stop_Rockers (int timeout,callback_fptr callbac uint32_t status = OK; //status |= MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_DH_CLEANHEAD,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DH_CLEANHEAD].directionthreadwize, SaveRightRockerSpeed, Motor_Id_to_LS_IdUp[HARDWARE_MOTOR_TYPE__MOTO_DH_CLEANHEAD], callback,timeout); //status |= MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_DH_CLEANMECH,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DH_CLEANMECH].directionthreadwize, SaveLeftRockerSpeed, Motor_Id_to_LS_IdUp[HARDWARE_MOTOR_TYPE__MOTO_DH_CLEANMECH], callback,timeout); - Trigger_Head_Actuators_Disable(); - Trigger_Head_Actuators_Control(ACTIN, LOW,false); + HeadCard_Actuators_Relocate(); + //Trigger_Head_Actuators_Disable(); + //Trigger_Head_Actuators_Control(ACTIN, LOW,false); CleaningStageCounter = 0; CleaningStage = CleaningStageIdle; Report("IDS_Cleaning_Center_And_Stop_Rockers actuator down", __FILE__, __LINE__, timeout, RpWarning, 123456, 0); diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread.h b/Software/Embedded_SW/Embedded/Modules/Thread/Thread.h index 3a7045a6e..c912bca21 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread.h +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread.h @@ -85,5 +85,8 @@ uint32_t Control_Delta_Position_Pass(uint32_t Current_Read,uint32_t Previous_Rea void SetOriginMotorSpeed(float process_speed); +uint32_t ThreadPrepare_Tension (int DancerId, double tension); + + #endif //MODULES_THREAD_THREAD_H_ diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c index 2c8db8b6c..f95420725 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c @@ -236,6 +236,7 @@ //storeLoadArmParameters(); MotorStop(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM,Hard_Stop); SetMotHome(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM); //set this point as the spool home + MotorAbortMovetoLimitSwitch(HARDWARE_MOTOR_TYPE__MOTO_SCREW); return OK; } @@ -461,23 +462,35 @@ uint32_t Thread_Load_Close_Dancers(void) //Send Dancer Motors To Preset Location, Check That The Dancers Are On The Thread { + uint32_t current = 0; REPORT_MSG(LoadStages, "Thread Load State Machine step Thread_Load_Close_Dancers"); CallbackCounter++; MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_RDANCER,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RDANCER].directionthreadwize, 15, Motor_Id_to_LS_IdDown[HARDWARE_MOTOR_TYPE__MOTO_RDANCER], Thread_Load_HomingCallback,10000); - CallbackCounter++; - MotorSetMaxSpeed (HARDWARE_MOTOR_TYPE__MOTO_LDANCER1, 500); // MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_LDANCER1,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LDANCER1].directionthreadwize, 500, Motor_Id_to_LS_IdDown[HARDWARE_MOTOR_TYPE__MOTO_LDANCER1], Thread_Load_HomingCallback,25000); - MotorMoveWithCallback (HARDWARE_MOTOR_TYPE__MOTO_LDANCER1, MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LDANCER1].directionthreadwize, ((int)windertension*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LDANCER1].microstep), Thread_Load_HomingCallback,20000); - status |= MCU_E2PromProgram(EEPROM_WINDER_TENSION_POSITION,(int)windertension); - if (Is_PP_Machine() == true) //PP machine - new LTFU + status |= MCU_E2PromRead(EEPROM_WINDER_TENSION_POSITION,¤t); + + ThreadPrepare_Tension (HARDWARE_DANCER_TYPE__LeftDancer, windertension); +/* if (current!=windertension) { CallbackCounter++; - MotorSetMaxSpeed (HARDWARE_MOTOR_TYPE__MOTO_LDANCER2, 500); - MotorMoveWithCallback (HARDWARE_MOTOR_TYPE__MOTO_LDANCER2, MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LDANCER2].directionthreadwize, ((int)pullertension*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LDANCER2].microstep), Thread_Load_HomingCallback,20000); - status |= MCU_E2PromProgram(EEPROM_PULLER_TENSION_POSITION,(int)pullertension); - } + MotorSetMaxSpeed (HARDWARE_MOTOR_TYPE__MOTO_LDANCER1, 500); + MotorMoveWithCallback (HARDWARE_MOTOR_TYPE__MOTO_LDANCER1, MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LDANCER1].directionthreadwize, ((int)windertension*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LDANCER1].microstep), Thread_Load_HomingCallback,20000); + status |= MCU_E2PromProgram(EEPROM_WINDER_TENSION_POSITION,(int)windertension); + }*/ + if (Is_PP_Machine() == true) //PP machine - new LTFU + { + ThreadPrepare_Tension (HARDWARE_DANCER_TYPE__MiddleDancer, pullertension); + /*status |= MCU_E2PromRead(EEPROM_PULLER_TENSION_POSITION,¤t); + if (current!=pullertension) + { + CallbackCounter++; + MotorSetMaxSpeed (HARDWARE_MOTOR_TYPE__MOTO_LDANCER2, 500); + MotorMoveWithCallback (HARDWARE_MOTOR_TYPE__MOTO_LDANCER2, MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LDANCER2].directionthreadwize, ((int)pullertension*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LDANCER2].microstep), Thread_Load_HomingCallback,20000); + status |= MCU_E2PromProgram(EEPROM_PULLER_TENSION_POSITION,(int)pullertension); + }*/ + } return OK; } uint32_t Thread_Load_Close_Lids(void) @@ -507,7 +520,8 @@ { Report("Thread_Load_Close_actuators",__FILE__,__LINE__,LOW,RpMessage,true,0); Trigger_Head_Actuators_Control(ACTOT, LOW,false); - Trigger_Head_Actuators_Control(ACTIN, LOW,false); + //Trigger_Head_Actuators_Control(ACTIN, LOW,false); + HeadCard_Actuators_Relocate(); } return OK; } @@ -515,6 +529,7 @@ { REPORT_MSG(LoadStages, "Thread Load State Machine step Thread_Load_Resume_Heating"); ActivateHeadMagnet(); + HeadCard_Actuators_Relocate(); if (HandleProcessParameters(&ProcessParametersRecover,false)!= OK) { @@ -624,6 +639,7 @@ { return OK; } + MCU_E2PromProgram(EEPROM_STORAGE_DRYER_CYCLES,numberOfCycles); if (numberOfCycles 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/Thread/Thread_init.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c index e1f887303..39ff91558 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c @@ -145,7 +145,7 @@ uint32_t MotorPidRequestMessage(HardwarePidControl* request) NormalizedErrorCoEfficient[Motor_i] = NormalizedErrorCoEfficient[Motor_i] / temp; // uint32_t MotorSamples[MAX_THREAD_MOTORS_NUM][MAX_CONTROL_SAMPLES]; temp = 1<<(DancersCfg[ThreadMotorIdToDancerId[Motor_i]].resolutionbits); - temp = (temp*DancersCfg[ThreadMotorIdToDancerId[Motor_i]].maximalmovementmm*3/2); + temp = (temp*DancersCfg[ThreadMotorIdToDancerId[Motor_i]].maximalmovementmm);//*3/2); DancerStopActivityLimit[Motor_i] = temp/(2*PI*DancersCfg[ThreadMotorIdToDancerId[Motor_i]].armlength); return OK; } diff --git a/Software/Embedded_SW/Embedded/Modules/Waste/Waste_maint.c b/Software/Embedded_SW/Embedded/Modules/Waste/Waste_maint.c index 40e23e0b3..de95ddb03 100644 --- a/Software/Embedded_SW/Embedded/Modules/Waste/Waste_maint.c +++ b/Software/Embedded_SW/Embedded/Modules/Waste/Waste_maint.c @@ -397,12 +397,6 @@ void Waste_StateMachine(void) break; } - //check door - if (DoorState == OPEN) { - Report("Close cartridge cover", __FILE__, __LINE__, DoorState, RpMessage, 0, 0); - break; - } - // select cartridge SelectedCard = cartSELECT_CART(); if (SelectedCard == MaxWasteCartridges) { @@ -413,6 +407,12 @@ void Waste_StateMachine(void) AlarmHandlingSetAlarm( EVENT_TYPE__NO_WASTE_CARTRIDGE_AVAILABLE, false); } + //check door + //moved door handling down - I want to see the alarm even if the door is open + if (DoorState == OPEN) { + Report("Close cartridge cover", __FILE__, __LINE__, DoorState, RpMessage, 0, 0); + break; + } //check RFID? (TBD) //move to next state -- cgit v1.3.1 From 6bb63a96166785b09ad2e65885133f32077dc6c8 Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Mon, 27 Jul 2020 12:57:06 +0300 Subject: initial blower value 2/3 of process value. build pressure in cleaner. stop job on waste overlow or cartridge inserted --- .../WHS_Card/D_Max5805_ADC_Blower/WHS_Blower.c | 2 ++ .../Embedded/Modules/Heaters/Heaters_print.c | 2 +- .../Embedded_SW/Embedded/Modules/IDS/IDS_print.c | 41 +++++++++++++++++----- Software/Embedded_SW/Embedded/Modules/IFS/ifs.c | 10 +++--- .../Embedded/Modules/Thread/ThreadLoad.c | 8 ++--- .../Embedded/Modules/Waste/Waste_maint.c | 6 +++- .../StateMachines/Initialization/InitSequence.c | 2 +- 7 files changed, 50 insertions(+), 21 deletions(-) (limited to 'Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c') diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_Max5805_ADC_Blower/WHS_Blower.c b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_Max5805_ADC_Blower/WHS_Blower.c index ad34e4224..b974e4c5b 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_Max5805_ADC_Blower/WHS_Blower.c +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_Max5805_ADC_Blower/WHS_Blower.c @@ -653,6 +653,8 @@ uint32_t WHS_Pid_Testing_Func(double setParam,double measuredParam) SendLimitedBlowerControl(calculated_speed); if (calculated_speed < MIN_ALLOWED_BLOWER_VOLTAGE) WHS_ControlData.m_integral = 0; + if (calculated_speed > MAX_ALLOWED_BLOWER_VOLTAGE) + WHS_ControlData.m_integral = 0; return OK; diff --git a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c index a9899afd7..ec743ea4a 100644 --- a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c +++ b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c @@ -724,7 +724,7 @@ void PrepareACHeater(int HeaterId,uint32_t Frequency, uint32_t SetTemperatue) { if(Head_Type > HEAD_TYPE_SYLKO_WITHOUT_CARD) { - WHS_Set_SetPoint_Q_value(headairflow/2); + WHS_Set_SetPoint_Q_value(headairflow*2/3); } else { diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c index 5f1dfe138..a69b7fac5 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c @@ -45,6 +45,7 @@ HardwarePidControl DispensersCtrl[MAX_SYSTEM_DISPENSERS]; #define MAX_DYE_DISPENSERS 6 #define IDS_PRESEGMENT_TIME_STEP 50 +int32_t minimal_intersegment_length = 0; int32_t DispenserSamples[MAX_SYSTEM_DISPENSERS][MAX_CONTROL_SAMPLES] = {0}; int DispenserSamplePointer[MAX_SYSTEM_DISPENSERS] = {0}; double DispenserNormalizedErrorCoEfficient[MAX_SYSTEM_DISPENSERS] = {0}; @@ -119,15 +120,15 @@ void IDS_Dispenser_SetPreSegmentWFCFValues(double dispenserpresegmentwfcf, doubl LeftRockerSpeed = ids_leftcleaningmotorspeed; if ( ids_rightcleaningmotorspeed) RightRockerSpeed = ids_rightcleaningmotorspeed; + minimal_intersegment_length = ids_cleaningstopbeforesegmenttime+ids_cleaningstartspraypresegmenttime+2000; Report("IDS_Dispenser_SetPreSegmentCleaningValues ",__FILE__,__LINE__,RightRockerSpeed,RpWarning,(int)LeftRockerSpeed,0); - Report("IDS_Dispenser_SetPreSegmentCleaningValues ",__FILE__,__LINE__,InterSegmentStartSprayCleaner,RpWarning,(int)InterSegmentCenterRockers,0); + Report("IDS_Dispenser_SetPreSegmentCleaningValues ",__FILE__,minimal_intersegment_length,InterSegmentStartSprayCleaner,RpWarning,(int)InterSegmentCenterRockers,0); Report("IDS_Dispenser actuator times ",__FILE__,(int)LeftRockerSpeed/100*IDS_PRESEGMENT_TIME_STEP,(int)LeftRockerSpeed%100*IDS_PRESEGMENT_TIME_STEP,RpWarning,(int)RightRockerSpeed*IDS_PRESEGMENT_TIME_STEP,0); - } uint32_t DispenserPreSegmentControlId = 0xFF; uint32_t BrushStopControlId = 0xFF; - uint32_t PreSegmentControlId = 0xFF; + //uint32_t PreSegmentControlId = 0xFF; /*uint32_t IDS_DispenserControlInit() { @@ -576,6 +577,13 @@ uint32_t InactiveDispenserHome(uint32_t DispenserId, uint32_t ReadValue) } } } + if (GetDispenserPressure(CLEANER_DISPENSER) > 0.02) + { + HW_Motor_Id = DispenserIdToMotorId[CLEANER_DISPENSER]; + MotorStop(HW_Motor_Id, Hard_Hiz); + CurrentDispenserSpeed[CLEANER_DISPENSER] = 0; + Report("IDS stop cleaner",__FILE__,CLEANER_DISPENSER,(int)(GetDispenserPressure(CLEANER_DISPENSER)*100),RpWarning,(int)CurrentDispenserSpeed[CLEANER_DISPENSER] ,0); + } if ((NumofReadyDispensers)&&(DispenserBuildTimeCounter%1000 == 0)) { @@ -689,6 +697,13 @@ uint32_t InactiveDispenserHome(uint32_t DispenserId, uint32_t ReadValue) //start new stage if (endOfPrepareWCF == true) { + if (CurrentDispenserSpeed[CLEANER_DISPENSER]) + { + HW_Motor_Id = DispenserIdToMotorId[CLEANER_DISPENSER]; + MotorStop(HW_Motor_Id, Hard_Hiz); + CurrentDispenserSpeed[CLEANER_DISPENSER] = 0; + Report("IDS stop cleaner",__FILE__,CLEANER_DISPENSER,(int)(GetDispenserPressure(CLEANER_DISPENSER)*100),RpWarning,(int)CurrentDispenserSpeed[CLEANER_DISPENSER] ,0); + } SafeRemoveControlCallback(DispenserPrepareControlId, IDS_Prepare_Callback ); DispenserPrepareControlId = 0xFF; Report("IDS_Prepare_Callback SafeRemoveControlCallback",__FILE__,DispenserBuildTimeCounter,NumofReadyDispensers,RpWarning,(int)NumOfActiveDispensers,0); @@ -848,6 +863,12 @@ uint32_t InactiveDispenserHome(uint32_t DispenserId, uint32_t ReadValue) }*/ } } + TimerMotors_t HW_Motor_Id = DispenserIdToMotorId[CLEANER_DISPENSER]; + MotorSetSpeed((TimerMotors_t)HW_Motor_Id,400); //set the dispenser to the + CurrentDispenserSpeed[CLEANER_DISPENSER] = 400; + Report("IDS start cleaner",__FILE__,CLEANER_DISPENSER,(int)(GetDispenserPressure(CLEANER_DISPENSER)*100),RpWarning,(int)CurrentDispenserSpeed[CLEANER_DISPENSER] ,0); + + } DispenserBuildTimeCounter = 0; DispenserPrepareControlId = AddControlCallback(NULL, IDS_Prepare_Callback, PRESSURE_READ_TIME_GAP,TemplateDataReadCBFunction ,0, 0, 0 ); @@ -1259,15 +1280,19 @@ uint32_t IDSPreSegmentState(void *SegmentDetails, int SegmentId) if (SegmentId>0) { lInterSegmentLength = ((IntersegmentLength*100)*1000/dyeingspeed); + lInterSegmentLength-=(lInterSegmentLength%100); //round to a 100 multiplication InterSegmentStepsCount = 0; - DispenserPreSegmentControlId = AddControlCallback(NULL,IDSPreSegmentStateCallbackRunner, IDS_PRESEGMENT_TIME_STEP,TemplateDataReadCBFunction ,0, 0, 0 ); - if (DispenserPreSegmentControlId == 0xFF) + if (minimal_intersegment_length<((IntersegmentLength*100)*1000/dyeingspeed)) { - Report("Add control callback failed",__FILE__,__LINE__,(int)100,RpWarning,(int)0,0); - return ERROR; + DispenserPreSegmentControlId = AddControlCallback(NULL,IDSPreSegmentStateCallbackRunner, IDS_PRESEGMENT_TIME_STEP,TemplateDataReadCBFunction ,0, 0, 0 ); + if (DispenserPreSegmentControlId == 0xFF) + { + Report("Add control callback failed",__FILE__,__LINE__,(int)100,RpWarning,(int)0,0); + return ERROR; + } + Report("Add control callback ",__FILE__,__LINE__,(int)100,RpWarning,(int)lInterSegmentLength,0); } - Report("Add control callback ",__FILE__,__LINE__,(int)100,RpWarning,(int)lInterSegmentLength,0); /*if (EnableCleaning == true) { InterSegmentStartSprayCleaner = 500; diff --git a/Software/Embedded_SW/Embedded/Modules/IFS/ifs.c b/Software/Embedded_SW/Embedded/Modules/IFS/ifs.c index bfffb0d9b..1054da894 100644 --- a/Software/Embedded_SW/Embedded/Modules/IFS/ifs.c +++ b/Software/Embedded_SW/Embedded/Modules/IFS/ifs.c @@ -141,11 +141,8 @@ bool CartridgeInkFull() CartridgeFinishedCount = 0; Report("IFS_filling ", __FILE__,__LINE__,int_MidTank_Pressure_1000, RpMessage, int_MidTank_Pressure_1000, 0); /**** detect if the MidTank_Pressure is the same, 5 times ****/ - if (DetectIfCartridgeFinished(int_MidTank_Pressure_1000)) { - //currently sensor work properly only until 1.6 - 1.8 Liter (TBD) - Report("DetectIfCartridgeFinished", __FILE__,__LINE__,int_MidTank_Pressure_1000, RpMessage, int_MidTank_Pressure_1000, 0); - //return true; - } + if (DetectIfCartridgeFinished(int_MidTank_Pressure_1000)) + return true; } return false; } @@ -274,7 +271,8 @@ void midTankStateMachine(void) Report("Power-down in process", __FILE__, __LINE__, 0, RpMessage, 0, 0); break; } - + if (!RdInkCartridgeSensor()) + break; //check RFID? (TBD) // send request for validation to ppc diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c index f95420725..01c70d42f 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c @@ -116,6 +116,7 @@ bool InitCalled = false; uint32_t LoadArmRounds; + int CurrentlyLoaded = 0; uint32_t ThreadLoadStateMachine( THREAD_LOAD_STAGES_ENUM LoadStages); uint32_t ThreadLoadControlCBFunction(uint32_t index, uint32_t ReadValue); uint32_t ThreadLoadLengthCBFunction(uint32_t IfIndex, uint32_t ReadValue); @@ -210,7 +211,7 @@ { if(Head_Type > HEAD_TYPE_SYLKO_WITHOUT_CARD) { - WHS_Set_SetPoint_Q_value(headairflow/2); + WHS_Set_SetPoint_Q_value(headairflow*2/3); } else { @@ -639,7 +640,7 @@ { return OK; } - MCU_E2PromProgram(EEPROM_STORAGE_DRYER_CYCLES,numberOfCycles); + MCU_E2PromProgram(EEPROM_STORAGE_DRYER_CYCLES,numberOfCycles+CurrentlyLoaded); if (numberOfCycles wasteLevelOverflow) { Report("cannot start a job with waste tank overflow", __FILE__, __LINE__, wasteLevel, RpMessage, wasteLevelOverflow, 0); + JobEndReason = JOB_SAFETY_CRITICAL_ALARM; + AlarmHandlingSetAlarm( EVENT_TYPE__WASTE_CONTAINER_OVERFLOW, true); PrepareReady(Module_Waste,ModuleFail); return; } @@ -515,6 +517,8 @@ void Waste_Prepare(void) else { Report("cannot start a job with cartridges in the IFS", __FILE__, __LINE__, wasteLevel, RpMessage, wasteLevelOverflow, 0); + JobEndReason = JOB_OTHER_ALARM; + AlarmHandlingSetAlarm( EVENT_TYPE__ALL_WASTE_CARTRIDGES_FULL, true); PrepareReady(Module_Waste,ModuleFail); } return; diff --git a/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c b/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c index 761433888..1dd81d011 100644 --- a/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c +++ b/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c @@ -242,7 +242,7 @@ uint32_t InitSequenceBlowerCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag) Control_Voltage_To_Blower(3000); WHS_enable_control_loop(true); - WHS_Set_SetPoint_Q_value(headairflow/2); + WHS_Set_SetPoint_Q_value(headairflow*2/3); AlarmHandlingSetAlarm (EVENT_TYPE__MACHINE_STATE_INITIAL_BLOWER_FAILED,OFF); //handle alarm detection and operation waste_seq_step1();// include 1Sec delay <- to open !!!! -- cgit v1.3.1