Index: firmware/App/Monitors/Switches.c =================================================================== diff -u -re69d7ce1c9d88695e25e8ea94529dffdd8592434 -re24a98a344ba13ceb0663b415268a7e1dd5ce99e --- firmware/App/Monitors/Switches.c (.../Switches.c) (revision e69d7ce1c9d88695e25e8ea94529dffdd8592434) +++ firmware/App/Monitors/Switches.c (.../Switches.c) (revision e24a98a344ba13ceb0663b415268a7e1dd5ce99e) @@ -1,17 +1,17 @@ /************************************************************************** * -* Copyright (c) 2024-2024 Diality Inc. - All Rights Reserved. +* Copyright (c) 2024-2025 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 Switches.c * -* @author (last) Sean -* @date (last) 17-Sep-2024 +* @author (last) Sean Nash +* @date (last) 03-Jun-2025 * -* @author (original) Sean -* @date (original) 17-Sep-2024 +* @author (original) Sean Nash +* @date (original) 19-Sep-2024 * ***************************************************************************/ @@ -79,8 +79,9 @@ /*********************************************************************//** * @brief * The execSwitches function executes the switches monitor executive. - * @details \b Inputs: switchesStatus - * @details \b Outputs: switchesStatus + * Switch state changes are debounced for 250ms before formalizing them. + * @details \b Inputs: switchesStatus[], switchDebounceStartTimes[] + * @details \b Outputs: switchesStatus[], switchDebounceStartTimes[] * @return none *************************************************************************/ void execSwitches( void ) @@ -89,7 +90,7 @@ OPN_CLS_STATE_T currentSwitchStates[ NUM_OF_SWITCHES ]; // Get current state of each switch - currentSwitchStates[ H9_SWCH ] = ( FALSE == getFPGAFrontDoorClosedStatus() ? STATE_OPEN : STATE_CLOSED ); + currentSwitchStates[ H9_SWCH ] = ( FALSE == getH9FrontDoorClosedStatus() ? STATE_OPEN : STATE_CLOSED ); // Debounce each switch for ( i = 0; i < NUM_OF_SWITCHES; i++ ) @@ -179,12 +180,7 @@ if ( switchId < NUM_OF_SWITCHES ) { - state = switchesStatus[ switchId ].data; - - if ( OVERRIDE_KEY == switchesStatus[ switchId ].override ) - { - state = switchesStatus[ switchId ].ovData; - } + state = getU32OverrideValue( &switchesStatus[ switchId ] ); } else { @@ -214,7 +210,7 @@ * The publishSwitchesData function broadcasts the switches data at the * publication interval. * @details \b Message \b Sent: MSG_ID_TD_SWITCHES_DATA - * @details \b Inputs: switchesDataPublicationCounter + * @details \b Inputs: switchesDataPublicationCounter, switchesStatus[] * @details \b Outputs: switchesDataPublicationCounter * @return none *************************************************************************/