Index: firmware/App/Modes/ModeTreatment.c =================================================================== diff -u -r56ae47b6766bed3f138fa3f1989431d7a439ea7a -r3eb378de95b514ceb487e35342f58e734ca678c6 --- firmware/App/Modes/ModeTreatment.c (.../ModeTreatment.c) (revision 56ae47b6766bed3f138fa3f1989431d7a439ea7a) +++ firmware/App/Modes/ModeTreatment.c (.../ModeTreatment.c) (revision 3eb378de95b514ceb487e35342f58e734ca678c6) @@ -81,6 +81,7 @@ { U32 requestedTxDurationMins; ///< Requested treatment duration from the user in minutes. F32 newUFRateMLPM; ///< New calculated UF rate in mL/Min. + BOOL isUFRateConfInProgress; ///< Boolean flag to indicate whether a new UF rate confirmation has been requested. } TREATMENT_DURATION_RQST_T; // ********** private data ********** @@ -211,6 +212,7 @@ txDurationRequest.requestedTxDurationMins = 0; txDurationRequest.newUFRateMLPM = 0.0F; + txDurationRequest.isUFRateConfInProgress = FALSE; // reset dialysate temperature alarm persistences prior to starting a treatment. resetPersistentAlarmTimer( ALARM_ID_HD_DIALYSATE_TEMP_ABOVE_SAFETY_TEMP ); @@ -1101,6 +1103,7 @@ // Store the proposed treatment duration and the calculated new UF rate until the user approves it txDurationRequest.requestedTxDurationMins = treatmentTime; txDurationRequest.newUFRateMLPM = newUFRateMLPM; + txDurationRequest.isUFRateConfInProgress = TRUE; genericConfRequest.requestID = (U32)GENERIC_CONFIRM_ID_UF_RATE_CHANGE_IN_TX_DURATION_CHANGE; genericConfRequest.requestType = (U32)GENERIC_CONFIRM_CMD_REQUEST_OPEN; @@ -1575,31 +1578,35 @@ BOOL result = FALSE; CONFIRMATION_REQUEST_STATUS_T status = getConfirmationRequestStatus( GENERIC_CONFIRM_ID_UF_RATE_CHANGE_IN_TX_DURATION_CHANGE ); - if ( ( CONFIRMATION_REQUEST_STATUS_ACCEPTED == status ) || ( CONFIRMATION_REQUEST_STATUS_REJECTED == status ) ) + if ( TRUE == txDurationRequest.isUFRateConfInProgress ) { - if ( CONFIRMATION_REQUEST_STATUS_ACCEPTED == status ) + if ( ( CONFIRMATION_REQUEST_STATUS_ACCEPTED == status ) || ( CONFIRMATION_REQUEST_STATUS_REJECTED == status ) ) { - result = TRUE; - sendTreatmentLogEventData( TREATMENT_DURATION_CHANGE_EVENT, ( presTreatmentTimeSecs / SEC_PER_MIN ), txDurationRequest.requestedTxDurationMins ); - presTreatmentTimeSecs = txDurationRequest.requestedTxDurationMins * SEC_PER_MIN; - presUFRate = txDurationRequest.newUFRateMLPM; - setTreatmentParameterF32( TREATMENT_PARAM_UF_VOLUME, ( presMaxUFVolumeML / (F32)ML_PER_LITER ) ); - setTreatmentParameterU32( TREATMENT_PARAM_TREATMENT_DURATION, ( presTreatmentTimeSecs / SEC_PER_MIN ) ); - setDialysisDialInFlowAndUFRate( getTreatmentParameterU32( TREATMENT_PARAM_DIALYSATE_FLOW ), presMaxUFVolumeML, presUFRate ); - signalInitiatePressureStabilization( USE_NORMAL_STABILIZATION_PERIOD ); - } + if ( CONFIRMATION_REQUEST_STATUS_ACCEPTED == status ) + { + result = TRUE; + sendTreatmentLogEventData( TREATMENT_DURATION_CHANGE_EVENT, ( presTreatmentTimeSecs / SEC_PER_MIN ), txDurationRequest.requestedTxDurationMins ); + presTreatmentTimeSecs = txDurationRequest.requestedTxDurationMins * SEC_PER_MIN; + presUFRate = txDurationRequest.newUFRateMLPM; + setTreatmentParameterF32( TREATMENT_PARAM_UF_VOLUME, ( presMaxUFVolumeML / (F32)ML_PER_LITER ) ); + setTreatmentParameterU32( TREATMENT_PARAM_TREATMENT_DURATION, ( presTreatmentTimeSecs / SEC_PER_MIN ) ); + setDialysisDialInFlowAndUFRate( getTreatmentParameterU32( TREATMENT_PARAM_DIALYSATE_FLOW ), presMaxUFVolumeML, presUFRate ); + signalInitiatePressureStabilization( USE_NORMAL_STABILIZATION_PERIOD ); + } - // Regardless of accept or reject there is no reject reason. - sendChangeTreatmentDurationResponse( result, 0, ( presTreatmentTimeSecs / SEC_PER_MIN ), presMaxUFVolumeML ); - // Send new ranges for settings - treatmentParamsRangesBroadcastTimerCtr = getU32OverrideValue( &treatmentParamRangesPublishInterval ); - broadcastTreatmentSettingsRanges(); - // Send time/state data immediately for UI update - broadcastTreatmentTimeAndState(); + // Regardless of accept or reject there is no reject reason. + sendChangeTreatmentDurationResponse( result, 0, ( presTreatmentTimeSecs / SEC_PER_MIN ), presMaxUFVolumeML ); + // Send new ranges for settings + treatmentParamsRangesBroadcastTimerCtr = getU32OverrideValue( &treatmentParamRangesPublishInterval ); + broadcastTreatmentSettingsRanges(); + // Send time/state data immediately for UI update + broadcastTreatmentTimeAndState(); - // Done with treatment duration changes whether they were accepted or rejected. - txDurationRequest.newUFRateMLPM = 0.0F; - txDurationRequest.requestedTxDurationMins = 0; + // Done with treatment duration changes whether they were accepted or rejected. + txDurationRequest.newUFRateMLPM = 0.0F; + txDurationRequest.requestedTxDurationMins = 0; + txDurationRequest.isUFRateConfInProgress = FALSE; + } } }