Index: firmware/App/Modes/ModeTreatment.c =================================================================== diff -u -r30f049651877229042e3f8700c8596e5b9a1e0f4 -r24a98ea92563dad552889c30604d539d266b339e --- firmware/App/Modes/ModeTreatment.c (.../ModeTreatment.c) (revision 30f049651877229042e3f8700c8596e5b9a1e0f4) +++ firmware/App/Modes/ModeTreatment.c (.../ModeTreatment.c) (revision 24a98ea92563dad552889c30604d539d266b339e) @@ -156,28 +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; - } - sendTreatmentEndResponseMsg( result ); - - return result; -} - -/*********************************************************************//** - * @brief * The signalAlarmActionToTreatmentMode function executes the given alarm action * as appropriate while in Treatment Mode. * @details Inputs: none @@ -223,14 +201,6 @@ currentTreatmentState = TREATMENT_DIALYSIS_STATE; break; - case TREATMENT_RINSEBACK_PAUSE_STATE: - // TODO - implement - break; - - case TREATMENT_RECIRC_PAUSE_STATE: - // TODO - implement - break; - default: // Ignore break; @@ -291,30 +261,10 @@ // TODO - implement break; - case TREATMENT_RINSEBACK_PAUSE_STATE: - // TODO - implement - break; - - case TREATMENT_RECIRC_SETUP_STATE: - // TODO - implement - break; - case TREATMENT_RECIRC_STATE: // TODO - implement break; - case TREATMENT_RECIRC_PAUSE_STATE: - // TODO - implement - break; - - case TREATMENT_RECIRC_STOP_STATE: - // TODO - implement - break; - - case TREATMENT_DIALYSIS_END_STATE: - // TODO - implement - break; - case TREATMENT_END_STATE: // TODO - implement endAirTrapControl(); // TODO - move to appropriate place @@ -478,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_DIALYSIS_END_STATE ) && + ( currentTreatmentState > TREATMENT_START_STATE ) && ( currentTreatmentState < TREATMENT_END_STATE ) && ( CALC_ELAPSED_TREAT_TIME_IN_MIN() < treatmentTime ) && ( treatmentTime >= MIN_TREATMENT_TIME_MINUTES ) ) { F32 uFVolume; @@ -518,7 +468,7 @@ rejectReason = REQUEST_REJECT_REASON_NOT_IN_TREATMENT_MODE; } else if ( ( currentTreatmentState <= TREATMENT_START_STATE ) || - ( currentTreatmentState >= TREATMENT_DIALYSIS_END_STATE ) ) + ( currentTreatmentState >= TREATMENT_END_STATE ) ) { rejectReason = REQUEST_REJECT_REASON_INVALID_TREATMENT_STATE; } @@ -565,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_DIALYSIS_END_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 ) ) { @@ -624,7 +574,7 @@ rejectReason = REQUEST_REJECT_REASON_TREATMENT_TIME_OUT_OF_RANGE; } else if ( ( currentTreatmentState <= TREATMENT_START_STATE ) || - ( currentTreatmentState >= TREATMENT_DIALYSIS_END_STATE ) ) + ( currentTreatmentState >= TREATMENT_END_STATE ) ) { rejectReason = REQUEST_REJECT_REASON_INVALID_TREATMENT_STATE; } @@ -873,7 +823,7 @@ { stopDialysis(); elapsedTreatmentTimeInSecs = presTreatmentTimeSecs; - currentTreatmentState = TREATMENT_DIALYSIS_END_STATE; + currentTreatmentState = TREATMENT_END_STATE; } // Broadcast treatment time and state data at interval if ( ++treatmentTimeBroadcastTimerCtr >= TREATMENT_TIME_DATA_PUB_INTERVAL ) @@ -906,7 +856,7 @@ // Compute minimum treatment duration U32 presTime = ( presTreatmentTimeSecs / SEC_PER_MIN ); U32 elapseTime = CALC_ELAPSED_TREAT_TIME_IN_MIN(); - U32 minTime = MAX( (elapseTime + 2), MIN_TREATMENT_TIME_MINUTES ); // Treatment duration cannot be < 1 hour. add two minutes to cover rounding and ensure it's valid for next minute + U32 minTime = MAX( (elapseTime + 2), MIN_TREATMENT_TIME_MINUTES ); // Treatment duration cannot be < 1 hour. add two minutes to cover rounding and ensure it is valid for next minute // Compute maximum treatment duration (from both UF and dialysate volume perspectives) U32 maxTimeRem = ( MAX_UF_VOLUME_ML - (U32)getUltrafiltrationVolumeCollected() ) / ( presUFRate > 0.0 ? (U32)presUFRate : 1 ); U32 maxTime1 = minTime + maxTimeRem;