From cae0bfc060f16dd75661ebba88d3c905dd2ac875 Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Wed, 7 Oct 2020 13:14:49 +0300 Subject: Head EEPROM stubs, pressurer sensor 2 read (WHS), --- Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c | 1 + 1 file changed, 1 insertion(+) (limited to 'Software/Embedded_SW/Embedded/Modules/Control') diff --git a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c index 5f1c0ffaf..dd885b6af 100644 --- a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c +++ b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c @@ -777,6 +777,7 @@ uint32_t MillisecLowLoop(uint32_t tick) { //Trigger_WHS_PT100_Read_All(); WHS_Blower_Avarege(HEAD_FLOW_METER); + WHS_Blower_Avarege(NU_FLOW_METER); WHS_Blower_Avarege(DRIER_FLOW_METER); WHS_Start_Blower_Control_Closed_Loop (); -- cgit v1.3.1 From 84103e5dd222064c4a81c62515186766e134f057 Mon Sep 17 00:00:00 2001 From: Avi Levkovich Date: Wed, 7 Oct 2020 14:22:07 +0300 Subject: Add VOC Alarm --- Software/Embedded_SW/Embedded/DataDef.h | 2 ++ .../WHS_Card/D_AD5272_Rheostat/WHS_Rheostat.c | 2 ++ .../WHS_Card/D_AD5272_Rheostat/WHS_Rheostat.h | 2 ++ .../Embedded/Modules/AlarmHandling/AlarmHandling.c | 2 +- .../Embedded/Modules/Control/MillisecTask.c | 7 +++- .../Embedded/Modules/Diagnostics/Diagnostics.c | 8 +++++ .../Embedded_SW/Embedded/Modules/Waste/Waste_ex.h | 3 ++ .../Embedded/Modules/Waste/Waste_maint.c | 42 ++++++++++++++++++++++ 8 files changed, 66 insertions(+), 2 deletions(-) (limited to 'Software/Embedded_SW/Embedded/Modules/Control') diff --git a/Software/Embedded_SW/Embedded/DataDef.h b/Software/Embedded_SW/Embedded/DataDef.h index aec6f830e..66f2a20f1 100644 --- a/Software/Embedded_SW/Embedded/DataDef.h +++ b/Software/Embedded_SW/Embedded/DataDef.h @@ -39,6 +39,8 @@ extern bool Special_Dispensers; #define USE_OLD_HEAD_EEPROM +//#define USE_VOC_BUZZER_ALARM + #define I2C_2_Data_Transfer_Rate_400kbps #define I2C_3_Data_Transfer_Rate_400kbps// Head card + WHS card #define I2C_4_Data_Transfer_Rate_400kbps// RFID + Dispensers 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 e96c2367e..8ece96f99 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 @@ -242,6 +242,8 @@ uint32_t Read_Gas_Sensor() //cyclic Latest_Gas_Sens_PPM = VOC2PPM(latest_Gas_Sensor_value); + WHS_IsVocPpmOverAlarmLimit(); + return OK; } diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_AD5272_Rheostat/WHS_Rheostat.h b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_AD5272_Rheostat/WHS_Rheostat.h index d6b1e3fd5..735df036d 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_AD5272_Rheostat/WHS_Rheostat.h +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_AD5272_Rheostat/WHS_Rheostat.h @@ -20,4 +20,6 @@ double Get_latest_Gas_Sensor_PPM(); void Voc_Sensor_Zero_Calibration(); +extern double Latest_Gas_Sens_PPM; + #endif diff --git a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c index b5c24835a..ca6c4d51f 100644 --- a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c +++ b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c @@ -983,7 +983,7 @@ JobEndReasonEnum AlarmHandlingPrepareJob(void *CurrentJob) { case EVENT_TYPE__INSUFFICIENT_AIR_FLOW: case EVENT_TYPE__VOC_SENSOR_ALARM_TIME: - case EVENT_TYPE__VOC_SENSOR_ALARM_SLOPE: +#warning unmark to prevent job on voc alarm//case EVENT_TYPE__VOC_SENSOR_ALARM_SLOPE: //case EVENT_TYPE__POWER_UP_BIT_FAILURE: FoundReason = JOB_WASTE_HANDLING_PROBLEM; AlarmId = Alarm_i; diff --git a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c index 5f1c0ffaf..70a7e39b0 100644 --- a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c +++ b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c @@ -780,6 +780,11 @@ uint32_t MillisecLowLoop(uint32_t tick) WHS_Blower_Avarege(DRIER_FLOW_METER); WHS_Start_Blower_Control_Closed_Loop (); + if (ReadingVocEverySec == true)//eOneSecond + { + Trigger_WHS_MAX11614_Read_Gas_Sensor(); + } + /* static uint8_t Whs_emptying_cycle = 0; // #warning TBD need to define the timing @@ -827,7 +832,7 @@ uint32_t MillisecLowLoop(uint32_t tick) Gas_PPM_Info = Calculate_Gas_Power_Consumption();*/ // ReportWithPackageFilter(ThreadFilter,"waste tank calculate level",__FILE__,__LINE__,(int)(GetWHSWasteTankLevelMiliLiter()*1000),RpWarning,(int) msec_millisecondCounter,0); //Trigger_WHS_MAX11614_Read_allADC(); - if (WHS_Type == WHS_TYPE_NEW) + if ((WHS_Type == WHS_TYPE_NEW) && (ReadingVocEverySec == false))//OneMinute_Tick { Trigger_WHS_MAX11614_Read_Gas_Sensor(); } diff --git a/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c b/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c index 537f942b6..b069397d4 100644 --- a/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c +++ b/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c @@ -330,6 +330,14 @@ uint32_t DiagnosticsLoadDigitalValues(void) DigitalOutputState[index++].value = HeadCard_Actuators_Status(ACTOT); }*/ + #ifdef USE_VOC_BUZZER_ALARM + if (WHS_Type == WHS_TYPE_NEW) + { + DigitalOutputState[index].interfaceio = INTERFACE_IOS__GPO_BUZZER; + DigitalOutputState[index++].value = ReadingVocEverySec; // if true WHS_IsVocPpmOverAlarmLimit is true + } + #endif + DigitalOutputState[index].interfaceio = INTERFACE_IOS__GPI_WCONTAINER_FULL; DigitalOutputState[index++].value = WHS_IsContainerFull(); diff --git a/Software/Embedded_SW/Embedded/Modules/Waste/Waste_ex.h b/Software/Embedded_SW/Embedded/Modules/Waste/Waste_ex.h index ee9f668db..996191b63 100644 --- a/Software/Embedded_SW/Embedded/Modules/Waste/Waste_ex.h +++ b/Software/Embedded_SW/Embedded/Modules/Waste/Waste_ex.h @@ -45,6 +45,9 @@ bool WHS_WasteCartridgeLowerPresent(); bool WHS_WasteCartridgeMiddlePresent(); bool WHS_IsEmptying(); uint32_t Waste_Prepare(void); +bool WHS_IsVocPpmOverAlarmLimit(); + +extern bool ReadingVocEverySec; #endif diff --git a/Software/Embedded_SW/Embedded/Modules/Waste/Waste_maint.c b/Software/Embedded_SW/Embedded/Modules/Waste/Waste_maint.c index 2e3e665d6..28a5720ab 100644 --- a/Software/Embedded_SW/Embedded/Modules/Waste/Waste_maint.c +++ b/Software/Embedded_SW/Embedded/Modules/Waste/Waste_maint.c @@ -23,6 +23,11 @@ #include #include #include +#include + +uint8_t VocPpmAlarmLimit = 10;//PPM +uint8_t VocPpmLimitForXSec = 10;//Sec +bool ReadingVocEverySec = false; bool DoorState = OPEN; uint32_t timeout_counter = 0; @@ -523,3 +528,40 @@ uint32_t Waste_Prepare(void) return JOB_WASTE_HANDLING_PROBLEM; } } + +bool WHS_IsVocPpmOverAlarmLimit() +{ + static uint8_t counter = 0; + uint8_t VocPpmAlarmLimit90Percent = 0; + uint32_t Temp = 0; + + Temp = (uint32_t)VocPpmAlarmLimit * 90; + Temp /= 100; + VocPpmAlarmLimit90Percent = (uint8_t)Temp; + + if( ( Latest_Gas_Sens_PPM > VocPpmAlarmLimit ) || //PPM + ( (Latest_Gas_Sens_PPM > VocPpmAlarmLimit90Percent) && (ReadingVocEverySec == true) ) ) //Hysteresis + { + //reading every sec + ReadingVocEverySec = true; + if(counter < 0xFF) + { + counter++; + } + + if(counter > VocPpmLimitForXSec)//Sec + { + AlarmHandlingSetAlarm(EVENT_TYPE__VOC_SENSOR_ALARM_SLOPE,true); + return true;//Buzzer ON if defined + } + } + else + { + AlarmHandlingSetAlarm(EVENT_TYPE__VOC_SENSOR_ALARM_SLOPE,false); + //move back to noraml reading every Min. + ReadingVocEverySec = false;//Turn off the buzzer on the first time sampling a measurment lower than (VocPpmAlarmLimit - 10%) + counter = 0; + } + + return false; +} -- cgit v1.3.1