Index: firmware/App/Monitors/Switches.c =================================================================== diff -u -ra0d405d152c0f451ebf3c25e3c2cfa49a4db17cd -r395522dffef1348e176564925656012f529c1910 --- firmware/App/Monitors/Switches.c (.../Switches.c) (revision a0d405d152c0f451ebf3c25e3c2cfa49a4db17cd) +++ firmware/App/Monitors/Switches.c (.../Switches.c) (revision 395522dffef1348e176564925656012f529c1910) @@ -1,17 +1,17 @@ /************************************************************************** * -* Copyright (c) 2024-2024 Diality Inc. - All Rights Reserved. +* Copyright (c) 2024-2026 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[ FRONT_DOOR ] = ( 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++ ) @@ -150,14 +151,14 @@ // Check for door closed alarm if ( TRUE == requireDoorClosed ) { - if ( getSwitchState( FRONT_DOOR ) != STATE_CLOSED ) + if ( getSwitchState( H9_SWCH ) != STATE_CLOSED ) { activateAlarmNoData( ALARM_ID_TD_CARTRIDGE_DOOR_OPENED ); } } // Handle clearing alarm conditions - if ( STATE_CLOSED == getSwitchState( FRONT_DOOR ) ) + if ( STATE_CLOSED == getSwitchState( H9_SWCH ) ) { clearAlarmCondition( ALARM_ID_TD_CARTRIDGE_DOOR_OPENED ); } @@ -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 *************************************************************************/ @@ -225,7 +221,7 @@ SWITCHES_DATA_T data; switchesDataPublicationCounter = 0; - data.frontDoor = (U32)getSwitchState( FRONT_DOOR ); + data.h9Door = (U32)getSwitchState( H9_SWCH ); broadcastData( MSG_ID_TD_SWITCHES_DATA, COMM_BUFFER_OUT_CAN_TD_BROADCAST, (U08*)&data, sizeof( SWITCHES_DATA_T ) ); } }