Index: firmware/App/Modes/ModeTreatmentParams.c =================================================================== diff -u -r031ad982a60a1cb2a385aaaf7c7cb5e83130d798 -r13b0a5da20358c77ea1a415b723f5bd7382859f6 --- firmware/App/Modes/ModeTreatmentParams.c (.../ModeTreatmentParams.c) (revision 031ad982a60a1cb2a385aaaf7c7cb5e83130d798) +++ firmware/App/Modes/ModeTreatmentParams.c (.../ModeTreatmentParams.c) (revision 13b0a5da20358c77ea1a415b723f5bd7382859f6) @@ -147,6 +147,9 @@ // Request the concentrate pumps mixing ratios and the DG fill mode prepare time cmdRequestDGMixingRatios(); + // Get the institutional record upon transitioning to treatment parameters + getNVRecord2Driver( GET_INSTITUTIONAL_RECORD, (U08*)&hdInstitutionalRecord, sizeof( HD_INSTITUTIONAL_RECORD_T ), 0, ALARM_ID_NO_ALARM ); + return currentTreatmentParamsState; } @@ -604,7 +607,7 @@ * @brief * The isTreatmentParamInRange function determines whether a given treatment * parameter is in range. - * @details Inputs: treatParamsRanges[] + * @details Inputs: treatParamsRanges[], hdInstitutionalRecord * @details Outputs: none * @param param ID of parameter to check range for * @param value value of parameter to check range for @@ -616,27 +619,83 @@ if ( param < NUM_OF_TREATMENT_PARAMS ) { - if ( CRITICAL_DATA_TYPE_U32 == TREAT_PARAMS_PROPERTIES[ param ].dataType ) + switch( param ) { - if ( value.uInt >= TREAT_PARAMS_PROPERTIES[ param ].min.uInt && value.uInt <= TREAT_PARAMS_PROPERTIES[ param ].max.uInt ) - { - result = TRUE; - } + case TREATMENT_PARAM_BLOOD_FLOW: + result = ( ( value.uInt >= hdInstitutionalRecord.minBloodFlowMLPM ) && ( value.uInt <= hdInstitutionalRecord.maxBloodFlowMLPM ) ? TRUE : FALSE ); + break; + + case TREATMENT_PARAM_DIALYSATE_FLOW: + result = ( ( value.uInt >= hdInstitutionalRecord.minDialysateFlowMLPM ) && + ( value.uInt <= hdInstitutionalRecord.maxDialysateFlowMLPM ) ? TRUE : FALSE ); + break; + + case TREATMENT_PARAM_TREATMENT_DURATION: + result = ( ( value.uInt >= hdInstitutionalRecord.minTxDurationMIN ) && ( value.uInt <= hdInstitutionalRecord.maxTxDurationMIN ) ? TRUE : FALSE ); + break; + + case TREATMENT_PARAM_HEPARIN_PRE_STOP_TIME: + result = ( ( value.uInt >= hdInstitutionalRecord.minStopHeparinDispBeforeTxEndMIN ) && + ( value.uInt <= hdInstitutionalRecord.maxStopHeparinDispBeforeTxEndMIN ) ? TRUE : FALSE ); + break; + + case TREATMENT_PARAM_SALINE_BOLUS_VOLUME: + result = ( ( value.uInt >= hdInstitutionalRecord.minSalineBolusVolumeML ) && + ( value.uInt <= hdInstitutionalRecord.maxSalineBolusVolumeML ) ? TRUE : FALSE ); + break; + + case TREATMENT_PARAM_DIALYSATE_TEMPERATURE: + result = ( ( value.sFlt >= hdInstitutionalRecord.minDialysateTempC ) && + ( value.sFlt <= hdInstitutionalRecord.maxDialysateTempC ) ? TRUE : FALSE ); + break; + + case TREATMENT_PARAM_ART_PRES_LIMIT_WINDOW: + result = ( ( value.sInt >= hdInstitutionalRecord.minArtPressLimitWindowMMHG ) && + ( value.sInt <= hdInstitutionalRecord.maxArtPressLimitWindowMMHG ) ? TRUE : FALSE ); + break; + + case TREATMENT_PARAM_VEN_PRES_LIMIT_WINDOW: + result = ( ( value.sInt >= hdInstitutionalRecord.minVenPressLimitWindowMMHG ) && + ( value.sInt <= hdInstitutionalRecord.maxVenPressLimitWindowMMHG ) ? TRUE : FALSE ); + break; + + case TREATMENT_PARAM_VEN_PRES_LIMIT_ASYMMETRIC: + result = ( ( value.sInt >= hdInstitutionalRecord.minVenAsymPressLimitMMHG) && + ( value.sInt <= hdInstitutionalRecord.maxVenAsymPressLimitMMHG ) ? TRUE : FALSE ); + break; + + case TREATMENT_PARAM_UF_VOLUME: + result = ( ( value.sFlt >= hdInstitutionalRecord.minUFVolumeL ) && ( value.sFlt <= hdInstitutionalRecord.maxUFVolumeL ) ? TRUE : FALSE ); + break; + + case TREATMENT_PARAM_HEPARIN_DISPENSE_RATE: + result = ( ( value.sFlt >= hdInstitutionalRecord.minHeparinDispRateMLPM ) && + ( value.sFlt <= hdInstitutionalRecord.maxHeparinDispRateMLPM ) ? TRUE : FALSE ); + break; + + case TREATMENT_PARAM_HEPARIN_BOLUS_VOLUME: + result = ( ( value.sFlt >= hdInstitutionalRecord.minHeparinBolusVolumeML ) && + ( value.sFlt <= hdInstitutionalRecord.maxHeparinBolusVolumeML ) ? TRUE : FALSE ); + break; + + default: + // The treatment parameters that do not have any institutional record. + if ( CRITICAL_DATA_TYPE_U32 == TREAT_PARAMS_PROPERTIES[ param ].dataType ) + { + result = ( ( value.uInt >= TREAT_PARAMS_PROPERTIES[ param ].min.uInt ) && + ( value.uInt <= TREAT_PARAMS_PROPERTIES[ param ].max.uInt ) ? TRUE : FALSE ); + } + else if ( CRITICAL_DATA_TYPE_S32 == TREAT_PARAMS_PROPERTIES[ param ].dataType ) + { + result = ( ( value.sInt >= TREAT_PARAMS_PROPERTIES[ param ].min.sInt ) && + ( value.sInt <= TREAT_PARAMS_PROPERTIES[ param ].max.sInt ) ? TRUE : FALSE ); + } + else + { + result = ( ( value.sFlt >= TREAT_PARAMS_PROPERTIES[ param ].min.sFlt ) && + ( value.sFlt <= TREAT_PARAMS_PROPERTIES[ param ].max.sFlt ) ? TRUE : FALSE ); + } } - else if ( CRITICAL_DATA_TYPE_S32 == TREAT_PARAMS_PROPERTIES[ param ].dataType ) - { - if ( value.sInt >= TREAT_PARAMS_PROPERTIES[ param ].min.sInt && value.sInt <= TREAT_PARAMS_PROPERTIES[ param ].max.sInt ) - { - result = TRUE; - } - } - else - { - if ( value.sFlt >= TREAT_PARAMS_PROPERTIES[ param ].min.sFlt && value.sFlt <= TREAT_PARAMS_PROPERTIES[ param ].max.sFlt ) - { - result = TRUE; - } - } } else {