Index: firmware/App/Controllers/Temperatures.c =================================================================== diff -u -r07cdd44ffd0905cb115405e22cc7586585034e7f -r0b0cfd7e0f84f89b3a428cf77334e2d76b13a6a9 --- firmware/App/Controllers/Temperatures.c (.../Temperatures.c) (revision 07cdd44ffd0905cb115405e22cc7586585034e7f) +++ firmware/App/Controllers/Temperatures.c (.../Temperatures.c) (revision 0b0cfd7e0f84f89b3a428cf77334e2d76b13a6a9) @@ -51,7 +51,7 @@ /// Temperatures exec states typedef enum thermistors_Exec_States { - TEMPERATURES_EXEC_STATE_WAIT_FOR_POST_STATE = 0, ///< Temperatures exec state wait for POST state. + TEMPERATURES_EXEC_STATE_START_STATE = 0, ///< Temperatures exec state start state. TEMPERATURES_EXEC_STATE_GET_ADC_VALUES_STATE, ///< Temperatures exec state get ADC values state. NUM_OF_TEMPERATURES_EXEC_STATES, ///< Number of temperatures exec state. } TEMPERATURES_EXEC_STATES_T; @@ -72,7 +72,6 @@ static U32 dataPublishCounter; ///< Temperatures data publish timer counter. static U32 adcReadCounter; ///< Temperatures ADC read counter. static HD_TEMP_SENSORS_CAL_RECORD_T temperaturesCalRecord; ///< Temperatures calibration record. -static BOOL isPOSTComplete; ///< Temperatures POST complete flag. static const F32 THERMISTOR_VOLTAGE_CONV_COEFF = THERMISTOR_REFERENCE_VOLTAGE / (F32)TWELVE_BIT_RESOLUTION; ///< On board thermistor ADC to voltage conversion coefficient. @@ -83,7 +82,7 @@ // ********** private function prototypes ********** -static TEMPERATURES_EXEC_STATES_T handleExecWaitForPOST( void ); +static TEMPERATURES_EXEC_STATES_T handleExecStart( void ); static TEMPERATURES_EXEC_STATES_T handleExecGetADCValues( void ); static void monitorTemperatures( void ); @@ -104,9 +103,8 @@ { U08 i; - temperaturesExecState = TEMPERATURES_EXEC_STATE_WAIT_FOR_POST_STATE; + temperaturesExecState = TEMPERATURES_EXEC_STATE_START_STATE; dataPublishCounter = DATA_PUBLISH_COUNTER_START_COUNT; - isPOSTComplete = FALSE; for ( i = 0; i < NUM_OF_TEMPERATURES; i++ ) { @@ -131,7 +129,6 @@ BOOL calStatus = getNVRecord2Driver( GET_CAL_TEMPERATURE_SESNORS, (U08*)&temperaturesCalRecord, sizeof( HD_TEMP_SENSORS_CAL_RECORD_T ), NUM_OF_CAL_DATA_HD_TEMP_SENSORS, ALARM_ID_NO_ALARM ); - isPOSTComplete = TRUE; if ( TRUE == calStatus ) { @@ -164,8 +161,8 @@ // Read the sensors all the time switch ( temperaturesExecState ) { - case TEMPERATURES_EXEC_STATE_WAIT_FOR_POST_STATE: - temperaturesExecState = handleExecWaitForPOST(); + case TEMPERATURES_EXEC_STATE_START_STATE: + temperaturesExecState = handleExecStart(); break; case TEMPERATURES_EXEC_STATE_GET_ADC_VALUES_STATE: @@ -219,18 +216,18 @@ /*********************************************************************//** * @brief - * The handleExecWaitForPOST function handles the wait for POST state of the + * 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 TEMPERATURES_EXEC_STATES_T handleExecWaitForPOST( void ) +static TEMPERATURES_EXEC_STATES_T handleExecStart( void ) { - TEMPERATURES_EXEC_STATES_T state = TEMPERATURES_EXEC_STATE_WAIT_FOR_POST_STATE; + TEMPERATURES_EXEC_STATES_T state = TEMPERATURES_EXEC_STATE_START_STATE; // Give a short time for FPGA to boot up and start sending the ADC reads - if ( ( ++adcReadCounter > ADC_FPGA_READ_DELAY_COUNT ) && ( MODE_INIT == getCurrentOperationMode() ) ) + if ( ++adcReadCounter > ADC_FPGA_READ_DELAY_COUNT ) { adcReadCounter = 0; state = TEMPERATURES_EXEC_STATE_GET_ADC_VALUES_STATE; @@ -283,18 +280,21 @@ F32 temperature = 0.0; U32 lastFaultSensor = 0; - for ( sensor = THERMISTOR_ONBOARD_NTC; sensor < NUM_OF_TEMPERATURES; sensor++ ) + if ( getCurrentOperationMode() != MODE_INIT ) { - temperature = getTemperatureValue( sensor ); - - if ( ( temperature > MAX_ALLOWED_TEMPERATURE ) || ( temperature < MIN_ALLOWED_TEMPERATURE ) ) + for ( sensor = THERMISTOR_ONBOARD_NTC; sensor < NUM_OF_TEMPERATURES; sensor++ ) { - isTempOutOfRange |= TRUE; - lastFaultSensor = sensor; + temperature = getTemperatureValue( sensor ); + + if ( ( temperature > MAX_ALLOWED_TEMPERATURE ) || ( temperature < MIN_ALLOWED_TEMPERATURE ) ) + { + isTempOutOfRange |= TRUE; + lastFaultSensor = sensor; + } } - } - checkPersistentAlarm( ALARM_ID_HD_TEMPERATURES_OUT_OF_RANGE, isTempOutOfRange, lastFaultSensor, MAX_ALLOWED_TEMPERATURE ); + checkPersistentAlarm( ALARM_ID_HD_TEMPERATURES_OUT_OF_RANGE, isTempOutOfRange, lastFaultSensor, MAX_ALLOWED_TEMPERATURE ); + } } /*********************************************************************//**