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 ); } } 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 ); } }