diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2020-06-10 13:23:34 +0300 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2020-06-10 13:23:34 +0300 |
| commit | ceac18f1063d85c49db5d29c51f74e711b6405ab (patch) | |
| tree | cb61be1313f9be496652a4a1abe9bf65af92002c /Software | |
| parent | bfc8d0cc2055b7fa5171aeace011435e23f71359 (diff) | |
| download | Tango-ceac18f1063d85c49db5d29c51f74e711b6405ab.tar.gz Tango-ceac18f1063d85c49db5d29c51f74e711b6405ab.zip | |
fix threadloading, enable dispenser pulling down, WHS blower PID control
Diffstat (limited to 'Software')
12 files changed, 142 insertions, 51 deletions
diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_MAX11614_ADC/WHS_MAX11614_A2D.c b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_MAX11614_ADC/WHS_MAX11614_A2D.c index f50689d61..3671ff4e0 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_MAX11614_ADC/WHS_MAX11614_A2D.c +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_MAX11614_ADC/WHS_MAX11614_A2D.c @@ -354,7 +354,7 @@ double GetWHSAirFlow(uint8_t OR_Id) { case DRIER_FLOW_METER: - if (display_view == AVERAGE) + /*if (display_view == AVERAGE) { Q_value = get_average_Q(DRIER_FLOW_METER); } @@ -363,14 +363,15 @@ double GetWHSAirFlow(uint8_t OR_Id) //get_orf_3(&value); //Q_value = get_Q(value-orf3V0Value); Q_value = get_CurrentQ(DRIER_FLOW_METER); - } + }*/ + Q_value = get_CurrentQ(DRIER_FLOW_METER); //Q_value = get_average_Q(HEAD_FLOW_METER); break; case NU_FLOW_METER: get_orf_2(&value); break; case HEAD_FLOW_METER: - if (display_view == AVERAGE) + /*if (display_view == AVERAGE) { Q_value = get_average_Q(HEAD_FLOW_METER); } @@ -378,7 +379,8 @@ double GetWHSAirFlow(uint8_t OR_Id) { //get_orf_1(&value); Q_value = get_CurrentQ(HEAD_FLOW_METER); - } + }*/ + Q_value = get_CurrentQ(HEAD_FLOW_METER); break; default: break; diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_MAX11614_ADC/WHS_MAX11614_A2D.h b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_MAX11614_ADC/WHS_MAX11614_A2D.h index 1fdf91d11..5bf85fb6b 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_MAX11614_ADC/WHS_MAX11614_A2D.h +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_MAX11614_ADC/WHS_MAX11614_A2D.h @@ -52,6 +52,7 @@ bool Test_WHS_max11614(void); //double get_Q(int16_t num); double get_Q(WHS_Flow_Meter num); uint32_t WHS_MAX11614_Read_allADC(void); +double get_CurrentQ(WHS_Flow_Meter num); bool get_orf_1(uint16_t *value); bool get_orf_2(uint16_t *value); 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 9a2ed52af..4a02d2127 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 @@ -16,9 +16,13 @@ #include <Drivers/I2C_Communication/DAC/Blower.h> #include "drivers/I2C_Communication/ADC_MUX/ADC_MUX.h" +#include "modules/control/pidalgo.h" + #include "drivers/valves/valve.h" #include <Drivers/I2C_Communication/WHS_Card/D_MAX11614_ADC/WHS_MAX11614_A2D.h> +#include "PMR/Hardware/HardwarePidControl.pb-c.h" + #include "StateMachines/Initialization/InitSequence.h" bool Read_Max5805_device_ID(); @@ -203,7 +207,7 @@ double WHS_Blower_Avarege(WHS_Flow_Meter ORF_id) double Q_temp = 0 ; double average_Q = 0.0; - switch (ORF_id) + /*switch (ORF_id) { case HEAD_FLOW_METER: // get_orf_1( &orifice_hex_value ); @@ -217,10 +221,10 @@ double WHS_Blower_Avarege(WHS_Flow_Meter ORF_id) break; default: break; - } + }*/ Q_temp = get_Q(ORF_id); - if (fabs(Q_temp - average_Q) > 1.75) + /*if (fabs(Q_temp - average_Q) > 1.75) { Report("------------ set_new_Q_average :-----------------", __FILE__,__LINE__, (int)(Q_temp*100), RpMessage, (int)(average_Q*100), 0); set_new_Q_average(ORF_id, Q_temp); @@ -229,11 +233,11 @@ double WHS_Blower_Avarege(WHS_Flow_Meter ORF_id) else { average_Q = calc_Q_average(ORF_id, Q_temp); - } + }*/ return average_Q; } -void set_new_Q_average(WHS_Flow_Meter ORF_id,double Q_temp) +/*void set_new_Q_average(WHS_Flow_Meter ORF_id,double Q_temp) { uint8_t i = 0; @@ -283,17 +287,6 @@ double calc_Q_average(WHS_Flow_Meter ORF_id,double Q_temp) sum_orifice_Q += average_orf1_Q_buff[i_head]; average_Q_orifice1 = sum_orifice_Q /ORF_BUFF_SIZE; Q_average = average_Q_orifice1; - /*if (i_head == 0) - { - for (ii = 0; ii<ORF_BUFF_SIZE;ii++) - { - Q_sum+=average_orf1_Q_buff[ii]; - } - t_avg = Q_sum/ORF_BUFF_SIZE; - usnprintf(whs_str, 150, "whs average shai's sum %d avg %d my sum %d avg %d",(int)(sum_orifice_Q*100),(int)(Q_average*100),(int)(Q_sum*100),(int)(t_avg*100)); - Report(whs_str, __FILE__,__LINE__, (int)(Q_temp*100), RpMessage, (int)(Q_average*100), 0); - - }*/ break; case DRIER_FLOW_METER: if (i_drier == ORF_BUFF_SIZE) @@ -331,9 +324,9 @@ double get_average_Q(WHS_Flow_Meter ORF_id) break; } return average_Q; -} +}*/ -bool Test_WHS_blower() +/*bool Test_WHS_blower() { bool status = OK; @@ -349,7 +342,7 @@ bool Test_WHS_blower() delayms(4000); return status; -} +}*/ bool IFS_Clearing_Suction = false; bool IFS_Clearing_SuctionWaiting = false; int midtank_cleared = NUM_OF_MIDTANKS; @@ -370,9 +363,10 @@ void WHS_Set_IFS_Clearing_Suction (int midtank) } #define MAX_ALLOWED_BLOWER_VOLTAGE 4300 +#define MIN_ALLOWED_BLOWER_VOLTAGE 2000 void SendLimitedBlowerControl(int mV) { - if (mV<=MAX_ALLOWED_BLOWER_VOLTAGE) + if ((mV<=MAX_ALLOWED_BLOWER_VOLTAGE)&&(mV>=MIN_ALLOWED_BLOWER_VOLTAGE)) Control_Voltage_To_Blower(mV); else Report("------------ Controlled voltage over the maximum - refused-----------------", __FILE__,__LINE__, (int)mV, RpMessage, MAX_ALLOWED_BLOWER_VOLTAGE, 0); @@ -381,14 +375,15 @@ void SendLimitedBlowerControl(int mV) #define STEP_100 100 //todo define the correct number #define STEP_10 10 //todo define the correct number #define STEP_1 1 //todo define the correct number +uint32_t WHS_Pid_Testing_Func(double setParam,double measuredParam); +uint16_t volt; bool WHS_Set_Blower_Control_Closed_Loop(double Q_value) { double current_dying_head_flow_Q = 0.0; - uint16_t volt; double tmp = 0.0; - current_dying_head_flow_Q = get_average_Q(HEAD_FLOW_METER); + current_dying_head_flow_Q = get_CurrentQ(HEAD_FLOW_METER);//get_average_Q(HEAD_FLOW_METER); ReportWithPackageFilter(WasteFilter,"------------ current_dying_head_flow_Q =-----------------", __FILE__,__LINE__, current_dying_head_flow_Q, RpMessage, 0, 0); ReportWithPackageFilter(WasteFilter,"------------ SET_DYEING_HEAD_ORRIFFICE_SENSOR =-----------------", __FILE__,__LINE__, (int)(Q_value * 1000), RpMessage, (int)(current_dying_head_flow_Q * 1000), 0); tmp = fabs((current_dying_head_flow_Q) - (Q_value)); @@ -417,9 +412,11 @@ bool WHS_Set_Blower_Control_Closed_Loop(double Q_value) } } - if (tmp > 0.02) + volt = getBlowerState(); + WHS_Pid_Testing_Func(Q_value,current_dying_head_flow_Q); + close_loop_time = 1; + if (0)//(tmp > 0.02) { - volt = getBlowerState(); //volt = g_MAX5805_device.CODE; if (current_dying_head_flow_Q < Q_value) { @@ -541,4 +538,75 @@ uint16_t WHS_Get_Volt_Blower_Control() { return g_MAX5805_device.CODE; } +HardwarePidControl WHS_ControlInfo; +typedef struct +{ + bool m_isEnabled; + float m_SetParam; + float m_mesuredParam; + float m_preError; + float m_integral; + float m_calculatedError; + bool m_isReady; + PID_Config_Params m_params; +}WhsControlConfig_t; +WhsControlConfig_t WHS_ControlData = {0}; +char whs_str[150]; +uint32_t WHS_Pid_Testing_Func(double setParam,double measuredParam) +{ + float calculated_speed; + WHS_ControlData.m_mesuredParam = measuredParam; + WHS_ControlData.m_SetParam = setParam; + WHS_ControlData.m_calculatedError = PIDAlgorithmCalculation((float)WHS_ControlData.m_SetParam , (float)WHS_ControlData.m_mesuredParam, + &WHS_ControlData.m_params, &WHS_ControlData.m_preError, &WHS_ControlData.m_integral); + calculated_speed = volt+WHS_ControlData.m_calculatedError; + /*if (calculated_speed > (volt + 100)) + calculated_speed = volt + 100; + if (calculated_speed < (volt - 100)) + calculated_speed = volt - 100;*/ + usnprintf(whs_str, 150, "WHS_Pid_Testing_Func meas %d set %d error %d integral %d blower %d", + (int)(measuredParam*100),(int)(setParam*100),(int)(WHS_ControlData.m_calculatedError*100),(int)(WHS_ControlData.m_integral*100),(int)(calculated_speed)); + Report(whs_str, __FILE__,__LINE__, (int)(calculated_speed), RpMessage, (int)(volt), 0); + SendLimitedBlowerControl(calculated_speed); + + return OK; +} +/*void WHS_Start_Pid_Testing(int DispenserId) +{ + DispenserPidControlId[DispenserId] = AddControlCallback(NULL, WHS_Pid_Testing_Func,eOneSecond , TemplateDataReadCBFunction,DispenserId,DispenserId, DispenserId ); + Report("WHS_Start_Pid_Testing ",__FILE__,__LINE__,DispenserId,RpWarning,(int)DispenserPidControlId[DispenserId],0); +} +void WHS_Stop_Pid_Testing(int DispenserId) +{ + //stop this control loop + RemoveControlCallback(DispenserPidControlId[DispenserId], WHS_Pid_Testing_Func ); + DispenserPidControlId[DispenserId] = 0xFF; + Report("WHS_Stop_Pid_Testing ",__FILE__,__LINE__,DispenserId,RpWarning,(int)DispenserPidControlId[DispenserId],0); +}*/ + +uint32_t WHS_PidRequestMessage(void* request) +{ + HardwarePidControl * PID_Request = request; + + WHS_ControlData.m_params.MAX = 200; + WHS_ControlData.m_params.MIN = -200; + WHS_ControlData.m_params.Kd = PID_Request->derivativetime; + WHS_ControlData.m_params.Kp = PID_Request->proportionalgain; + WHS_ControlData.m_params.Ki = PID_Request->integraltime; + WHS_ControlData.m_params.IntegralErrorMultiplier = PID_Request->setpointramprateorsoftstartramp; + WHS_ControlData.m_params.ProportionalErrorMultiplier = PID_Request->outputonoffhysteresisvalue; + WHS_ControlData.m_params.epsilon = PID_Request->epsilon; + WHS_ControlData.m_params.dt = PID_Request->controloutputtype; + //WHS_ControlData.m_ingnoreValue = PID_Request->sensorcorrectionadjustment; // the minimal change required to change the motor speed in pulses + WHS_ControlData.m_calculatedError = 0; + WHS_ControlData.m_integral = 0; + WHS_ControlData.m_isEnabled = true; + WHS_ControlData.m_isReady = true; + WHS_ControlData.m_mesuredParam = 0; + WHS_ControlData.m_preError = 0; + WHS_ControlData.m_SetParam = PID_Request->outputproportionalcycletime;//need to update SetParams on presegment stage + + + return OK; +} diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_Max5805_ADC_Blower/WHS_Blower.h b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_Max5805_ADC_Blower/WHS_Blower.h index 1bf096b90..f5bc52858 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_Max5805_ADC_Blower/WHS_Blower.h +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_Max5805_ADC_Blower/WHS_Blower.h @@ -32,6 +32,8 @@ double WHS_Get_Blower_Control_Closed_Loop_SetPoint(void); void WHS_Set_SetPoint_Q_value(double value); void WHS_enable_control_loop(bool value); +uint32_t WHS_PidRequestMessage(void* request); + extern double headairflow; /* from Blower.h * diff --git a/Software/Embedded_SW/Embedded/Drivers/flash_ram/MCU_E2Prom.c b/Software/Embedded_SW/Embedded/Drivers/flash_ram/MCU_E2Prom.c index ee125c10b..2b08160a9 100644 --- a/Software/Embedded_SW/Embedded/Drivers/flash_ram/MCU_E2Prom.c +++ b/Software/Embedded_SW/Embedded/Drivers/flash_ram/MCU_E2Prom.c @@ -180,7 +180,7 @@ void MainCardEEpromReadRequestFunc(MessageContainer* requestContainer) StubMainCardEEpromReadRequest* request = stub_main_card_eeprom_read_request__unpack(NULL, requestContainer->data.len, requestContainer->data.data); - StubMainCardEEpromReadResponse response = STUB_MAIN_CARD_EEPROM_WRITE_RESPONSE__INIT; + StubMainCardEEpromReadResponse response = STUB_MAIN_CARD_EEPROM_READ_RESPONSE__INIT; if (request->has_address == true) { diff --git a/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c b/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c index d0470a11b..ae946ce1d 100644 --- a/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c +++ b/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c @@ -42,6 +42,7 @@ #include "drivers/I2C_Communication/ADC_MUX/ADC_MUX.h" #include "Drivers/I2C_Communication/I2C.h" #include "drivers/Flash_ram/MCU_E2Prom.h" +#include <Drivers/I2C_Communication/WHS_Card/D_Max5805_ADC_Blower/WHS_Blower.h> #include "StateMachines/Printing/PrintingSTM.h" #include "StateMachines/Initialization/InitSequence.h" @@ -396,12 +397,12 @@ uint32_t HWConfiguration(UploadHardwareConfigurationRequest* UploadRequest) LOG_ERROR (0, "Wrong Data Allocation"); return ERROR; } - if (InitFailures > 3) + /*if (InitFailures > 3) { Report("HWConfigurationInit repeated failure",__FILE__,__LINE__,(int)InitFailures,RpWarning,(int)EEPROM_INIT_FAILURE_COUNTER,0); AlarmHandlingSetAlarm (EVENT_TYPE__MACHINE_STATE_HW_CONFIG_FAILED,ON); return ERROR; - } + }*/ HardwareConfiguration *request = UploadRequest->hardwareconfiguration; @@ -468,8 +469,12 @@ uint32_t HWConfiguration(UploadHardwareConfigurationRequest* UploadRequest) else if ((request->pidcontrols[PID_i]->hardwarepidcontroltype >= HARDWARE_PID_CONTROL_TYPE__MotorDryer)&& (request->pidcontrols[PID_i]->hardwarepidcontroltype < HARDWARE_PID_CONTROL_TYPE__Dispenser1)) status += MotorPidRequestMessage(request->pidcontrols[PID_i]); - else if (request->pidcontrols[PID_i]->hardwarepidcontroltype >= HARDWARE_PID_CONTROL_TYPE__Dispenser1) + else if ((request->pidcontrols[PID_i]->hardwarepidcontroltype >= HARDWARE_PID_CONTROL_TYPE__Dispenser1)&& + (request->pidcontrols[PID_i]->hardwarepidcontroltype < HARDWARE_PID_CONTROL_TYPE__HeadHeaterZ7)) status += IDS_DispenserPidRequestMessage(request->pidcontrols[PID_i]); + else if (request->pidcontrols[PID_i]->hardwarepidcontroltype == HARDWARE_PID_CONTROL_TYPE__WasteControl) + status += WHS_PidRequestMessage(request->pidcontrols[PID_i]); + } } else diff --git a/Software/Embedded_SW/Embedded/Modules/General/process.h b/Software/Embedded_SW/Embedded/Modules/General/process.h index 6318596f1..7cd592aad 100644 --- a/Software/Embedded_SW/Embedded/Modules/General/process.h +++ b/Software/Embedded_SW/Embedded/Modules/General/process.h @@ -25,6 +25,8 @@ extern int32_t tableindex; extern double dryerbufferMeters; extern double dryerbufferCentimeters; +extern bool MachineReadyForHeating; + extern ProcessParameters ProcessParametersKeep; extern void ProcessRequestFunc(MessageContainer* requestContainer); diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c index 2ffce8e46..81f4f9e7d 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c @@ -551,7 +551,7 @@ void IDS_Dispenser_Init(uint8_t DispenserId) PrimingActive[DispenserId]= false; Valve_Set(IDS_Id_to_AirValve[DispenserId], Atm_MidTank_OFF); Control3WayValvesWithCallback ((Valves_t)DispenserId, MidTank_Dispenser, NULL); //direction: MidTank_Dispenser or Dispenser_Mixer - if (Special_Dispensers == true) + //if (Special_Dispensers == true) { if (ControlIdtoInactiveDispenserId[DispenserId] == 0xFF) ControlIdtoInactiveDispenserId[DispenserId] = AddControlCallback("IDS_Check_Pressure", IDS_Check_Pressure_Callback, eOneMinute,TemplateDataReadCBFunction ,DispenserId, 0, 0 ); diff --git a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c index 88c5d2d8c..d28ca4f21 100644 --- a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c +++ b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c @@ -243,32 +243,32 @@ void Stub_ProgressRequest(MessageContainer* requestContainer) if (WHS_Type == WHS_TYPE_NEW) { - display_byte = ((request->delay & 0x3000)>>12); + /*display_byte = ((request->delay & 0x3000)>>12); switch (display_byte) { case 0: - //stubManager.Run<ProgressResponse>("ProgressRequest" ,0x3EA, /*DisplayView =*/0x0000); // + //stubManager.Run<ProgressResponse>("ProgressRequest" ,0x3EA, 0x0000); // SetLeftDisplayView (HeadAVERAGE); SetWriteDisplayView(DrierAVERAGE); SetDisplayView (AVERAGE); break; case 1: - //stubManager.Run<ProgressResponse>("ProgressRequest" ,0x3EA, /*DisplayView =*/0x1000); // + //stubManager.Run<ProgressResponse>("ProgressRequest" ,0x3EA, 0x1000); // SetLeftDisplayView (HeadAVERAGE); SetWriteDisplayView(HeadCURRENT); break; case 2: - //stubManager.Run<ProgressResponse>("ProgressRequest" ,0x3EA, /*DisplayView =*/0x2000); // + //stubManager.Run<ProgressResponse>("ProgressRequest" ,0x3EA, 0x2000); // SetLeftDisplayView (DrierAVERAGE); SetWriteDisplayView(DrierCURRENT); break; case 3: - //stubManager.Run<ProgressResponse>("ProgressRequest" ,0x3EA, /*DisplayView =*/0x3000); // + //stubManager.Run<ProgressResponse>("ProgressRequest" ,0x3EA, 0x3000); // SetLeftDisplayView (HeadCURRENT); SetWriteDisplayView(DrierCURRENT); SetDisplayView (CURRENT); break; - } + }*/ A2D_data = (request->delay & 0x0FFF); switch(A2D_data )// get A2D @@ -306,11 +306,11 @@ void Stub_ProgressRequest(MessageContainer* requestContainer) case 12: temp_double = get_Q(DRIER_FLOW_METER); break; - case 20: - temp_double = get_average_Q(HEAD_FLOW_METER); //HEAD + /*case 20: + //temp_double = get_average_Q(HEAD_FLOW_METER); //HEAD break; case 22: - temp_double = get_average_Q(DRIER_FLOW_METER); //Drier + //temp_double = get_average_Q(DRIER_FLOW_METER); //Drier break; case 11: @@ -333,7 +333,7 @@ void Stub_ProgressRequest(MessageContainer* requestContainer) break; case 18: //tempu16 = 0; //get_cur_vlv2(&tempu16); - break; + break;*/ default : tempu16 = 0x500; //get_cur_vlv2(&tempu16); break; diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c index 50750a49e..c1d547f59 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c @@ -650,6 +650,7 @@ { REPORT_MSG(LoadStages, "Thread Load State Machine step Thread_Load_Dryer_Loading"); + int CurrentlyLoaded = 0; if (dryerbufferlength) LoadArmRounds = (int)dryerbufferlength; if (LoadArmRounds <= 2) @@ -659,7 +660,12 @@ // OriginalMotorSpd_2PPS[FEEDER_MOTOR] = 1000; // CurrentControlledSpeed[FEEDER_MOTOR] = 1000; - //MCU_E2PromProgram(EEPROM_STORAGE_DRYER_CYCLES,LoadArmRounds); + MCU_E2PromRead(EEPROM_STORAGE_DRYER_CYCLES,&CurrentlyLoaded); + Report("Thread_Load_Dryer_Loading cycles",__FILE__,LoadArmRounds,CurrentlyLoaded,RpMessage,LoadArmRounds-CurrentlyLoaded,0); + if (CurrentlyLoaded) + { + LoadArmRounds -= CurrentlyLoaded; + } ThreadMotorIdToMotorId[FEEDER_MOTOR] = HARDWARE_MOTOR_TYPE__MOTO_RDRIVING ; ThreadMotorIdToMotorId[DRYER_MOTOR] = HARDWARE_MOTOR_TYPE__MOTO_DRYER_DRIVING; @@ -809,14 +815,14 @@ 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); - MCU_E2PromProgram(EEPROM_STORAGE_DRYER_CYCLES,LoadArmRounds-numberOfCycles); + MCU_E2PromProgram(EEPROM_STORAGE_DRYER_CYCLES,0); Report("Store Number of cycles in drier",__FILE__,__LINE__,numberOfCycles,RpMessage,LoadArmRounds,0); } } 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-1)); + MCU_E2PromProgram(EEPROM_STORAGE_DRYER_CYCLES,LoadArmRounds-numberOfCycles); TimeoutsCounter = 0; CallbackCounter = 0; /*if(PullerControlId != 0xFF) @@ -922,7 +928,12 @@ if (SecondTry == true) { - LoadArmRounds = 30; + MCU_E2PromRead(EEPROM_STORAGE_DRYER_CYCLES,&LoadArmRounds); + if (LoadArmRounds == 0) //prev trial stopped + { + LoadArmRounds = (int)dryerbufferlength; + } + //LoadArmRounds = 30; } else { @@ -1051,7 +1062,7 @@ } uint32_t ThreadLoadButton(THREAD_LOAD_STAGES_ENUM ReadValue) { - if (JobIsActive()) + if (JobIsActive()||(MachineReadyForHeating == false)) { Report("ThreadLoadButton called on job",__FILE__,__LINE__,LoadStages,RpMessage,ReadValue,0); return ERROR; diff --git a/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c b/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c index 095f36d48..e9820d150 100644 --- a/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c +++ b/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c @@ -114,14 +114,14 @@ uint32_t InitSequenceCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag) InitFailures = 0; MCU_E2PromProgram(EEPROM_INIT_FAILURE_COUNTER,0); } - if (InitFailures > 3) + /*if (InitFailures > 3) { Report("HWConfigurationInit repeated failure",__FILE__,__LINE__,(int)InitFailures,RpWarning,(int)EEPROM_INIT_FAILURE_COUNTER,0); SetMachineState(MACHINE_STATE_HW_CONFIG_FAILED); AlarmHandlingSetAlarm (EVENT_TYPE__MACHINE_STATE_HW_CONFIG_FAILED,ON); SetMachineStatus(MACHINE_STATE__Error); return ERROR; - } + }*/ status = (MACHINE_STATE_STAGES_ENUM)HWConfigurationInit(); if (status == OK) { diff --git a/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c b/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c index 97247f90b..71393cf48 100644 --- a/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c +++ b/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c @@ -371,7 +371,7 @@ uint32_t ThreadJoggingFunc(int speed) { ProcessParameters ProcessParametersCopy; uint32_t status = OK; - if ((JobIsActive() == true)||(JoggingJobActive == true)) + if ((JobIsActive() == true)||(JoggingJobActive == true)||(MachineReadyForHeating == false)) { status = ERROR; Report("Jog JobIsActive", __FILE__, __LINE__, JobIsActive(), RpWarning, JoggingJobActive, 0); |
