Index: firmware/App/Controllers/AlarmLamp.c =================================================================== diff -u -ra3a01327c8fe80f65f6658ae6cbef4910a4a8033 -r8e7158d8231435496fcf1d5649e51babf859ccc7 --- firmware/App/Controllers/AlarmLamp.c (.../AlarmLamp.c) (revision a3a01327c8fe80f65f6658ae6cbef4910a4a8033) +++ firmware/App/Controllers/AlarmLamp.c (.../AlarmLamp.c) (revision 8e7158d8231435496fcf1d5649e51babf859ccc7) @@ -1,14 +1,14 @@ /************************************************************************** * -* Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. +* Copyright (c) 2019-2021 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 AlarmLamp.c * -* @author (last) Sean -* @date (last) 27-Feb-2020 +* @author (last) Sean Nash +* @date (last) 24-Sep-2020 * * @author (original) Dara Navaei * @date (original) 05-Nov-2019 @@ -66,7 +66,8 @@ static OVERRIDE_U32_T currentLampPattern = { LAMP_PATTERN_MANUAL, LAMP_PATTERN_FAULT, LAMP_PATTERN_FAULT, 0 }; static LAMP_PATTERN_T pendingLampPattern = LAMP_PATTERN_MANUAL; ///< Pending alarm lamp pattern. static U32 currentLampPatternStep = 0; ///< Current alarm lamp pattern step. -static U32 lampPatternStepTimer = 0; ///< Timer counter for current alarm lamp pattern step. +static U32 lampPatternStepTimer = 0; ///< Timer counter for current alarm lamp pattern step. +static BOOL alarmLampOn = FALSE; ///< Flag indicates whether an any lamp is currently on. /// Two step alarm lamp patterns (repeating). const struct LampPatterns lampPatterns[ NUM_OF_LAMP_PATTERNS ] = { @@ -89,16 +90,16 @@ /*********************************************************************//** * @brief * The initAlarmLamp function initializes the AlarmLamp module. - * @details - * Inputs : none - * Outputs : AlarmLamp module initialized. + * @details Inputs: none + * @details Outputs: AlarmLamp module initialized. * @return none *************************************************************************/ void initAlarmLamp( void ) { pendingLampPattern = LAMP_PATTERN_MANUAL; currentLampPatternStep = 0; - lampPatternStepTimer = 0; + lampPatternStepTimer = 0; + alarmLampOn = FALSE; alarmLampSelfTestState = ALARM_LAMP_SELF_TEST_STATE_START; alarmLampSelfTestStepTimerCount = 0; @@ -108,10 +109,9 @@ * @brief * The execAlarmLamp function executes the alarm lamp service for the * current lamp pattern. - * @details - * Inputs : pendingLampPattern, currentLampPattern, lampPatternStepTimer, + * @details Inputs: pendingLampPattern, currentLampPattern, lampPatternStepTimer, * lampPatterns. - * Outputs : currentLampPattern + * @details Outputs: currentLampPattern * @return none *************************************************************************/ void execAlarmLamp( void ) @@ -151,9 +151,8 @@ /*********************************************************************//** * @brief * The requestAlarmLampPattern function sets a request for a new lamp pattern. - * @details - * Inputs : none - * Outputs : pendingLampPattern + * @details Inputs: none + * @details Outputs: pendingLampPattern * @param lampPattern new lamp pattern * @return none *************************************************************************/ @@ -173,9 +172,8 @@ * @brief * The getCurrentAlarmLampPattern function gets the current alarm lamp * pattern in effect. - * @details - * Inputs : currentLampPattern - * Outputs : none + * @details Inputs: currentLampPattern + * @details Outputs: none * @return currentLampPattern *************************************************************************/ LAMP_PATTERN_T getCurrentAlarmLampPattern( void ) @@ -189,15 +187,26 @@ return result; } + +/*********************************************************************//** + * @brief + * The getAlarmLampOn function gets the current alarm lamp on flag. + * @details Inputs: alarmLampOn + * @details Outputs: none + * @return alarmLampOn + *************************************************************************/ +BOOL getAlarmLampOn( void ) +{ + return alarmLampOn; +} /*********************************************************************//** * @brief * The execAlarmLampTest function executes the alarm lamp test. * This function should be called periodically until a pass or fail * result is returned. - * @details - * Inputs : alarmLampSelfTestState, alarmLampSelfTestStepTimerCount - * Outputs : alarmLampSelfTestState, alarmLampSelfTestStepTimerCount + * @details Inputs: alarmLampSelfTestState, alarmLampSelfTestStepTimerCount + * @details Outputs: alarmLampSelfTestState, alarmLampSelfTestStepTimerCount * @return in progress, passed, or failed *************************************************************************/ SELF_TEST_STATUS_T execAlarmLampTest( void ) @@ -258,29 +267,32 @@ * @brief * The setAlarmLampToPatternStep function sets the lamps according to the * current lamp pattern and lamp pattern step. - * @details - * Inputs : lampPatterns[], currentLampPatternStep - * Outputs : lampPatternStepTimer reset. Lamps set per current pattern. + * @details Inputs: lampPatterns[], currentLampPatternStep + * @details Outputs: lampPatternStepTimer reset. Lamps set per current pattern. * @return none *************************************************************************/ static void setAlarmLampToPatternStep( void ) { PIN_SIGNAL_STATE_T green = PIN_SIGNAL_LOW; PIN_SIGNAL_STATE_T blue = PIN_SIGNAL_LOW; PIN_SIGNAL_STATE_T red = PIN_SIGNAL_LOW; - + + alarmLampOn = FALSE; lampPatternStepTimer = 0; if ( lampPatterns[ getCurrentAlarmLampPattern() ].green[ currentLampPatternStep ] == LAMP_STATE_ON ) { green = PIN_SIGNAL_HIGH; + alarmLampOn = TRUE; } if ( lampPatterns[ getCurrentAlarmLampPattern() ].blue[ currentLampPatternStep ] == LAMP_STATE_ON ) { blue = PIN_SIGNAL_HIGH; + alarmLampOn = TRUE; } if ( lampPatterns[ getCurrentAlarmLampPattern() ].red[ currentLampPatternStep ] == LAMP_STATE_ON ) { red = PIN_SIGNAL_HIGH; + alarmLampOn = TRUE; } #ifndef TASK_TIMING_OUTPUT_ENABLED @@ -300,9 +312,8 @@ * @brief * The testSetCurrentLampPatternOverride function overrides the state of the * current alarm lamp pattern with a given pattern. - * @details - * Inputs : none - * Outputs : currentLampPattern + * @details Inputs: none + * @details Outputs: currentLampPattern * @param value override state for the alarm lamp pattern * @return TRUE if override successful, FALSE if not *************************************************************************/ @@ -324,9 +335,8 @@ * @brief * The testResetCurrentLampPatternOverride function resets the override of the * state of the alarm lamp pattern. - * @details - * Inputs : none - * Outputs : currentLampPattern + * @details Inputs: none + * @details Outputs: currentLampPattern * @return TRUE if override reset successful, FALSE if not *************************************************************************/ BOOL testResetCurrentLampPatternOverride( void )