#include #include "Thermistors.h" #include "FPGA.h" #include "TaskGeneral.h" #include "InternalADC.h" #include "SystemCommMessages.h" /** * @addtogroup Thermistors * @{ */ // ********** private definitions ********** #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 ///< FGPA read delay upon startup. #define ONBOARD_THERMISTOR_SOURCE_VOLTAGE 3 ///< Onboard thermistor source voltage. #define ONBOARD_THERMISTOR_REFERENCE_RESISTOR 10 ///< Onboard thermistor reference resistor. #define ONBOARD_THERMISTOR_BETA_VALUE 3380 ///< Onboard thermistor beta value. #define ONBOARD_THERMISTOR_REFERENCE_TEMPERATURE 298 ///< Onboard thermistor reference temperature. #define TWELVE_BIT_RESOLUTION 4096 ///< 12 bit resolution conversion. #define CELSIUS_TO_KELVIN_CONVERSION 273.15 ///< Celsius to Kelvin temperature conversion. #define ADC_TEMP_SENSORS_CONVERSION_CONST 272.5 ///< ADC temperature sensors conversion constant. #define MIN_ALLOWED_TEMPERATURE 0 ///< Thermistors/sensors minimum allowed temperature reading. #define MAX_ALLOWED_TEMPERATURE 70 ///< Thermistors/sensors maximum allowed temperature reading. #define MAX_ALLOWED_TEMP_OUT_OF_RANGE_COUNT ( MS_PER_SECOND / ( 4 * TASK_GENERAL_INTERVAL ) ) ///< Thermistors/sensors maximum allowed temperature out of range count. /// Thermistors self test states typedef enum thermistors_Self_Test_States { THERMISTROS_SELF_TEST_CHECK_RANGE = 0, ///< Thermistors self test range check THERMISTORS_SELF_TEST_COMPLETE, ///< Thermistors self test complete NUM_OF_THERMISTORS_SELF_TEST_STATES, ///< Number of thermistors self test states } THERMISTORS_SELF_TEST_STATES_T; /// Thermistors exec states typedef enum thermistors_Exec_States { THERMISTORS_EXEC_STATE_START = 0, ///< Thermistors exec state start THERMISTORS_EXEC_STATE_GET_ADC_VALUES, ///< Thermistors exec state get ADC values NUM_OF_THERMISTORS_EXEC_STATES, ///< Number of thermistors exec state } THERMISTORS_EXEC_STATES_T; /// Thermistor struct typedef struct { S32 rawADCRead; ///< Thermistor raw ADC read OVERRIDE_F32_T temperatureValue; ///< Thermistor temperature value U32 tempOutOfRangeCount; ///< Thermistor temperature out of range counter } THERMISTOR_T; static SELF_TEST_STATUS_T thermistorsSelfTestReslt = SELF_TEST_STATUS_IN_PROGRESS; ///< Thermistors self test result static THERMISTORS_SELF_TEST_STATES_T thermistorsSelfTestState = THERMISTROS_SELF_TEST_CHECK_RANGE; ///< Thermistors self test state static THERMISTORS_EXEC_STATES_T thermistorsExecState = THERMISTORS_EXEC_STATE_START; ///< 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 static U32 dataPublishCounter; ///< Thermistors data publish timer counter static U32 adcReadCounter; ///< Thermistors ADC read counter static const F32 fpgaBoardTempSensorConvCoeff = 503.975 / TWELVE_BIT_RESOLUTION; ///< FPGA board temperature sensor conversion coefficient static const F32 adcTempSensorsConversionCoeff1 = 1 / 13584; ///< ADC temperature sensors conversion coefficient 1 static const F32 adcTempSensorsConversionCoeff2 = 0x800000 / 13584; ///< ADC temperature sensors conversion coefficient 2 static const F32 onBoardThermistorVoltageConvCoeff = ONBOARD_THERMISTOR_SOURCE_VOLTAGE / TWELVE_BIT_RESOLUTION; ///< On board thermistor ADC to voltage conversion coefficient static const F32 onBoardThermistorBetaValueInv = 1 / ONBOARD_THERMISTOR_BETA_VALUE; ///< On board thermistor beta value inverse static const F32 onBoardThermistorRefTempInv = 1 / ONBOARD_THERMISTOR_REFERENCE_TEMPERATURE; ///< On board thermistor reference temONBOARD_THERMISTOR_REFERENCE_TEMPERATUREperature inverse // ********** private function prototypes ********** static THERMISTORS_SELF_TEST_STATES_T handleSelfTestRangeCheck( void ); static THERMISTORS_EXEC_STATES_T handleExecStart( void ); static THERMISTORS_EXEC_STATES_T handleExecGetADCValues( void ); static void monitorThermistors( void ); static void convertADCtoTemperature( void ); static F32 calculateOnBoardThemristorTemperature( U32 adcValue ); static void publishThermistorsData( void ); static U32 getPublishThermistorsDataInterval( void ); /*********************************************************************//** * @brief * The initThermistors function initializes the thermistors module. * @details Inputs: thermistorsSelfTestReslt, thermistorsExecState, * thermistorsExecState, dataPublishCounter * @details Outputs: thermistorsSelfTestReslt, thermistorsExecState, * thermistorsExecState, dataPublishCounter * @return none *************************************************************************/ void initThermistors( void ) { THERMISTORS_TEMP_SENSORS_T thermistor; // Reset the thermistors values for a run thermistorsSelfTestReslt = SELF_TEST_STATUS_IN_PROGRESS; thermistorsExecState = THERMISTORS_EXEC_STATE_START; thermistorsSelfTestState = THERMISTROS_SELF_TEST_CHECK_RANGE; dataPublishCounter = 0; for ( thermistor = THERMISTOR_ONBOARD_NTC; thermistor < NUM_OF_THERMISTORS; thermistor++ ) { thermistorsStatus[ thermistor ].tempOutOfRangeCount = 0; } } /*********************************************************************//** * @brief * The execThermistorsSelfTest function executes the thermistors self test. * @details Inputs: thermistorsSelfTestState * @details Outputs: thermistorsSelfTestState * @return Status of self test *************************************************************************/ SELF_TEST_STATUS_T execThermistorsSelfTest( void ) { switch ( thermistorsSelfTestState ) { case THERMISTROS_SELF_TEST_CHECK_RANGE: thermistorsSelfTestState = handleSelfTestRangeCheck(); break; case THERMISTORS_SELF_TEST_COMPLETE: // Done with POST. Do nothing. break; default: // Wrong state was called, raise an alarm SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DG_SOFTWARE_FAULT, SW_FAULT_ID_THERMISTORS_INVALID_SELF_TEST_STATE, thermistorsSelfTestState ); thermistorsSelfTestState = THERMISTORS_SELF_TEST_COMPLETE; break; } return thermistorsSelfTestReslt; } /*********************************************************************//** * @brief * The execThermistors function executes the thermistors exec states. * @details Inputs: thermistorsExecState * @details Outputs: thermistorsExecState * @return none *************************************************************************/ void execThermistors( void ) { switch ( thermistorsExecState ) { case THERMISTORS_EXEC_STATE_START: thermistorsExecState = handleExecStart(); break; case THERMISTORS_EXEC_STATE_GET_ADC_VALUES: thermistorsExecState = handleExecGetADCValues(); break; default: // Wrong state was called, raise an alarm SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DG_SOFTWARE_FAULT, SW_FAULT_ID_THERMISTORS_INVALID_EXEC_STATE, thermistorsExecState ); thermistorsExecState = THERMISTORS_EXEC_STATE_GET_ADC_VALUES; break; } // Check if it is time to publish any data publishThermistorsData(); } /*********************************************************************//** * @brief * The getThermistorTemperatureValue function returns the temperature of * a requested thermistor or temperature sensor. * @details Inputs: thermistorsStatus * @details Outputs: none * @param thermistor to get its temperature value * @return temperature of a thermistor or temperature sensor *************************************************************************/ F32 getThermistorTemperatureValue( THERMISTORS_TEMP_SENSORS_T thermistor ) { F32 temperature = 0.0; // Check if the thermistor of sensor is in range if ( thermistor < NUM_OF_THERMISTORS ) { if ( thermistorsStatus[ thermistor ].temperatureValue.override == OVERRIDE_KEY ) { temperature = thermistorsStatus[ thermistor ].temperatureValue.ovData; } else { temperature = thermistorsStatus[ thermistor ].temperatureValue.data; } } else { SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DG_SOFTWARE_FAULT, SW_FAULT_ID_INVALID_THERMISTOR_SELECTED, thermistor ); } return temperature; } /*********************************************************************//** * @brief * The handleSelfTestRangeCheck function checks whether the thermistors * are in range upon staring the device. * @details Inputs: thermistorsStatus, adcReadCounter * @details Outputs: thermistorsStatus, adcReadCounter * @return next state of self test *************************************************************************/ static THERMISTORS_SELF_TEST_STATES_T handleSelfTestRangeCheck( void ) { THERMISTORS_SELF_TEST_STATES_T state = THERMISTROS_SELF_TEST_CHECK_RANGE; // Give a short time for FPGA to boot up and start sending the ADC reads if ( ++adcReadCounter > ADC_FPGA_READ_DELAY_COUNT ) { THERMISTORS_TEMP_SENSORS_T thermistor; F32 temperature; // Assuming self test passed thermistorsSelfTestReslt = SELF_TEST_STATUS_PASSED; // Get all the raw readings in ADC thermistorsStatus[ THERMISTOR_ONBOARD_NTC ].rawADCRead = getIntADCReading( INT_ADC_BOARD_THERMISTOR ); thermistorsStatus[ TEMPSENSOR_FPGA_SENSOR ].rawADCRead = getFPGABoardTemp(); thermistorsStatus[ TEMPSENSOR_LOAD_CELL_A1 ].rawADCRead = getFPGALoadCellsA1B1Temp(); thermistorsStatus[ TEMPSENSOR_LOAD_CELL_A2 ].rawADCRead = getFPGALoadCellsA2B2Temp(); thermistorsStatus[ TEMPSENSOR_INTERNAL_THDO_RTD ].rawADCRead = getFPGATHDoInternalTemp(); thermistorsStatus[ TEMPSENSOR_INTERNAL_TDI_RTD ].rawADCRead = getFPGATDiInternalTemp(); thermistorsStatus[ TEMPSENSOR_INTERNAL_CONDUCTIVITY ].rawADCRead = getFPGAConductivitySnsrInternalTemp(); 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 ); // Convert the ADC values to temperature convertADCtoTemperature(); for ( thermistor = THERMISTOR_ONBOARD_NTC; thermistor < NUM_OF_THERMISTORS; thermistor++ ) { // Get the actual temperature value and not the override value temperature = thermistorsStatus[ thermistor ].temperatureValue.data; // If the values are out of range, raise an alarm if ( temperature < MIN_ALLOWED_TEMPERATURE || temperature >= MAX_ALLOWED_TEMPERATURE ) { SET_ALARM_WITH_2_F32_DATA( ALARM_ID_DG_THERMISOTRS_TEMPERATURE_OUT_OF_RANGE, thermistor, temperature ); // If any thermistor/sensor is not in range, POST has failed thermistorsSelfTestReslt = SELF_TEST_STATUS_FAILED; } } // Done with POST state = THERMISTORS_SELF_TEST_COMPLETE; adcReadCounter = 0; } return state; } /*********************************************************************//** * @brief * The handleExecStart function handles the start state of the exec state * machine. * @details Inputs: adcReadCounter * @details Outputs: adcReadCounter * @return next state of the exec state machine *************************************************************************/ static THERMISTORS_EXEC_STATES_T handleExecStart( void ) { THERMISTORS_EXEC_STATES_T state = THERMISTORS_EXEC_STATE_START; // Give a short time for FPGA to boot up and start sending the ADC reads if ( ++adcReadCounter > ADC_FPGA_READ_DELAY_COUNT ) { state = THERMISTORS_EXEC_STATE_GET_ADC_VALUES; adcReadCounter = 0; } return state; } /*********************************************************************//** * @brief * The handleExecGetADCValues function handles the get ADC values state * of the exec state machine. * @details Inputs: adcReadCounter, thermistorsStatus * @details Outputs: adcReadCounter, thermistorsStatus * @return next state of the exec machine *************************************************************************/ static THERMISTORS_EXEC_STATES_T handleExecGetADCValues( void ) { THERMISTORS_EXEC_STATES_T state = THERMISTORS_EXEC_STATE_GET_ADC_VALUES; // If time has elapsed to read the ADCs, read them all if ( ++adcReadCounter >= THERMISTORS_ADC_READ_INTERVAL ) { // Get all the raw readings in ADC thermistorsStatus[ THERMISTOR_ONBOARD_NTC ].rawADCRead = getIntADCReading( INT_ADC_BOARD_THERMISTOR ); thermistorsStatus[ TEMPSENSOR_FPGA_SENSOR ].rawADCRead = getFPGABoardTemp(); thermistorsStatus[ TEMPSENSOR_LOAD_CELL_A1 ].rawADCRead = getFPGALoadCellsA1B1Temp(); thermistorsStatus[ TEMPSENSOR_LOAD_CELL_A2 ].rawADCRead = getFPGALoadCellsA2B2Temp(); thermistorsStatus[ TEMPSENSOR_INTERNAL_THDO_RTD ].rawADCRead = getFPGATHDoInternalTemp(); thermistorsStatus[ TEMPSENSOR_INTERNAL_TDI_RTD ].rawADCRead = getFPGATDiInternalTemp(); thermistorsStatus[ TEMPSENSOR_INTERNAL_CONDUCTIVITY ].rawADCRead = getFPGAConductivitySnsrInternalTemp(); 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 ); // Zero the counter for the next round of reading adcReadCounter = 0; // Convert all the latest ADCs to temperature convertADCtoTemperature(); // Monitor the values for a gross range check monitorThermistors(); } return state; } /*********************************************************************//** * @brief * The monitorThermistors function monitors the thermistors and sensors * for gross temperature range check. * @details Inputs: none * @details Outputs: none * @return none *************************************************************************/ static void monitorThermistors( void ) { THERMISTORS_TEMP_SENSORS_T thermistor; F32 temperature; for ( thermistor = THERMISTOR_ONBOARD_NTC; thermistor < NUM_OF_THERMISTORS; thermistor++ ) { temperature = getThermistorTemperatureValue( thermistor ); // If the thermisotrs and sensors read temperature out of range, raise an alarm if ( temperature < MIN_ALLOWED_TEMPERATURE || temperature >= MAX_ALLOWED_TEMPERATURE ) { // If a thermistor/sensor has been out of range consistently, raise an alarm if ( ++thermistorsStatus[ thermistor ].tempOutOfRangeCount > MAX_ALLOWED_TEMP_OUT_OF_RANGE_COUNT ) { SET_ALARM_WITH_2_F32_DATA( ALARM_ID_DG_THERMISOTRS_TEMPERATURE_OUT_OF_RANGE, thermistor, temperature ); thermistorsStatus[ thermistor ].tempOutOfRangeCount = 0; } } // If the next temperature reading is in range but the counter was greater than 0, reset else if ( thermistorsStatus[ thermistor ].tempOutOfRangeCount > 0 ) { thermistorsStatus[ thermistor ].tempOutOfRangeCount = 0; } } } /*********************************************************************//** * @brief * The convertADCtoTemperature function converts the ADC values of different * thermistors and temperature sensors to temperature value. * @details Inputs: thermistorsStatus, fpgaBoardTempSensorConvCoeff, * adcTempSensorsConversionCoeff1, adcTempSensorsConversionCoeff2 * @details Outputs: thermistorsStatus * @param thermistor (also covers the temperature sensors) to convert its value * @return none *************************************************************************/ static void convertADCtoTemperature( void ) { THERMISTORS_TEMP_SENSORS_T thermistor; F32 temperature; U32 rawADC; // Loop through the list and update the temperature values for ( thermistor = THERMISTOR_ONBOARD_NTC; thermistor < NUM_OF_THERMISTORS; thermistor++ ) { rawADC = thermistorsStatus[ thermistor ].rawADCRead; // Each of the sensors/thermistors have different equations to convert ADC read to temperature switch ( thermistor ) { case THERMISTOR_ONBOARD_NTC: temperature = calculateOnBoardThemristorTemperature( rawADC ); thermistorsStatus[ THERMISTOR_ONBOARD_NTC ].temperatureValue.data = temperature; break; case TEMPSENSOR_FPGA_SENSOR: // Temperature(C) = ((ADC x 503.975) / 4096) - 273.15 // The value of 503.975/4096 was done in a const variable to prevent the division all the time temperature = ( rawADC * fpgaBoardTempSensorConvCoeff ) - CELSIUS_TO_KELVIN_CONVERSION; thermistorsStatus[ TEMPSENSOR_FPGA_SENSOR ].temperatureValue.data = temperature; break; // All these sensors have the same conversion procedure case TEMPSENSOR_LOAD_CELL_A1: case TEMPSENSOR_LOAD_CELL_A2: case TEMPSENSOR_INTERNAL_THDO_RTD: case TEMPSENSOR_INTERNAL_TDI_RTD: case TEMPSENSOR_INTERNAL_CONDUCTIVITY: // Temperature(C) = ((ADC - 0x800000)/13584) - 272.5 // The values for 1/0x800000 and 0x800000/13584 were done in a const variable to prevent the division all the time temperature = ( ( rawADC * adcTempSensorsConversionCoeff1 ) - adcTempSensorsConversionCoeff2 ) - ADC_TEMP_SENSORS_CONVERSION_CONST; thermistorsStatus[ thermistor ].temperatureValue.data = temperature; break; default: // Wrong sensor was called, raise an alarm SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DG_SOFTWARE_FAULT, SW_FAULT_ID_INVALID_THERMISTOR_SELECTED, thermistor ); break; } } } /*********************************************************************//** * @brief * The calcualteOnBoardThemristorTemperature function converts the ADC value * of the onboard thermistor into temperature in C * @details Inputs: onBoardThermistorVoltageConvCoeff, * onBoardThermistorBetaValueInv * @details Outputs: none * @param ADC value to be converted into temperature in C * @return calculated temperature in C *************************************************************************/ static F32 calculateOnBoardThemristorTemperature( U32 adcValue ) { /* * voltage = ADC x 3 / 2^12 * voltage = 3 x 10 / ( 10 + R(T) ) * R(T) = 10 x e^(3380 x (1/T - 1/298)) * Solve for T which is temperature in Kelvin */ // Voltage = ADC x 3 / 2^12 for 12 bits resolution and a 3V ADC // The value of 3 / 2^12 has been calculated in a const to prevent the division again F32 const thermistorVoltage = adcValue * onBoardThermistorVoltageConvCoeff; // Calculate the thermistor resistor by solving: thermistorVoltage = (3 x 10) / (10 + R(T)) F32 const thermistorResistor = ( ( ONBOARD_THERMISTOR_REFERENCE_RESISTOR * ONBOARD_THERMISTOR_SOURCE_VOLTAGE ) - ( ONBOARD_THERMISTOR_REFERENCE_RESISTOR * thermistorVoltage ) ) / thermistorVoltage; // 1/T = Ln(thermistorResistor/10)/3380 + 1/298 F32 const InvTemperature = ( logf( thermistorResistor / ONBOARD_THERMISTOR_REFERENCE_RESISTOR ) * onBoardThermistorBetaValueInv ) + onBoardThermistorRefTempInv; // Inverse the value to get the temperature in Kelvin and then convert it to Celsius F32 const temperature = ( 1 / InvTemperature ) - CELSIUS_TO_KELVIN_CONVERSION; return temperature; } /*********************************************************************//** * @brief * The getPublishThermistorsDataInterval function gets the thermistors * data publish interval. * @details Inputs: thermistorsPublishInterval * @details Outputs: none * @return data publish time interval in counts *************************************************************************/ static U32 getPublishThermistorsDataInterval( void ) { U32 result = thermistorsPublishInterval.data; if ( OVERRIDE_KEY == thermistorsPublishInterval.override ) { result = thermistorsPublishInterval.ovData; } return result; } /*********************************************************************//** * @brief * The publishThermistorsData function publishes the thermistors and * temperature sensors data at the specified time interval. * @details Inputs: dataPublishCounter * @details Outputs: dataPublishCounter * @return none *************************************************************************/ static void publishThermistorsData( void ) { if ( ++dataPublishCounter > getPublishThermistorsDataInterval() ) { THERMISTORS_DATA_T sensorsData; // Get all the sensors/thermistors temperature values for publication sensorsData.onboardThermistor = getThermistorTemperatureValue( THERMISTOR_ONBOARD_NTC ); sensorsData.fpgaBoardTempSensor = getThermistorTemperatureValue( TEMPSENSOR_FPGA_SENSOR ); sensorsData.loadCellA1TempSensor = getThermistorTemperatureValue( TEMPSENSOR_LOAD_CELL_A1 ); sensorsData.loadCellA2TempSensor = getThermistorTemperatureValue( TEMPSENSOR_LOAD_CELL_A2 ); sensorsData.rtdInternalTempSensor = getThermistorTemperatureValue( TEMPSENSOR_INTERNAL_THDO_RTD ); sensorsData.rtdTDiInternalTempSensor = getThermistorTemperatureValue( TEMPSENSOR_INTERNAL_TDI_RTD ); sensorsData.conductivityTempSensor = getThermistorTemperatureValue( TEMPSENSOR_INTERNAL_CONDUCTIVITY ); sensorsData.powerSupply1Thermistor = getThermistorTemperatureValue( THERMISTOR_POWER_SUPPLY_1 ); sensorsData.powerSupply2Thermistor = getThermistorTemperatureValue( THERMISTOR_POWER_SUPPLY_2 ); // Broadcast the thermistors data broadcastThermistorsData( &sensorsData ); // Reset the counter dataPublishCounter = 0; } } /************************************************************************* * TEST SUPPORT FUNCTIONS *************************************************************************/ /*********************************************************************//** * @brief * The testSetThermistorPublishIntervalOverride function overrides the * thermistors data publish interval. * @details Inputs: thermistorsPublishInterval * @details Outputs: thermistorsPublishInterval * @param value which is override value for the thermistors data publish * interval * @return TRUE if override successful, FALSE if not *************************************************************************/ BOOL testSetThermistorPublishIntervalOverride( U32 value ) { BOOL result = FALSE; if ( TRUE == isTestingActivated() ) { U32 intvl = value / TASK_GENERAL_INTERVAL; result = TRUE; thermistorsPublishInterval.ovData = intvl; thermistorsPublishInterval.override = OVERRIDE_KEY; } return result; } /*********************************************************************//** * @brief * The testResetThermistorPublishIntervalOverride function resets the override * of the thermistors publish interval. * @details Inputs: thermistorsPublishInterval * @details Outputs: thermistorsPublishInterval * @return TRUE if override reset successful, FALSE if not *************************************************************************/ BOOL testResetThermistorPublishIntervalOverride( void ) { BOOL result = FALSE; if ( TRUE == isTestingActivated() ) { result = TRUE; thermistorsPublishInterval.override = OVERRIDE_RESET; thermistorsPublishInterval.ovData = thermistorsPublishInterval.ovInitData; } return result; } /*********************************************************************//** * @brief * The testSetMeasuredThermistorOverride function overrides the value of * a thermistor. * @details Inputs: thermistorsStatus * @details Outputs: thermistorsStatus * @param thermistor which its value is overridden * @param temperature value to override * @return TRUE if override successful, FALSE if not *************************************************************************/ BOOL testSetMeasuredThermistorOverride( U32 thermistor, F32 temperature ) { BOOL result = FALSE; if ( thermistor < NUM_OF_THERMISTORS && isTestingActivated() ) { // There is a temperature range that the thermistors can be set to, otherwise, the driver // will throw an alarm. Also, the fans driver depends on these values to continuously control the fans if ( temperature >= MIN_ALLOWED_TEMPERATURE && temperature < MAX_ALLOWED_TEMPERATURE ) { result = TRUE; thermistorsStatus[ thermistor ].temperatureValue.ovData = temperature; thermistorsStatus[ thermistor ].temperatureValue.override = OVERRIDE_KEY; } } return result; } /*********************************************************************//** * @brief * The testResetMeasuredThermistorOverride function resets the override * value of a thermistor. * @details Inputs: thermistorsStatus * @details Outputs: thermistorsStatus * @param thermistor which its value is overridden * @return TRUE if override successful, FALSE if not *************************************************************************/ BOOL testResetMeasuredThermistorOverride( U32 thermistor ) { BOOL result = FALSE; if ( thermistor < NUM_OF_THERMISTORS ) { if ( isTestingActivated() ) { result = TRUE; thermistorsStatus[ thermistor ].temperatureValue.override = OVERRIDE_RESET; thermistorsStatus[ thermistor ].temperatureValue.ovData = thermistorsStatus[ thermistor ].temperatureValue.ovInitData; } } return result; } /**@}*/