Index: firmware/App/Services/StateServices/TubeSetInstall.c =================================================================== diff -u -rf3a51a00cc2d17944d7af069adc5041a804d4572 -r322b6362de4e66fc7d97073d15214fc2238de36e --- firmware/App/Services/StateServices/TubeSetInstall.c (.../TubeSetInstall.c) (revision f3a51a00cc2d17944d7af069adc5041a804d4572) +++ firmware/App/Services/StateServices/TubeSetInstall.c (.../TubeSetInstall.c) (revision 322b6362de4e66fc7d97073d15214fc2238de36e) @@ -43,10 +43,11 @@ static BOOL confirmTubesetPlaced; ///< Flag indicating user has confirmed tubeset is placed static U32 bloodPumpTimerCounter; ///< Blood Pump timer counter -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_INSTALL_STATE_T currentInstallState; ///< Current Tubing Set Install sub-state +static TUBE_SET_INSTALL_STATE_T previousInstallState; ///< Previous tube set install sub-state +static TUBE_SET_INSTALL_STATE_T currentInstallState; ///< Current tubing set install sub-state // ********** private function prototypes ********** @@ -66,6 +67,7 @@ **************************************************************************/ void initTubeSetInstall( void ) { + previousInstallState = TUBE_SET_INSTALL_STATE_AWAIT_TUBE_SET_CONFIRMATION; currentInstallState = TUBE_SET_INSTALL_STATE_AWAIT_TUBE_SET_CONFIRMATION; confirmTubesetPlaced = FALSE; bloodPumpTimerCounter = 0; @@ -77,15 +79,13 @@ * @brief * The execTubeSetInstall function executes the Tube Set Install * state machine. - * @details \b Inputs: currentInstallState - * @details \b Outputs: currentInstallState. Advances the - * Tube Set Install sub-state + * @details \b Inputs: currentInstallState, previousInstallState + * @details \b Outputs: currentInstallState, previousInstallState. + * Advances the Tube Set Install sub-state * @return none *************************************************************************/ void execTubeSetInstall( void ) { - TUBE_SET_INSTALL_STATE_T priorState = currentInstallState; - switch( currentInstallState ) { case TUBE_SET_INSTALL_STATE_AWAIT_TUBE_SET_CONFIRMATION: @@ -113,9 +113,10 @@ break; } - if ( priorState != currentInstallState ) + if ( previousInstallState != currentInstallState ) { - SEND_EVENT_WITH_2_U32_DATA( TD_EVENT_SUB_STATE_CHANGE, priorState, currentInstallState ); + previousInstallState = currentInstallState; + SEND_EVENT_WITH_2_U32_DATA( TD_EVENT_SUB_STATE_CHANGE, previousInstallState, currentInstallState ); } }