diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2020-05-13 18:47:54 +0300 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2020-05-13 18:47:54 +0300 |
| commit | 3f3783fa8a4f103126bdef5e664e5bbd226307ce (patch) | |
| tree | cce80c4c00d99c22c873b098598b426be54a19b7 /Software/Embedded_SW/Embedded | |
| parent | cd750d626d3780990797faf09446033bbaa4311c (diff) | |
| download | Tango-3f3783fa8a4f103126bdef5e664e5bbd226307ce.tar.gz Tango-3f3783fa8a4f103126bdef5e664e5bbd226307ce.zip | |
waste level measurement improved, fix heating up on gradient job (file checking took too much time)
Diffstat (limited to 'Software/Embedded_SW/Embedded')
11 files changed, 356 insertions, 47 deletions
diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/I2C_Task.c b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/I2C_Task.c index 64dfc0166..968a0e355 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/I2C_Task.c +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/I2C_Task.c @@ -63,6 +63,8 @@ typedef enum WHS_SET_VOLT_BLOWER_CONTROL, WHS_SETPOINT_Q_BLOWER, WHS_SET_VOC_VALVE, + WHS_READ_WASTE_TANK_PERIODIC, + WHS_READ_WASTE_TANK_CONT, WHS_SET_VAlVE_CARTRIDGE, WHS_SET_PUMP, WHS_READ_ADC, @@ -364,6 +366,24 @@ void Trigger_SetWHSBlowerVoltage (uint16_t voltage) // Mailbox_post(I2C_ReadingMsgQ , &I2C_ReadingMessage, BIOS_NO_WAIT); // return; //} +void Trigger_ReadWHS_Waste(uint32_t IfIndex, uint32_t BusyFlag) //0= OPEN_VOC_VALVE 1=CLOSE_VOC_VALVE +{ + I2C_ReadingMessageStruc I2C_ReadingMessage; + + I2C_ReadingMessage.messageId = WHS_READ_WASTE_TANK_PERIODIC; + if (I2C_ReadingMsgQ != NULL) + Mailbox_post(I2C_ReadingMsgQ , &I2C_ReadingMessage, BIOS_NO_WAIT); + return; +} +void Trigger_ReadWHS_WasteContinouos(uint32_t IfIndex, uint32_t BusyFlag) //0= OPEN_VOC_VALVE 1=CLOSE_VOC_VALVE +{ + I2C_ReadingMessageStruc I2C_ReadingMessage; + + I2C_ReadingMessage.messageId = WHS_READ_WASTE_TANK_CONT; + if (I2C_ReadingMsgQ != NULL) + Mailbox_post(I2C_ReadingMsgQ , &I2C_ReadingMessage, BIOS_NO_WAIT); + return; +} void Trigger_SetWHS_VOC_Valve(bool value) //0= OPEN_VOC_VALVE 1=CLOSE_VOC_VALVE @@ -617,7 +637,12 @@ void I2C_ReadingTask(UArg arg0, UArg arg1) // dbl_setpoint_Q = (double)(I2C_ReadingMessage.parameter / 100) ; // WHS_Set_Blower_Control_Closed_Loop(dbl_setpoint_Q); // break; - + case WHS_READ_WASTE_TANK_CONT: + waste_seq_cont(); + break; + case WHS_READ_WASTE_TANK_PERIODIC: + waste_seq_step2(); + break; case WHS_SET_VOC_VALVE: // Set_WHS_valve(VOC_VALVE, I2C_ReadingMessage.parameter, 0); Write_WHS_Valve_reg(); diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/I2C_Task.h b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/I2C_Task.h index 244f31799..23c2f13e0 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/I2C_Task.h +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/I2C_Task.h @@ -25,6 +25,8 @@ void Trigger_WHSReadAllFanTacho (void); void Trigger_WHS_PT100_Read_All(void); void Trigger_ReadWHSPT100(uint8_t PT100_Id); void Trigger_SetWHSBlowerVoltage (uint16_t voltage); +void Trigger_ReadWHS_Waste(uint32_t IfIndex, uint32_t BusyFlag); +void Trigger_ReadWHS_WasteContinouos(uint32_t IfIndex, uint32_t BusyFlag); void Trigger_SetWHS_VOC_Valve(bool value); //0= OPEN_VOC_VALVE 1=CLOSE_VOC_VALVE void Trigger_SetWHSValveWatseCartridge(uint8_t Cart_Id); void Trigger_SetWHSPump(bool status); diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_AD5272_Rheostat/WHS_Rheostat.c b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_AD5272_Rheostat/WHS_Rheostat.c index 0c170f163..96d7780e8 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_AD5272_Rheostat/WHS_Rheostat.c +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_AD5272_Rheostat/WHS_Rheostat.c @@ -176,7 +176,7 @@ uint8_t Search_Rheostat_Value_for_Air_clibration() delta = VOC_Calibration_value / 100; //0.025V (1% of VOC_Calibration_value) 4.096V - 4096 bit - while (left <= right) + /*while (left < right) { middle = (left + right)/2; //Set Rheostat to middle and read the gas sensor value @@ -197,7 +197,7 @@ uint8_t Search_Rheostat_Value_for_Air_clibration() { return OK; } - } + }*/ return ERROR; // unable to calibrate } diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_MAX11614_ADC/MAX11614_Driver.c b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_MAX11614_ADC/MAX11614_Driver.c index d431df749..214910efa 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_MAX11614_ADC/MAX11614_Driver.c +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_MAX11614_ADC/MAX11614_Driver.c @@ -14,6 +14,8 @@ #include <Drivers/I2C_Communication/WHS_Card/WHS_data.h> +// VREF = 4.096V 12bit so 1bit is 1mV + bool MAX11614_Read_allADC(uint8_t i2cbus, WHS_chip_address i2cadd, uint16_t *p_value) { bool status= OK; 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 80cfb8ac6..ab82501e5 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 @@ -390,29 +390,111 @@ double GetWHSAirFlow(uint8_t OR_Id) #warning need to update low and high limits and to read the eeprom on the initialization -#define DefaultCoefficient 9.72//TBD -#define Coefficient_LowLimit 0//TBD -#define Coefficient_HighLimit 255//TBD +double DefaultCoefficient = 10.5;//Coefficient is 10.5mV/mm for TI (not water). 9.72//TBD +double Coefficient_LowLimit = 0;//TBD +double Coefficient_HighLimit = 255;//TBD -#define defaultVo_ml 100//TBD -#define Vo_LowLimit_ml 1//TBD -#define Vo_HighLimit_ml 5000//TBD +double V0_default_ml = 520 * 8.7433;//0.9V --- mv * 8.7433 convert from mv to ml +double V0_LowLimit_ml = 1;//TBD +double V0_HighLimit_ml = 5000;//TBD double waste_level_ml = 0.0; double Cartridge_Max_level_ml = 1500.0; +uint32_t NoOfAvrSamplesToUse = 8; + +uint32_t Filter_Level_Measurement(uint32_t Current_Measurement, bool StartOver) +//StartOver - true to start over the filter, option to change the NoOfAvrSamplesToUse only when StartOver is true +//Each measured result must be calculated as average of minimum 8 results. +{ + #define MaxAvrSamples 16 //MAX of average samples + + uint32_t Filtered_Measurement; + + static uint32_t Sample_buf[MaxAvrSamples] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }; + + static uint8_t Sampels = 0, SampleIndex = 0; + + static uint32_t NoOfAvrSamples = MaxAvrSamples; + + uint32_t TempSum = 0; + + uint8_t i; + + if (StartOver == true) + { + SampleIndex = 0; + memset(Sample_buf, 0, MaxAvrSamples); + Sampels = 0; + + if ((NoOfAvrSamplesToUse > MaxAvrSamples) || (NoOfAvrSamplesToUse < 1)) + { + NoOfAvrSamples = MaxAvrSamples; + } + else + { + NoOfAvrSamples = NoOfAvrSamplesToUse; + } + } + + Sample_buf[SampleIndex] = Current_Measurement; + + SampleIndex = SampleIndex++; + + if (SampleIndex > (NoOfAvrSamples - 1)) + SampleIndex = 0; + + for (i = 0; i<NoOfAvrSamples; i++) + { + TempSum += Sample_buf[i]; + } + + if (Sampels < NoOfAvrSamples) + { + Sampels = Sampels++; + Filtered_Measurement = TempSum / Sampels; + } + else + { + Filtered_Measurement = TempSum / NoOfAvrSamples; + } + + return Filtered_Measurement; +} + + double GetWHSWasteTankLevelMiliLiter() { return waste_level_ml; } +int WasteAverageIndex = 0;WasteCounter = 0; +double waste_volume_milliliter = 0.0; +double WasteAverageContent[8]; double CalculateWHSWasteTankLevelMiliLiter() { - uint16_t Vm = 0; - uint16_t LocalV0 = 0; + uint16_t Vm_mv = 0; + double Vm_ml = 0.0;//mv + double LocalV0_ml = 0; double LocalCoefficient; - double waste_volume_milliliter = 0.0; + //double waste_volume_milliliter = 0.0; move to global for debugging + + double mvfor1500mL; - get_vlev1(&Vm); + + +#warning add the filter: + + /*-------------TBD + + if(0) + { + Vm_ml = Filter_Level_Measurement(Vm_ml, true);//start filtering + } + else + { + Vm_ml = Filter_Level_Measurement(Vm_ml, false); + } + */ //MCU_E2PromRead(EEPROM_WASTE_TANK_ZERO_VALUE,&V0);//read once in the initialization process @@ -428,64 +510,175 @@ double CalculateWHSWasteTankLevelMiliLiter() if(0)//-- TBD -- ((WHS_Eeprom.bytes.Orifice_Waste_Level_V0 <= Vo_LowLimit_ml) || (WHS_Eeprom.bytes.Orifice_Waste_Level_V0 >=Vo_HighLimit_ml)) { - LocalV0 = defaultVo_ml; + LocalV0_ml = V0_default_ml; ReportWithPackageFilter(WasteFilter,"------------ using defaultVo_ml-----------------", __FILE__,__LINE__, WHS_Eeprom.bytes.Orifice_Waste_Level_V0, RpMessage, 0, 0); } else { - LocalV0 = WHS_Eeprom.bytes.Orifice_Waste_Level_V0 ; + LocalV0_ml = WHS_Eeprom.bytes.Orifice_Waste_Level_V0; } - LocalCoefficient = DefaultCoefficient; - LocalV0 = defaultVo_ml; - waste_volume_milliliter = (LocalCoefficient * (Vm -LocalV0)); - ReportWithPackageFilter(WasteFilter,"------------ waste_volume_ml -----------------", __FILE__, __LINE__, 0, RpMessage, (int)(waste_volume_milliliter * 1000), 0); +#warning using default values + LocalCoefficient = DefaultCoefficient;//------------------------ + LocalV0_ml = V0_default_ml;//--------------------------------------- + + //delta mv for 1.5 litter: + // Coefficient mv/mm * 1.5litter/918cm^2 = Coefficient mv/mm * 1500cm^3/918cm^2 = + // = Coefficient mv/mm * 1.6339 cm = Coefficient mv/mm * 16.339 mm = [mv] + mvfor1500mL = LocalCoefficient * ((1500.0/918.0) * 10.0);//mv + //mvfor1500mL = 171.56862745; //10.5*(1500/918)*10 + // 1 mv => 1500/mvfor1500mL [mlitter] + // 1 mL => mvfor1500mL/ 1500 [mV] + //for Coefficient = 10.5mv/mm: + //1mv => 8.7433 ml + //1ml => 0.114373 mv + + + get_vlev1(&Vm_mv);//mV (VREF = 4.096V 12bit so 1bit is 1mV) + + Vm_ml = Vm_mv * 1500/mvfor1500mL; + + if(Vm_ml < LocalV0_ml) + { + //LocalV0_ml = Vm_ml; + waste_volume_milliliter = 0; + } + else + { + waste_volume_milliliter = Vm_ml -LocalV0_ml; + } + ReportWithPackageFilter(WasteFilter,"------------ waste_volume_ml -----------------", __FILE__, __LINE__, 0, RpMessage, (int)(waste_volume_milliliter), 0); return waste_volume_milliliter; } -#define OPEN_WASTE_VALVE 0 -#define CLOSE_WASTE_VALVE 1 - uint32_t WasteControlId = 0xFF; -bool waste_seq_step2(uint32_t IfIndex, uint32_t BusyFlag) +int nop = 0; +bool OpenClose = CLOSE; +bool waste_seq_cont() { bool status = OK; + int i; + double local_waste_level_ml = 0,avg = 0; - static double Initial_waste_level_ml = 0.0; - if (SafeRemoveControlCallback(WasteControlId, waste_seq_step2 )==OK) - WasteControlId = 0xFF; + if (OpenClose == CLOSE) + { + WasteAverageContent[WasteAverageIndex++] = CalculateWHSWasteTankLevelMiliLiter(); + if (WasteAverageIndex >= 8) + WasteAverageIndex = 0; + WasteCounter++; + Set_WHS_valve(VOC_VALVE, CLOSE, 0); + Write_WHS_Valve_reg(); + OpenClose = OPEN; + } else - Report("Remove control callback failed",__FILE__,__LINE__,(int)WasteControlId,RpWarning,(int)waste_seq_step2,0); + { + Set_WHS_valve(VOC_VALVE, OPEN, 0); + Write_WHS_Valve_reg(); + OpenClose = CLOSE; + } + //Report("------------ get waste level in ml -----------------", __FILE__, WasteAverageIndex, OpenClose, RpMessage, (int)(WasteAverageContent[WasteCounter-1]*1000), 0); - ReportWithPackageFilter(WasteFilter,"------------ close waste level Air valve -----------------", __FILE__, __LINE__, 0, RpMessage, 0, 0); - Trigger_SetWHS_VOC_Valve(CLOSE_WASTE_VALVE); + if (WasteCounter>=8) + { + for (i = 0; i<8;i++) + { + avg+=WasteAverageContent[i]; + } + WasteCounter = 0; + waste_level_ml = avg/8; - waste_level_ml = CalculateWHSWasteTankLevelMiliLiter(); - //ReportWithPackageFilter(WasteFilter,"------------ get waste level in ml -----------------", __FILE__, __LINE__, 0, RpMessage, (int)(waste_level_ml*1000), 0); + Report("------------ get waste level in ml -----------------", __FILE__, WasteAverageIndex, OpenClose, RpMessage, (int)(waste_level_ml), 0); + } + return status; +} - if(waste_level_ml < (Initial_waste_level_ml - Cartridge_Max_level_ml)) +bool waste_seq_step2() +{ + bool status = OK; + int i; + double local_waste_level_ml = 0,avg = 0; + + + if (OpenClose == CLOSE) { - //stop waste empting + WasteAverageContent[WasteCounter++] = CalculateWHSWasteTankLevelMiliLiter(); + Set_WHS_valve(VOC_VALVE, CLOSE, 0); + Write_WHS_Valve_reg(); + OpenClose = OPEN; } else { - Initial_waste_level_ml = waste_level_ml; + Set_WHS_valve(VOC_VALVE, OPEN, 0); + Write_WHS_Valve_reg(); + OpenClose = CLOSE; } + //Report("------------ get waste level in ml -----------------", __FILE__, WasteCounter, OpenClose, RpMessage, (int)(WasteAverageContent[WasteCounter-1]*1000), 0); + if (WasteCounter>=8) + { + if (RemoveControlCallback(WasteControlId, Trigger_ReadWHS_Waste )==OK) + WasteControlId = 0xFF; + else + Report("Remove control callback failed",__FILE__,__LINE__,(int)WasteControlId,RpWarning,(int)waste_seq_step2,0); + for (i = 0; i<8;i++) + { + avg+=WasteAverageContent[i]; + } + WasteAverageIndex = 0; + WasteCounter = 0; + waste_level_ml = avg/8; + + Report("------------ get waste level in ml -----------------", __FILE__, WasteCounter, OpenClose, RpMessage, (int)(waste_level_ml), 0); + } return status; } +bool ContinouosWaste = false; +bool waste_seq_step1_cont() +{ + bool status = OK; + WasteAverageIndex = 0; + WasteCounter = 0; + OpenClose = CLOSE; + + ContinouosWaste = true; + + Trigger_SetWHS_VOC_Valve(OPEN); + + WasteControlId = AddControlCallback(NULL, Trigger_ReadWHS_WasteContinouos, eOneSecond, TemplateDataReadCBFunction,0,0, 0 ); + Report("------------ waste_seq_step1_cont -----------------", __FILE__, __LINE__, WasteControlId, RpMessage, 0, 0); + return status; +} +bool waste_seq_cont_stop(void) +{ + ContinouosWaste = false; + + Report("------------ stop waste_seq_step1_cont -----------------", __FILE__, __LINE__, WasteControlId, RpMessage, 0, 0); + Trigger_SetWHS_VOC_Valve(CLOSE); + + RemoveControlCallback(WasteControlId, Trigger_ReadWHS_WasteContinouos ); + WasteControlId = 0xFF; + +} bool waste_seq_step1() { bool status = OK; + if (ContinouosWaste == true) + { + Report("------- periodic waste called while emptying ------------", __FILE__, __LINE__, 0, RpMessage, 0, 0); + return OK; + } + WasteAverageIndex = 0; + WasteCounter = 0; + OpenClose = CLOSE; ReportWithPackageFilter(WasteFilter,"------------ open waste level Air valve -----------------", __FILE__, __LINE__, 0, RpMessage, 0, 0); - Trigger_SetWHS_VOC_Valve(OPEN_WASTE_VALVE); + Trigger_SetWHS_VOC_Valve(OPEN); ReportWithPackageFilter(WasteFilter,"------------ wait 1 second -----------------", __FILE__, __LINE__, 0, RpMessage, 0, 0); - WasteControlId = AddControlCallback(NULL, waste_seq_step2, eOneSecond, TemplateDataReadCBFunction,0,0, 0 ); + WasteControlId = AddControlCallback(NULL, Trigger_ReadWHS_Waste, eOneSecond, TemplateDataReadCBFunction,0,0, 0 ); return status; } 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 dae0754cc..67712fd9a 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 @@ -63,6 +63,9 @@ bool get_cur_vlv1(uint16_t *value); bool waste_seq_step1(); bool waste_seq_step2(); +bool waste_seq_cont(); +bool waste_seq_step1_cont(); +bool waste_seq_cont_stop(void); double GetWHSAirFlow(uint8_t OR_Id); diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/EEPROM/WHS_EEPROM.h b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/EEPROM/WHS_EEPROM.h index 55f4c5576..9343057d5 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/EEPROM/WHS_EEPROM.h +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/EEPROM/WHS_EEPROM.h @@ -10,26 +10,86 @@ typedef struct { - uint8_t PCB_SN[20]; - uint8_t Module_SN[20]; - double Orifice_Pressure_V0[3]; // (measured orifice sensor voltage without flow) value for each orifice sensor - double Orifice_Waste_Level_V0; // (measured orifice sensor voltage without flow) value for each orifice sensor - double flow_calc_coefficient_C; // C (flow calculation coefficient) value (=0.239) uint32_t Header; uint32_t Table_Length; uint32_t Table_version; + uint8_t WHS_SN[20];//String + uint8_t PCB_SN[20];//String uint8_t WHS_Part_Number[20];//String - // uint8_t PCB_SN[20];//String uint8_t PCB_Part_Number[20];//String - uint8_t WHS_SN[20];//String + uint32_t RunningHours; + uint32_t SW_Reserve; + uint8_t Production_Test_Date[8];//string + uint8_t TestPassFail;//string + uint32_t ATS_Location; + double Orifice_Waste_Level_V0; // (measured orifice sensor voltage without flow) value for each orifice sensor + double flow_calc_coefficient_C; // C (flow calculation coefficient) value (=0.239) double Orifice1Flow; double Orifice1Slope; + double Orifice1MaxPressure; + double Orifice1CalibrationFactor; double Orifice2Flow; double Orifice2Slope; + double Orifice2MaxPressure; + double Orifice2CalibrationFactor; double Orifice3Flow; double Orifice3Slope; + double Orifice3MaxPressure; + double Orifice3CalibrationFactor; double OrificeValveFlow; double OrificeValveSlope; + double OrificeValveMaxPressure; + double OrificeValveCalibrationFactor; + double Fans_1_4_PWM_min_Pct; + double Fans_1_4_RPM_PWM_min; + double Fans_1_4_PWM_max_Pct; + double Fans_1_4_RPM_PWM_max; + double Fans_1_4_Nom_PWM_Pct; + double Fans_1_4_Nom_RPM; + double Fans_1_4_RPM_Limit_Pct_below_Nom; + double Fans_1_4_Pulse_Per_Revolution; + double Fans_1_4_Spare1; + double Fans_1_4_Spare2; + double Fans_5_6_Nom_RPM; + double Fans_5_6_RPM_Limit_Pct_below_Nom; + double Fans_5_6_Pulse_Per_Revolution; + double Fans_5_6_Spare1; + double Fans_5_6_Spare2; + double Blower_P_Gain; + double Blower_CFMRPM_min; + double Blower_RPM_CFM_max; + double Blower_Calibration_factor; + double Blower_Spare1; + double Blower_Spare2; + double VOC_limit; + double VOC_Spare1; + double VOC_Spare2; + double Controller_Comm_Type; + double Controller_Type; + double Sensor_type; + double Cooler_C_F; + double Cooler_SV; + double Cooler_P; + double Cooler_I; + double Cooler_D; + double Warning_configuration_Par1; + double Warning_configuration_Par2; + double Warning_configuration_Par3; + double Warning_configuration_Par4; + double Warning_configuration_Par5; + double Warning_configuration_Par6; + double Warning_threshold; + double Controller_Spare1; + double Controller_Spare2; + double Controller_Spare3; + double Controller_Spare4; + double Controller_Spare5; + double Test_Date; + uint8_t Test[9]; + double Waste_Pump_Flow_volume_per_sec; + double Waste_Pump_Flow_V_per_sec_Limit; + double Filter_max_life_span; + double Filter_usage_hours; uint8_t VOCInstallationDate[8]; uint8_t FilterInstallationDate[8]; uint8_t ProductionDate[8]; diff --git a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c index a8e0c3138..01d372aae 100644 --- a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c +++ b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c @@ -814,16 +814,25 @@ JobEndReasonEnum AlarmHandlingPrepareJob(void *CurrentJob) int pri = Task_getPri(TaskHandle1); ACTIVITY_GREEN_LED_ON; - Task_setPri(TaskHandle1, 3); + Task_setPri(TaskHandle1, 2); + Task_sleep(10); Report("Task_setPri", __FILE__, pri, 3, RpWarning, (int)TaskHandle1, 0); IDS_MapDispenserUsedinJob(CurrentJob); Task_setPri(TaskHandle1, pri); Report("Task_setPri", __FILE__, __LINE__, pri, RpWarning, (int)Task_self(), 0); + Task_sleep(10); ACTIVITY_GREEN_LED_OFF; if (n_segments == 0) + { + ReportWithPackageFilter(AlarmFilter,"no segments in the job", __FILE__,__LINE__,0, DEBUG_LOG_CATEGORY__Warning, AlarmItem[Alarm_i].DeviceId, 0); return JOB_OK; + } if (AlarmItem == NULL) + { + ReportWithPackageFilter(AlarmFilter,"missing alarm file", __FILE__,__LINE__,0, DEBUG_LOG_CATEGORY__Warning, AlarmItem[Alarm_i].DeviceId, 0); + usnprintf(AlarmReasonStr, 100, "No alarm file in the machine",111); return JOB_UNSPECIFIED_ERROR; + } /*for (Segment_i=0;Segment_i<JobTicket->n_segments;Segment_i++) { diff --git a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c index e0d1e38de..fab0831fe 100644 --- a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c +++ b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c @@ -737,7 +737,7 @@ uint32_t MillisecLowLoop(uint32_t tick) WHS_Blower_Avarege(DRIER_FLOW_METER); WHS_Start_Blower_Control_Closed_Loop (); - static uint8_t Whs_emptying_cycle = 0; + /* static uint8_t Whs_emptying_cycle = 0; // #warning TBD need to define the timing if(Whs_emptying_cycle >= 2) @@ -749,7 +749,7 @@ uint32_t MillisecLowLoop(uint32_t tick) { Whs_emptying_cycle++; } - + */ } } if (Tensecond_Tick) @@ -774,7 +774,8 @@ uint32_t MillisecLowLoop(uint32_t tick) /*if (WHS_Type == WHS_TYPE_UNKNOWN) Gas_PPM_Info = Calculate_Gas_Power_Consumption();*/ if (WHS_Type == WHS_TYPE_NEW) - ReportWithPackageFilter(ThreadFilter,"waste tank calculate level",__FILE__,__LINE__,(int)(GetWHSWasteTankLevelMiliLiter()*1000),RpWarning,(int) msec_millisecondCounter,0); + waste_seq_step1();// include 1Sec delay +// ReportWithPackageFilter(ThreadFilter,"waste tank calculate level",__FILE__,__LINE__,(int)(GetWHSWasteTankLevelMiliLiter()*1000),RpWarning,(int) msec_millisecondCounter,0); //Trigger_WHS_MAX11614_Read_allADC(); #ifdef CONTROL_DEBUG ResetControlTime(); diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c index ae6751693..32895f307 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c @@ -282,6 +282,12 @@ JobDescriptionFileBrushStop *FirstBrushStop = NULL; SendJobProgress(0.0,0,false, "Processing file"); Control_WD(ENABLE,55); //activate heaters/dispenser watchdog, 0.5 seconds } + if ((brushCounter % 1000)==0) + { + Task_sleep(200); + Report("Sleep in file parsing",__FILE__, BrushStop->index, brushCounter, RpWarning, Segment->brushstopscount, 0); + Control_WD(ENABLE,55); //activate heaters/dispenser watchdog, 0.5 seconds + } brushCounter++; if (BrushStop->n_dispensers) { diff --git a/Software/Embedded_SW/Embedded/Modules/Waste/Waste_init.c b/Software/Embedded_SW/Embedded/Modules/Waste/Waste_init.c index 87b8100cd..922da21b1 100644 --- a/Software/Embedded_SW/Embedded/Modules/Waste/Waste_init.c +++ b/Software/Embedded_SW/Embedded/Modules/Waste/Waste_init.c @@ -18,6 +18,7 @@ #include "Modules/General/buttons.h" #include "Modules/IFS/ifs.h" #include <Drivers/I2C_Communication/I2C_Task.h> +#include <Drivers/I2C_Communication/WHS_Card/D_MAX11614_ADC/WHS_MAX11614_A2D.h> // //#define CARTRIDGE_INK_TIMEOUT 60 //#define CARTRIDGE_INK_TIMEOUTx2 120 @@ -68,6 +69,7 @@ bool RdWasteTankEmptySensor(); bool RdCartridgeParam(cartridge_name cart_name); bool CartridgeAuthentication(cartridge_name cart_name); bool SetActiveWastCartridge(); +void SetWasteLevelEmptyingLimit(double value); @@ -407,7 +409,10 @@ U8 CartridgeWasteFilling(bool status) //WHS_info.WHS_pump.time = 0; AlarmHandlingSetAlarm( EVENT_TYPE__NO_WASTE_CARTRIDGE_AVAILABLE, false); if (WHS_Type == WHS_TYPE_NEW) + { SetWasteLevelEmptyingLimit(GetWHSWasteTankLevelMiliLiter()); + waste_seq_step1_cont(); + } ret=OK; } else // stop Waste cartridge filling @@ -417,7 +422,10 @@ U8 CartridgeWasteFilling(bool status) if (WHS_Type == WHS_TYPE_UNKNOWN) Valve_Set(VALVE_WASTE_TANK, WHS_info.WHS_valve); else //new WHS + { Trigger_SetWHSValveWatseCartridge(WHS_info.WHS_valve); + waste_seq_cont_stop(); + } AlarmHandlingSetAlarm( EVENT_TYPE__ALL_WASTE_CARTRIDGES_FULL, true); |
