Index: firmware/App/Modes/ModeTreatmentParams.c =================================================================== diff -u -rce3e0696642099164fa482c864509c67ce65579b -r5c1a2839872522daf6c69090afdb2bb2dff68080 --- firmware/App/Modes/ModeTreatmentParams.c (.../ModeTreatmentParams.c) (revision ce3e0696642099164fa482c864509c67ce65579b) +++ firmware/App/Modes/ModeTreatmentParams.c (.../ModeTreatmentParams.c) (revision 5c1a2839872522daf6c69090afdb2bb2dff68080) @@ -393,11 +393,27 @@ * @details Inputs: none * @details Outputs: * @param params payload record from treatment parameters message received from UI - * @return TRUE if received treatment parameters are valid, FALSE if not + * @return TRUE if received UF volume parameter is valid, FALSE if not *************************************************************************/ -BOOL validateAndSetUFVolume( F32 uFVolumeMl )// user provided ultrafiltration volume to be set and validated +BOOL validateAndSetUFVolume( F32 uFVolumeMl ) { + BOOL accepted = FALSE; + 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 + accepted = setTreatmentParameterF32( TREATMENT_PARAM_UF_VOLUME, uFVolumeL ); + if ( FALSE == accepted ) + { + rejReason = REQUEST_REJECT_REASON_UF_VOLUME_OUT_OF_RANGE; + } + + // respond to set treatment parameters request message + uFVolumeL = getTreatmentParameterF32( TREATMENT_PARAM_UF_VOLUME ); + uFVolumeMl = uFVolumeL * (F32)ML_PER_LITER; + sendUFVolumeSetResponseMsg( accepted, rejReason, uFVolumeMl ); + + return accepted; } /*********************************************************************//**