Index: firmware/App/Controllers/Thermistors.c =================================================================== diff -u -r986abcfcf047822cad1a10c1ee0924a80dd5f512 -r6499ea25921fcf67826fa0c35bb03caf411ba542 --- firmware/App/Controllers/Thermistors.c (.../Thermistors.c) (revision 986abcfcf047822cad1a10c1ee0924a80dd5f512) +++ firmware/App/Controllers/Thermistors.c (.../Thermistors.c) (revision 6499ea25921fcf67826fa0c35bb03caf411ba542) @@ -1,14 +1,14 @@ /************************************************************************** * -* Copyright (c) 2019-2022 Diality Inc. - All Rights Reserved. +* Copyright (c) 2020-2023 Diality Inc. - All Rights Reserved. * * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * @file Thermistors.c * * @author (last) Dara Navaei -* @date (last) 06-Nov-2021 +* @date (last) 03-Nov-2022 * * @author (original) Dara Navaei * @date (original) 25-Nov-2020 @@ -24,6 +24,7 @@ #include "SystemCommMessages.h" #include "Thermistors.h" #include "TaskGeneral.h" +#include "Utilities.h" /** * @addtogroup Thermistors @@ -34,15 +35,15 @@ #define THERMISTORS_DATA_PUBLISH_INTERVAL ( MS_PER_SECOND / TASK_GENERAL_INTERVAL ) ///< Thermistors publish data time interval. #define THERMISTORS_ADC_READ_INTERVAL ( MS_PER_SECOND / ( 2 * TASK_GENERAL_INTERVAL ) ) ///< Thermistors ADC read time interval. -#define ADC_FPGA_READ_DELAY_COUNT 1.0 ///< FGPA read delay upon startup. +#define ADC_FPGA_READ_DELAY_COUNT 1.0F ///< FGPA read delay upon startup. #define TWELVE_BIT_RESOLUTION 4096U ///< 12 bit resolution conversion. -#define THERMISTOR_REFERENCE_VOLTAGE 3.0 ///< Thermistors source voltage. -#define THERMISTOR_REFERENCE_RESISTOR_AT_25 10000.0 ///< Thermistors reference resistor in ohms. -#define THERMISTOR_REFERENCE_TEMPERATURE 298.0 ///< Thermistors reference temperature in kelvin. -#define THERMISTOR_BETA_VALUE 3380.0 ///< Thermistors beta value. -#define CELSIUS_TO_KELVIN_CONVERSION 273.15 ///< Celsius to Kelvin temperature conversion. -#define MIN_ALLOWED_TEMPERATURE 0.0 ///< Thermistors/sensors minimum allowed temperature reading. -#define MAX_ALLOWED_TEMPERATURE 80.0 ///< Thermistors/sensors maximum allowed temperature reading. +#define THERMISTOR_REFERENCE_VOLTAGE 3.0F ///< Thermistors source voltage. +#define THERMISTOR_REFERENCE_RESISTOR_AT_25 10000.0F ///< Thermistors reference resistor in ohms. +#define THERMISTOR_REFERENCE_TEMPERATURE 298.0F ///< Thermistors reference temperature in kelvin. +#define THERMISTOR_BETA_VALUE 3380.0F ///< Thermistors beta value. +#define CELSIUS_TO_KELVIN_CONVERSION 273.15F ///< Celsius to Kelvin temperature conversion. +#define MIN_ALLOWED_TEMPERATURE 0.0F ///< Thermistors/sensors minimum allowed temperature reading. +#define MAX_ALLOWED_TEMPERATURE 80.0F ///< Thermistors/sensors maximum allowed temperature reading. #define MAX_ALLOWED_TEMP_OUT_OF_RANGE_PERIOD ( 5 * MS_PER_SECOND ) ///< Thermistors/sensors maximum allowed temperature out of range period. #define DATA_PUBLISH_COUNTER_START_COUNT 2 ///< Data publish counter start count. @@ -61,7 +62,7 @@ OVERRIDE_F32_T temperatureValue; ///< Thermistor temperature value. } THERMISTOR_T; -static THERMISTORS_EXEC_STATES_T thermistorsExecState = THERMISTORS_EXEC_STATE_START_STATE; ///< Thermistors exec state. +static THERMISTORS_EXEC_STATES_T thermistorsExecState; ///< Thermistors exec state. static THERMISTOR_T thermistorsStatus[ NUM_OF_THERMISTORS ]; ///< Thermistors array. static OVERRIDE_U32_T thermistorsPublishInterval = { THERMISTORS_DATA_PUBLISH_INTERVAL, THERMISTORS_DATA_PUBLISH_INTERVAL, 0, 0 }; ///< Thermistors publish time interval override. @@ -110,7 +111,6 @@ { SELF_TEST_STATUS_T status = SELF_TEST_STATUS_IN_PROGRESS; - // TODO implement the calibration processing function. // It returns a pass for now status = SELF_TEST_STATUS_PASSED; @@ -226,8 +226,14 @@ // If time has elapsed to read the ADCs, read them all if ( ++adcReadCounter >= THERMISTORS_ADC_READ_INTERVAL ) { +#ifndef _RELEASE_ + if ( HW_CONFIG_BETA == getHardwareConfigStatus() ) + { + thermistorsStatus[ THERMISTOR_ONBOARD_NTC ].rawADCRead = getIntADCReading( INT_ADC_BOARD_THERMISTOR ); + } +#endif // Get all the raw readings in ADC - thermistorsStatus[ THERMISTOR_ONBOARD_NTC ].rawADCRead = getIntADCReading( INT_ADC_BOARD_THERMISTOR ); + thermistorsStatus[ THERMISTOR_ONBOARD_NTC ].rawADCRead = getFPGAOnBoardThermistorCount(); thermistorsStatus[ THERMISTOR_POWER_SUPPLY_1 ].rawADCRead = getIntADCReading( INT_ADC_POWER_SUPPLY_1_THERMISTOR ); thermistorsStatus[ THERMISTOR_POWER_SUPPLY_2 ].rawADCRead = getIntADCReading( INT_ADC_POWER_SUPPLY_2_THERMISTOR );