diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2020-05-13 18:53:10 +0300 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2020-05-13 18:53:10 +0300 |
| commit | 3d0f87361da3ddb77615f2017fd500747d0e714b (patch) | |
| tree | cf1f46230de625595389700e695b1b4c318ac4f2 /Software/Embedded_SW/Embedded | |
| parent | af9158515f714a097f0c272445f218ac24785aca (diff) | |
| download | Tango-3d0f87361da3ddb77615f2017fd500747d0e714b.tar.gz Tango-3d0f87361da3ddb77615f2017fd500747d0e714b.zip | |
Version 1.4.6.26 merge part 2
Diffstat (limited to 'Software/Embedded_SW/Embedded')
3 files changed, 173 insertions, 30 deletions
diff --git a/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c b/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c index 86f8fecc1..3e84bd761 100644 --- a/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c +++ b/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c @@ -20,7 +20,7 @@ typedef struct } TangoVersion_t; -TangoVersion_t _gTangoVersion = {1,4,6,25}; +TangoVersion_t _gTangoVersion = {1,4,6,26}; #define BUILD_DATE __DATE__ char Dat[50] = BUILD_DATE; char _gTangoName [MAX_STRING_LEN] = "Tango01 ";//d 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 1876a3e0c..f110e0d7e 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 @@ -467,9 +467,9 @@ 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_mv = 0; @@ -511,11 +511,11 @@ 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_ml = V0_default_ml; - ReportWithPackageFilter(WasteFilter,"------------ using defaultVo_ml-----------------", __FILE__,__LINE__, WHS_Eeprom.bytes.Orifice_Waste_Level_V0_ml, RpMessage, 0, 0); + ReportWithPackageFilter(WasteFilter,"------------ using defaultVo_ml-----------------", __FILE__,__LINE__, WHS_Eeprom.bytes.Orifice_Waste_Level_V0, RpMessage, 0, 0); } else { - LocalV0_ml = WHS_Eeprom.bytes.Orifice_Waste_Level_V0_ml ; + LocalV0_ml = WHS_Eeprom.bytes.Orifice_Waste_Level_V0; } #warning using default values @@ -547,55 +547,138 @@ double CalculateWHSWasteTankLevelMiliLiter() { waste_volume_milliliter = Vm_ml -LocalV0_ml; } - Report("------------ waste_volume [Liter]-----------------", __FILE__, __LINE__, 0, RpMessage, (int)(waste_volume_milliliter * 1000), 0); + ReportWithPackageFilter(WasteFilter,"------------ waste_volume_ml -----------------", __FILE__, __LINE__, 0, RpMessage, (int)(waste_volume_milliliter), 0); return waste_volume_milliliter; } uint32_t WasteControlId = 0xFF; int nop = 0; - -bool waste_seq_step2(uint32_t IfIndex, uint32_t BusyFlag) +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); + if (WasteCounter>=8) + { + for (i = 0; i<8;i++) + { + avg+=WasteAverageContent[i]; + } + WasteCounter = 0; + waste_level_ml = avg/8; + + Report("------------ get waste level in ml -----------------", __FILE__, WasteAverageIndex, OpenClose, RpMessage, (int)(waste_level_ml), 0); + } + return status; +} + +bool waste_seq_step2() +{ + bool status = OK; + int i; + double local_waste_level_ml = 0,avg = 0; - waste_level_ml = CalculateWHSWasteTankLevelMiliLiter(); - //ReportWithPackageFilter(WasteFilter,"------------ get waste level in ml -----------------", __FILE__, __LINE__, 0, RpMessage, (int)(waste_level_ml*1000), 0); - if((waste_level_ml < (Initial_waste_level_ml - Cartridge_Max_level_ml)) || (Initial_waste_level_ml == 0 ) /*|| (waste_level_ml == Initial_waste_level_ml)*/ || (waste_level_ml <= V0_default_ml))//first time + if (OpenClose == CLOSE) { - //stop waste emptying - Initial_waste_level_ml = waste_level_ml; - nop++; + WasteAverageContent[WasteCounter++] = CalculateWHSWasteTankLevelMiliLiter(); + Set_WHS_valve(VOC_VALVE, CLOSE, 0); + Write_WHS_Valve_reg(); + OpenClose = OPEN; } else { - //Start/Continue Waste emptying - nop--; + 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); 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/EEPROM/WHS_EEPROM.h b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/EEPROM/WHS_EEPROM.h index 9bfd69463..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_ml; // (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]; |
