Index: firmware/App/Modes/ModeTreatment.c =================================================================== diff -u -rb4114c4cd078650769bf8a0379f47989660cc6e1 -r24a98ea92563dad552889c30604d539d266b339e --- firmware/App/Modes/ModeTreatment.c (.../ModeTreatment.c) (revision b4114c4cd078650769bf8a0379f47989660cc6e1) +++ firmware/App/Modes/ModeTreatment.c (.../ModeTreatment.c) (revision 24a98ea92563dad552889c30604d539d266b339e) @@ -156,27 +156,6 @@ /*********************************************************************//** * @brief - * The userRequestEndTreatment function conveys a user request to end the - * treatment. - * @details Inputs: currentTreatmentState - * @details Outputs: response to user request sent - * @return TRUE if request accepted, FALSE if not - *************************************************************************/ -BOOL userRequestEndTreatment( void ) -{ - BOOL result = FALSE; - - if ( TREATMENT_STOP_STATE == currentTreatmentState ) - { - pendingUserEndTreatmentRequest = TRUE; - result = TRUE; - } - - return result; -} - -/*********************************************************************//** - * @brief * The signalAlarmActionToTreatmentMode function executes the given alarm action * as appropriate while in Treatment Mode. * @details Inputs: none @@ -449,7 +428,7 @@ // Check if we are in an appropriate treatment state for settings adjustment if ( ( MODE_TREA == currMode ) && - ( currentTreatmentState > TREATMENT_START_STATE ) && + ( currentTreatmentState > TREATMENT_START_STATE ) && ( currentTreatmentState < TREATMENT_END_STATE ) && ( CALC_ELAPSED_TREAT_TIME_IN_MIN() < treatmentTime ) && ( treatmentTime >= MIN_TREATMENT_TIME_MINUTES ) ) { F32 uFVolume; @@ -488,7 +467,8 @@ { rejectReason = REQUEST_REJECT_REASON_NOT_IN_TREATMENT_MODE; } - else if ( currentTreatmentState <= TREATMENT_START_STATE ) + else if ( ( currentTreatmentState <= TREATMENT_START_STATE ) || + ( currentTreatmentState >= TREATMENT_END_STATE ) ) { rejectReason = REQUEST_REJECT_REASON_INVALID_TREATMENT_STATE; } @@ -535,7 +515,7 @@ // Check if we are in an appropriate treatment state for settings adjustment if ( ( MODE_TREA == currMode ) && - ( currentTreatmentState > TREATMENT_START_STATE ) && + ( currentTreatmentState > TREATMENT_START_STATE ) && ( currentTreatmentState < TREATMENT_END_STATE ) && ( uFVolume <= MAX_UF_VOLUME_ML ) && ( CALC_TREAT_TIME_REMAINING_IN_SECS() >= PREVENT_UF_VOL_CHANGE_IF_NEARLY_DONE_SEC ) ) { @@ -593,7 +573,8 @@ { rejectReason = REQUEST_REJECT_REASON_TREATMENT_TIME_OUT_OF_RANGE; } - else if ( currentTreatmentState <= TREATMENT_START_STATE ) + else if ( ( currentTreatmentState <= TREATMENT_START_STATE ) || + ( currentTreatmentState >= TREATMENT_END_STATE ) ) { rejectReason = REQUEST_REJECT_REASON_INVALID_TREATMENT_STATE; } @@ -842,6 +823,7 @@ { stopDialysis(); elapsedTreatmentTimeInSecs = presTreatmentTimeSecs; + currentTreatmentState = TREATMENT_END_STATE; } // Broadcast treatment time and state data at interval if ( ++treatmentTimeBroadcastTimerCtr >= TREATMENT_TIME_DATA_PUB_INTERVAL )