Index: firmware/App/Services/StateServices/TubeSetAutoEject.c =================================================================== diff -u -rf3a51a00cc2d17944d7af069adc5041a804d4572 -r322b6362de4e66fc7d97073d15214fc2238de36e --- firmware/App/Services/StateServices/TubeSetAutoEject.c (.../TubeSetAutoEject.c) (revision f3a51a00cc2d17944d7af069adc5041a804d4572) +++ firmware/App/Services/StateServices/TubeSetAutoEject.c (.../TubeSetAutoEject.c) (revision 322b6362de4e66fc7d97073d15214fc2238de36e) @@ -42,10 +42,11 @@ static BOOL autoEjectReqReceived; ///< Flag indicating that user confirmed to eject tubeset static U32 autoEjectTimerCounter; ///< Timer counter shared across all auto-eject states -static BOOL bpLastHome; ///< Flag for Blood Pump last home (for rising-edge) -static U32 bpLeftHomeTimerCounter; ///< Timer Counter to measure how long BP has been away from home +static BOOL bpLastHome; ///< Flag for blood pump last home (for rising-edge) +static U32 bpLeftHomeTimerCounter; ///< Timer counter to measure how long BP has been away from home -static TUBE_SET_AUTO_EJECT_STATE_T currentAutoEjectState; ///< Current Tube Set Auto Eject state +static TUBE_SET_AUTO_EJECT_STATE_T previousAutoEjectState; ///< Previous tube set auto-eject state +static TUBE_SET_AUTO_EJECT_STATE_T currentAutoEjectState; ///< Current tube set auto-eject state // ********** private function prototypes ********** @@ -67,6 +68,7 @@ **************************************************************************/ void initTubeSetAutoEject( void ) { + previousAutoEjectState = TUBE_SET_AUTO_EJECT_STATE_AWAIT_CONFIRMATION; currentAutoEjectState = TUBE_SET_AUTO_EJECT_STATE_AWAIT_CONFIRMATION; autoEjectReqReceived = FALSE; autoEjectTimerCounter = 0; @@ -78,15 +80,13 @@ * @brief * The execTubeSetAutoEject function executes the Tube Set Eject * state machine. - * @details \b Inputs: currentAutoEjectState - * @details \b Outputs: currentAutoEjectState. Advances the - * Tube Set Eject sub-state + * @details \b Inputs: currentAutoEjectState, previousAutoEjectState + * @details \b Outputs: currentAutoEjectState, previousAutoEjectState. + * Advances the Tube Set Eject sub-state * @return none *************************************************************************/ void execTubeSetAutoEject( void ) { - TUBE_SET_AUTO_EJECT_STATE_T priorState = currentAutoEjectState; - switch ( currentAutoEjectState ) { case TUBE_SET_AUTO_EJECT_STATE_AWAIT_CONFIRMATION: @@ -122,9 +122,10 @@ break; } - if ( priorState != currentAutoEjectState ) + if ( previousAutoEjectState != currentAutoEjectState ) { - SEND_EVENT_WITH_2_U32_DATA( TD_EVENT_SUB_STATE_CHANGE, priorState, currentAutoEjectState ); + previousAutoEjectState = currentAutoEjectState; + SEND_EVENT_WITH_2_U32_DATA( TD_EVENT_SUB_STATE_CHANGE, previousAutoEjectState, currentAutoEjectState ); } }