From d942ac7b9d38d7a9afbe0c684ace022f07730f66 Mon Sep 17 00:00:00 2001 From: Shai Frieder Date: Tue, 4 Feb 2020 14:06:38 +0200 Subject: fix the prit log fix ADS122X04_Driver to calc temp --- .../WHS_Card/D_ADS122_PT100/ADS122X04_Driver.c | 3 +-- .../WHS_Card/D_ADS122_PT100/WHS_PT100_ADC.c | 15 +++++++++++---- .../WHS_Card/D_MAX11614_ADC/WHS_MAX11614_A2D.c | 6 +++--- .../WHS_Card/D_Max5805_ADC_Blower/WHS_Blower.c | 7 ++++--- .../WHS_Card/D_TCA9546_ADC_MUX/TCA9546_Driver.c | 2 +- .../WHS_Card/IO_Extender_Ports_TCA9555/WHS_IO.c | 14 +++++++------- 6 files changed, 27 insertions(+), 20 deletions(-) (limited to 'Software/Embedded_SW/Embedded/Drivers') diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_ADS122_PT100/ADS122X04_Driver.c b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_ADS122_PT100/ADS122X04_Driver.c index 4df4dc6c3..e8f4bc996 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_ADS122_PT100/ADS122X04_Driver.c +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_ADS122_PT100/ADS122X04_Driver.c @@ -69,8 +69,7 @@ bool D_ADS122_ReadDataCommand(uint8_t i2cbus, uint8_t i2cadd, uint32_t* p_Data_A Status |= I2C_Read(i2cbus, i2cadd, &temp, 3); Data_ADS122X = (temp & 0xFF0000) >> 16 | (temp & 0xFF00) | (temp & 0x0000FF) << 16;//First send the MSB so we need to reorder the bytes - *p_Data_ADS122X = CalculateTemperatures(Data_ADS122X); -#warning what to do with the data ??????? + *p_Data_ADS122X = Data_ADS122X;//todo return Status; } diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_ADS122_PT100/WHS_PT100_ADC.c b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_ADS122_PT100/WHS_PT100_ADC.c index 82b6d22ed..d34787671 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_ADS122_PT100/WHS_PT100_ADC.c +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_ADS122_PT100/WHS_PT100_ADC.c @@ -237,6 +237,7 @@ bool WHS_PT100_Get(TEMPERATURE_SENSOR_ID_ENUM SensorId, uint8_t *value ) bool WHS_PT100_Read(TEMPERATURE_SENSOR_ID_ENUM SensorId) { bool Status = OK; + uint32_t Temperatures = 0; WHS_PT100_config( SensorId); WHS_PT100_ControlMux_Before_Reading( SensorId); @@ -246,31 +247,37 @@ bool WHS_PT100_Read(TEMPERATURE_SENSOR_ID_ENUM SensorId) Status |= D_ADS122_StartSync(PT100_Conf[0].i2s_bus, PT100_Conf[0].i2s_address); delayms(20); Status |= D_ADS122_ReadDataCommand(PT100_Conf[0].i2s_bus, PT100_Conf[0].i2s_address, &(PT100_Conf[0].value[0])); - ReportWithPackageFilter(WasteFilter,"------------read PT100 0 0 [J11] (value) -----------------", __FILE__,__LINE__, PT100_Conf[0].value[0], RpMessage, 0, 0); + Temperatures = CalculateTemperatures(SensorId, PT100_Conf[0].value[0]); + ReportWithPackageFilter(WasteFilter,"------------read PT100 0 0 [J11] (value) -----------------", __FILE__,__LINE__, PT100_Conf[0].value[0], RpMessage, Temperatures, 0); break; case WHS_PT100_2_0X80_1: Status |= D_ADS122_StartSync(PT100_Conf[0].i2s_bus, PT100_Conf[0].i2s_address); delayms(20); Status |= D_ADS122_ReadDataCommand(PT100_Conf[0].i2s_bus, PT100_Conf[0].i2s_address, &(PT100_Conf[0].value[1])); - ReportWithPackageFilter(WasteFilter,"------------read PT100 0 0 [J20] (value) -----------------", __FILE__,__LINE__, PT100_Conf[0].value[1], RpMessage, 0, 0); + Temperatures = CalculateTemperatures(SensorId, PT100_Conf[0].value[1]); + ReportWithPackageFilter(WasteFilter,"------------read PT100 0 0 [J20] (value) -----------------", __FILE__,__LINE__, PT100_Conf[0].value[1], RpMessage, Temperatures, 0); break; case WHS_PT100_3_0X82_0: Status |= D_ADS122_StartSync(PT100_Conf[1].i2s_bus, PT100_Conf[1].i2s_address); delayms(20); Status |= D_ADS122_ReadDataCommand(PT100_Conf[1].i2s_bus, PT100_Conf[1].i2s_address, &(PT100_Conf[1].value[0])); - ReportWithPackageFilter(WasteFilter,"------------read PT100 0 0 [J12] (value) -----------------", __FILE__,__LINE__, PT100_Conf[1].value[0], RpMessage, 0, 0); + Temperatures = CalculateTemperatures(SensorId, PT100_Conf[1].value[0]); + ReportWithPackageFilter(WasteFilter,"------------read PT100 0 0 [J12] (value) -----------------", __FILE__,__LINE__, PT100_Conf[1].value[0], RpMessage, Temperatures, 0); break; case WHS_PT100_4_0X82_1: Status |= D_ADS122_StartSync(PT100_Conf[1].i2s_bus, PT100_Conf[1].i2s_address); delayms(20); Status |= D_ADS122_ReadDataCommand(PT100_Conf[1].i2s_bus, PT100_Conf[1].i2s_address, &(PT100_Conf[1].value[1])); - ReportWithPackageFilter(WasteFilter,"------------read PT100 0 0 [J21] (value) -----------------", __FILE__,__LINE__, PT100_Conf[1].value[1], RpMessage, 0, 0); + Temperatures = CalculateTemperatures(SensorId, PT100_Conf[1].value[1]); + ReportWithPackageFilter(WasteFilter,"------------read PT100 0 0 [J21] (value) -----------------", __FILE__,__LINE__, PT100_Conf[1].value[1], RpMessage, Temperatures, 0); break; default: Status = ERROR; break; } + #warning what to do with the data ??????? + return Status; } 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 56e54d567..f5c0b0ea9 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 @@ -189,7 +189,7 @@ double get_Q(int16_t num) Sqrt = sqrt((double)tmp); calc = Aorf_ofset + Corf_flow*Sqrt; - ReportWithPackageFilter(WasteFilter,"------------ calc Q value (calc)-----------------", __FILE__,__LINE__, calc, RpMessage, 0, 0); + ReportWithPackageFilter(WasteFilter,"------------ calc Q value (calc)-----------------", __FILE__,__LINE__, calc, RpMessage, num, 0); return calc; } @@ -266,7 +266,7 @@ bool get_orf_1(uint16_t *value) // U34 connected to AIN2 uint16_t Orf_zero_value[HEAD_FLOW_METER+1] = {1112,0,1040}; - +#warning get Orf_zero_value for all orf double GetWHSAirFlow(uint8_t OR_Id) { @@ -286,7 +286,7 @@ double GetWHSAirFlow(uint8_t OR_Id) break; } - ReportWithPackageFilter(WasteFilter,"GetWHSAirFlow",__FILE__,OR_Id,(int)value,RpWarning,(int) Orf_zero_value[OR_Id],0); + ReportWithPackageFilter(WasteFilter,"------------ GetWHSAirFlow -----------------",__FILE__, OR_Id, (int)value, RpWarning, (int) Orf_zero_value[OR_Id], 0); return get_Q((int16_t)value-Orf_zero_value[OR_Id]); } 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 abce25764..bcada0e0d 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 @@ -58,12 +58,12 @@ bool Read_Max5805_device_ID() status = MAX5805_DEVICEID(); if ((Read_Buf[0] == 0x50) && (Read_Buf[1] == 0x82)) { - ReportWithPackageFilter(GeneralFilter,"------------ max5805 ID OK -----------------", __FILE__,__LINE__,(Read_Buf[0]), RpMessage,(Read_Buf[1]), 0); + ReportWithPackageFilter(GeneralFilter,"------------ max5805 ID OK -----------------", __FILE__, __LINE__, (Read_Buf[0]), RpMessage, (Read_Buf[1]), 0); status |= OK; } else { - ReportWithPackageFilter(GeneralFilter,"------------ max5805 ID NOT OK !!!! -----------------", __FILE__,__LINE__,(Read_Buf[0]), RpMessage,(Read_Buf[1]), 0); + ReportWithPackageFilter(GeneralFilter,"------------ max5805 ID NOT OK !!!! -----------------", __FILE__, __LINE__, (Read_Buf[0]), RpMessage, (Read_Buf[1]), 0); status |= ERROR; } return status; @@ -163,7 +163,8 @@ bool WHS_init_Blower() } status |= Write_MAX5805_REF( ); - ReportWithPackageFilter(WasteFilter,"------------ WHS_init_Blower (status)-----------------", __FILE__,__LINE__, status, RpMessage, 0, 0); + status |= WHS_Set_Volt_Blower_Control(0); // init with 0 volt + ReportWithPackageFilter(WasteFilter,"------------ WHS_init_Blower (status) 0V-----------------", __FILE__,__LINE__, status, RpMessage, 0, 0); return status; } diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_TCA9546_ADC_MUX/TCA9546_Driver.c b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_TCA9546_ADC_MUX/TCA9546_Driver.c index 28c3ded82..a472fb9eb 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_TCA9546_ADC_MUX/TCA9546_Driver.c +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_TCA9546_ADC_MUX/TCA9546_Driver.c @@ -37,7 +37,7 @@ bool D_TCA9546_Select_Channel(uint8_t TCA9546A_I2C_bus_number, uint8_t TCA9546A_ } Write_Buf[0]=chnl_number; status |= I2C_Write(TCA9546A_I2C_bus_number, TCA9546A_I2C_addr, Write_Buf, 1); - ReportWithPackageFilter(WasteFilter,"------------ Select I2C Channel (chnl_number)-----------------", __FILE__,__LINE__, chnl_number, status, 0, 0); + ReportWithPackageFilter(WasteFilter,"------------ Select I2C Channel (chnl_number)-----------------", __FILE__,__LINE__, chnl_number, RpMessage, status, 0); return status; } diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/IO_Extender_Ports_TCA9555/WHS_IO.c b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/IO_Extender_Ports_TCA9555/WHS_IO.c index 4deba2060..638582e7f 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/IO_Extender_Ports_TCA9555/WHS_IO.c +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/IO_Extender_Ports_TCA9555/WHS_IO.c @@ -126,7 +126,7 @@ bool WHS_IO_Init() { bool status = OK; - ReportWithPackageFilter(WasteFilter,"------------ WHS_IO_Init IO_Extender U3 and U4 -----------------", __FILE__,__LINE__,0, 0, 0, 0); + ReportWithPackageFilter(WasteFilter,"------------ WHS_IO_Init IO_Extender U3 and U4 -----------------", __FILE__,__LINE__,0, RpMessage, 0, 0); Whs_I2C_EXP_U3_0x40_VALUE.bits.VALUE_ACTLOW_PT_RSTn = 1; //P00 Whs_I2C_EXP_U3_0x40_VALUE.bits.VALUE_PT_SEL = 1; //P01 Whs_I2C_EXP_U3_0x40_VALUE.bits.VALUE_ACTLOW_AUXn = 1; //P02 @@ -223,11 +223,11 @@ bool Set_WHS_valve(uint8_t valve_number, bool state, bool direction) { if (state == VALVE_DISABLE ) { - ReportWithPackageFilter(WasteFilter,"------------ set valve 0 Disable-----------------", __FILE__,__LINE__, state, direction, 0, 0); + ReportWithPackageFilter(WasteFilter,"------------ set valve 0 Disable-----------------", __FILE__,__LINE__, state, RpMessage, direction, 0); } else { - ReportWithPackageFilter(WasteFilter,"------------ set valve 0 Enable-----------------", __FILE__,__LINE__, state, direction, 0, 0); + ReportWithPackageFilter(WasteFilter,"------------ set valve 0 Enable-----------------", __FILE__,__LINE__, state, RpMessage, direction, 0); } Whs_I2C_EXP_U4_0x42_VALUE.bits.VALUE_VALV1_DIR = direction; //P04 Whs_I2C_EXP_U4_0x42_VALUE.bits.VALUE_VALV1_EN = state; //P05 @@ -236,11 +236,11 @@ bool Set_WHS_valve(uint8_t valve_number, bool state, bool direction) { if (state == VALVE_DISABLE ) { - ReportWithPackageFilter(WasteFilter,"------------ set valve 1 Disable-----------------", __FILE__,__LINE__, state, direction, 0, 0); + ReportWithPackageFilter(WasteFilter,"------------ set valve 1 Disable-----------------", __FILE__,__LINE__, state, RpMessage, direction, 0); } else { - ReportWithPackageFilter(WasteFilter,"------------ set valve 1 Enable-----------------", __FILE__,__LINE__, state, direction, 0, 0); + ReportWithPackageFilter(WasteFilter,"------------ set valve 1 Enable-----------------", __FILE__,__LINE__, state, RpMessage, direction, 0); } Whs_I2C_EXP_U4_0x42_VALUE.bits.VALUE_VALV2_DIR = direction; //P04 Whs_I2C_EXP_U4_0x42_VALUE.bits.VALUE_VALV2_EN = state; //P05 @@ -266,11 +266,11 @@ bool Write_WHS_pump(bool state) { if (state == PUMP_ENABLE ) { - ReportWithPackageFilter(WasteFilter,"------------ Write_WHS_pump ON-----------------", __FILE__,__LINE__, state, 0, 0, 0); + ReportWithPackageFilter(WasteFilter,"------------ Write_WHS_pump ON-----------------", __FILE__,__LINE__, state, RpMessage, 0, 0); } else { - ReportWithPackageFilter(WasteFilter,"------------ Write_WHS_pump OFF-----------------", __FILE__,__LINE__, state, 0, 0, 0); + ReportWithPackageFilter(WasteFilter,"------------ Write_WHS_pump OFF-----------------", __FILE__,__LINE__, state, RpMessage, 0, 0); } Whs_I2C_EXP_U3_0x40_VALUE.bits.VALUE_PUMP_ON = state; status = WHS_Write_IO( I2CExp1_ADDRESS, D_TCA9555_PORT_0); -- cgit v1.3.1