Index: firmware/App/Controllers/Switches.c =================================================================== diff -u -r264d5853c97ab9550878609c9302e87464078734 -ra8eecf939bc9baff3d5ff5e87013297b8fe20d0e --- firmware/App/Controllers/Switches.c (.../Switches.c) (revision 264d5853c97ab9550878609c9302e87464078734) +++ firmware/App/Controllers/Switches.c (.../Switches.c) (revision a8eecf939bc9baff3d5ff5e87013297b8fe20d0e) @@ -8,14 +8,13 @@ * @file Switches.c * * @author (last) Dara Navaei -* @date (last) 22-Feb-2022 +* @date (last) 25-May-2022 * * @author (original) Dara Navaei * @date (original) 24-Jul-2021 * ***************************************************************************/ - #include "FPGA.h" #include "MessageSupport.h" #include "Switches.h" @@ -46,7 +45,7 @@ static U32 switchesDataPublicationCounter; ///< Switches data publication counter. static OVERRIDE_U32_T switchesDataPublishInterval = { SWITCHES_DATA_PUB_INTERVAL, SWITCHES_DATA_PUB_INTERVAL, 0, 0 }; ///< Interval (in ms) at which to publish switches data to CAN bus. -static SWITCH_STATUS_T switchesStatus[ NUM_OF_CAPS ]; ///< Switches status array. +static SWITCH_STATUS_T switchesStatus[ NUM_OF_CAPS ]; ///< Switches status array. // ********** private function prototypes ********** @@ -86,7 +85,6 @@ void execSwitches( void ) { U08 i; - U08 currentSwitchStatus = 0; for ( i = 0; i < NUM_OF_CAPS; i++ ) @@ -117,6 +115,16 @@ // If the debounce time has been elapsed, update the switch status to the new status else if ( TRUE == didTimeout( switchesStatus[ i ].debounceStartTime, SWITCHES_DEBOUNCE_TIME_MS ) ) { + if (CONCENTRATE_CAP == i) + { + SEND_EVENT_WITH_2_U32_DATA( DG_EVENT_CONCENTRATE_CAP_SWITCH_CHANGE, + (U32)switchesStatus[ i ].status.data, (U32)currentSwitchStatus ); + } + else if (DIALYSATE_CAP == i) + { + SEND_EVENT_WITH_2_U32_DATA( DG_EVENT_DIALYSATE_CAP_SWITCH_CHANGE, + (U32)switchesStatus[ i ].status.data, (U32)currentSwitchStatus ); + } switchesStatus[ i ].debounceStartTime = 0; switchesStatus[ i ].status.data = currentSwitchStatus; } @@ -138,7 +146,7 @@ * @param switchId which is the switch that its status is requested * @return switch status *************************************************************************/ -OPN_CLS_STATE_T getSwitchStatus( SWITCH_T switchId ) +OPN_CLS_STATE_T getSwitchStatus( CAP_T switchId ) { U32 status = 0; @@ -185,7 +193,6 @@ } } - /************************************************************************* * TEST SUPPORT FUNCTIONS *************************************************************************/