Index: firmware/App/Controllers/Switches.c =================================================================== diff -u -r264d5853c97ab9550878609c9302e87464078734 -r04c5d5d9198c1fde05df66ec8f5e660f7f7174b1 --- firmware/App/Controllers/Switches.c (.../Switches.c) (revision 264d5853c97ab9550878609c9302e87464078734) +++ firmware/App/Controllers/Switches.c (.../Switches.c) (revision 04c5d5d9198c1fde05df66ec8f5e660f7f7174b1) @@ -51,6 +51,7 @@ // ********** private function prototypes ********** static void publishSwitchesData( void ); +static void publishSwitchChanged( SWITCH_T switchId, U32 current_state ); /*********************************************************************//** * @brief @@ -117,6 +118,7 @@ // 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 ) ) { + publishSwitchChanged( (SWITCH_T)i, (U32)currentSwitchStatus ); switchesStatus[ i ].debounceStartTime = 0; switchesStatus[ i ].status.data = currentSwitchStatus; } @@ -185,7 +187,15 @@ } } +static void publishSwitchChanged( SWITCH_T switchId, U32 current_state ) +{ + SWITCH_CHANGED_DATA_T data; + data.SwitchId = (U32)switchId; + data.newstate = current_state; + + broadcastData( MSG_ID_DG_SWITCH_CHANGE, COMM_BUFFER_OUT_CAN_DG_BROADCAST, (U08*)&data, sizeof( SWITCH_CHANGED_DATA_T ) ); +} /************************************************************************* * TEST SUPPORT FUNCTIONS *************************************************************************/