Index: firmware/App/Controllers/Fans.c =================================================================== diff -u -ra4669c80291e85fa5ce17d77ebcfd0c882831202 -r696e732c9742535a58b9c65f243df7cd797d1423 --- firmware/App/Controllers/Fans.c (.../Fans.c) (revision a4669c80291e85fa5ce17d77ebcfd0c882831202) +++ firmware/App/Controllers/Fans.c (.../Fans.c) (revision 696e732c9742535a58b9c65f243df7cd797d1423) @@ -7,8 +7,8 @@ * * @file Fans.c * -* @author (last) Sean Nash -* @date (last) 15-Jul-2022 +* @author (last) Dara Navaei +* @date (last) 04-Aug-2022 * * @author (original) Dara Navaei * @date (original) 25-Nov-2020 @@ -62,7 +62,7 @@ /// Fans exec states typedef enum fans_Exec_States { - FANS_EXEC_STATE_WAIT_FOR_POST_STATE = 0, ///< Fans exec state start state. + FANS_EXEC_STATE_START = 0, ///< Fans exec state start state. FANS_EXEC_STATE_RUN_STATE, ///< Fans exec state run state. NUM_OF_FANS_EXEC_STATES, ///< Number of fans exec states. } FANS_EXEC_STATES_T; @@ -78,13 +78,12 @@ // ********** private data ********** static FAN_STATUS_T fansStatus; ///< Fans status. -static FANS_EXEC_STATES_T fansExecState = FANS_EXEC_STATE_WAIT_FOR_POST_STATE; ///< Fans exec state. -static U32 fansControlCounter = 0; ///< Fans control interval counter. +static FANS_EXEC_STATES_T fansExecState; ///< Fans exec state. +static U32 fansControlCounter; ///< Fans control interval counter. static U32 fansPublishCounter; ///< Fans data publish interval counter. -static BOOL isPOSTComplete = FALSE; ///< Flag that indicates whether POST is complete or not. -static BOOL hasAlarmBeenRaised = FALSE; ///< Flag that indicates whether the RPM out of range alarm been raise. +static BOOL hasAlarmBeenRaised; ///< Flag that indicates whether the RPM out of range alarm been raise. static U32 rpmAlarmStartTimeOffset; ///< RPM out of range alarm start time offset. -static U32 rpmAlarmStartTime = 0; ///< RPM alarm start time. +static U32 rpmAlarmStartTime; ///< RPM alarm start time. static DG_FANS_CAL_RECORD_T fansCalReocrd; ///< Fans calibration record. /// Temperature to duty cycle conversion slope (duty cycle not in percent) @@ -97,7 +96,7 @@ // ********** private function prototypes ********** -static FANS_EXEC_STATES_T handleExecStateWaitForPOST( void ); +static FANS_EXEC_STATES_T handleExecStateStart( void ); static FANS_EXEC_STATES_T handleExecStateRun( void ); static void setInletFansDutyCycle( F32 pwm ); @@ -112,7 +111,7 @@ * The initFans function initializes the fans module. * @details Inputs: none * @details Outputs: fansExecState, fansControlCounter, fansPublishCounter, - * isPOSTComplete, hasAlarmBeenRaised, rpmAlarmStartTime, + * hasAlarmBeenRaised, rpmAlarmStartTime, * fansStatus, rpmAlarmStartTimeOffset * @return none *************************************************************************/ @@ -121,10 +120,9 @@ FAN_NAMES_T fan; // Initialize the variables - fansExecState = FANS_EXEC_STATE_WAIT_FOR_POST_STATE; + fansExecState = FANS_EXEC_STATE_START; fansControlCounter = 0; fansPublishCounter = DATA_PUBLISH_COUNTER_START_COUNT; - isPOSTComplete = FALSE; hasAlarmBeenRaised = FALSE; rpmAlarmStartTime = 0; rpmAlarmStartTimeOffset = 0; @@ -151,7 +149,7 @@ * @brief * The execFansSelfTest function executes the fans self test. * @details Inputs: none - * @details Outputs: isPOSTComplete, fansCalReocrd + * @details Outputs: fansCalReocrd * @return Status of self test *************************************************************************/ SELF_TEST_STATUS_T execFansSelfTest( void ) @@ -160,8 +158,6 @@ BOOL calStatus = getNVRecord2Driver( GET_CAL_FANS_RECORD, (U08*)&fansCalReocrd, sizeof( DG_FANS_CAL_RECORD_T ), NUM_OF_CAL_DATA_FANS, ALARM_ID_NO_ALARM ); - // Signal POST is completed - isPOSTComplete = TRUE; if ( TRUE == calStatus ) { @@ -186,8 +182,8 @@ { switch ( fansExecState ) { - case FANS_EXEC_STATE_WAIT_FOR_POST_STATE: - fansExecState = handleExecStateWaitForPOST(); + case FANS_EXEC_STATE_START: + fansExecState = handleExecStateStart(); break; case FANS_EXEC_STATE_RUN_STATE: @@ -248,24 +244,14 @@ * @details Outputs: none * @return the next state of the exec state machine *************************************************************************/ -static FANS_EXEC_STATES_T handleExecStateWaitForPOST( void ) +static FANS_EXEC_STATES_T handleExecStateStart( void ) { - FANS_EXEC_STATES_T state = FANS_EXEC_STATE_WAIT_FOR_POST_STATE; + FANS_EXEC_STATES_T state = FANS_EXEC_STATE_RUN_STATE; - // Wait for the self test to finish before starting the fans - if ( TRUE == isPOSTComplete ) - { - // Start the fans with minimum PWM. The control will decide the next PWM automatically. - setInletFansDutyCycle( FANS_MIN_DUTY_CYCLE ); - setOutletFansDutyCycle( FANS_MIN_DUTY_CYCLE ); - state = FANS_EXEC_STATE_RUN_STATE; - } + // Start the fans with minimum PWM. The control will decide the next PWM automatically. + setInletFansDutyCycle( FANS_MIN_DUTY_CYCLE ); + setOutletFansDutyCycle( FANS_MIN_DUTY_CYCLE ); -#ifndef _VECTORCAST_ // To skip the wait for POST and start running. - // TODO REMOVE - state = FANS_EXEC_STATE_RUN_STATE; - // TODO REMOVE -#endif return state; }