Index: firmware/App/Modes/ModeTreatmentParams.c =================================================================== diff -u -r6419179374edcd65da462de84e8aeaefb7e20320 -r4aa16058db700e071748f89f91e6eb58ed348ea3 --- firmware/App/Modes/ModeTreatmentParams.c (.../ModeTreatmentParams.c) (revision 6419179374edcd65da462de84e8aeaefb7e20320) +++ firmware/App/Modes/ModeTreatmentParams.c (.../ModeTreatmentParams.c) (revision 4aa16058db700e071748f89f91e6eb58ed348ea3) @@ -397,13 +397,33 @@ REQUEST_REJECT_REASON_CODE_T rejReason = REQUEST_REJECT_REASON_NONE; F32 uFVolumeL = uFVolumeMl / (F32)ML_PER_LITER; - // Validate given UF volume TODO - check dependencies too + // Validate given UF volume accepted = setTreatmentParameterF32( TREATMENT_PARAM_UF_VOLUME, uFVolumeL ); if ( FALSE == accepted ) { rejReason = REQUEST_REJECT_REASON_UF_VOLUME_OUT_OF_RANGE; } + else + { + U32 treatmentDuration = getTreatmentParameterU32( TREATMENT_PARAM_TREATMENT_DURATION ); + if ( treatmentDuration > 0 ) + { + F32 uFRate = uFVolumeMl / (F32)treatmentDuration; + + if ( uFRate > MAX_UF_RATE_ML_MIN ) + { + accepted = FALSE; + rejReason = REQUEST_REJECT_REASON_UF_RATE_OUT_OF_RANGE; + } + } + else + { + accepted = FALSE; + rejReason = REQUEST_REJECT_REASON_TREATMENT_TIME_LESS_THAN_MINIMUM; + } + } + // Respond to set treatment parameters request message uFVolumeL = getTreatmentParameterF32( TREATMENT_PARAM_UF_VOLUME ); uFVolumeMl = uFVolumeL * (F32)ML_PER_LITER; @@ -445,7 +465,19 @@ // Respond to set treatment parameters request message sendTreatmentParamsResponse( paramsAreInvalid, &rejReasons[0] ); + // Send initial adjustable ranges to UI so UF volume range will be known when UF volume prompted for later + if ( TRUE == validTreatParamsReceived ) + { + U32 setTxDuration = stagedParams[ TREATMENT_PARAM_TREATMENT_DURATION ].uInt; + sendTreatmentParamsRangesToUI( treatmentParameters[ TREATMENT_PARAM_TREATMENT_DURATION ].minimum.uInt, + treatmentParameters[ TREATMENT_PARAM_TREATMENT_DURATION ].maximum.uInt, + 0.0, + MIN( (F32)setTxDuration * MAX_UF_RATE_ML_MIN, (F32)MAX_UF_VOLUME_ML ), + treatmentParameters[ TREATMENT_PARAM_DIALYSATE_FLOW ].minimum.uInt, + treatmentParameters[ TREATMENT_PARAM_DIALYSATE_FLOW ].maximum.uInt ); + } + return !paramsAreInvalid; }