Index: firmware/App/Modes/ModeTreatmentParams.c =================================================================== diff -u -r2ec63f115c0c07825fe21899058872d6ca70746b -r0b8564de1aeab98438bd2e4e1b666d77b4d506df --- firmware/App/Modes/ModeTreatmentParams.c (.../ModeTreatmentParams.c) (revision 2ec63f115c0c07825fe21899058872d6ca70746b) +++ firmware/App/Modes/ModeTreatmentParams.c (.../ModeTreatmentParams.c) (revision 0b8564de1aeab98438bd2e4e1b666d77b4d506df) @@ -1058,8 +1058,12 @@ result &= ( ( nvInstRcrd->minRORejectionRatioPCT <= INSTIT_MIN_RO_REJECTION_RATIO_MAX_PCT ) ? TRUE : FALSE ); result &= ( ( nvInstRcrd->minInletWaterCondAlarmLimitUSPCM >= 0.0F ) && ( nvInstRcrd->minInletWaterCondAlarmLimitUSPCM <= INSTIT_MAX_INLET_WATER_COND_ALARM_USPCM ) ? TRUE : FALSE ); - result &= ( ( nvInstRcrd->minVenPressWideLimitWindowMMHG <= INSTIT_MAX_MIN_VEN_PRES_WIDE_LIMIT_MMHG ) && - ( nvInstRcrd->minVenPressWideLimitWindowMMHG >= INSTIT_MIN_MIN_VEN_PRES_WIDE_LIMIT_MMHG ) ? TRUE : FALSE ); + result &= ( ( nvInstRcrd->minVenPressWideLimitWindowMMHG <= INSTIT_MAX_MIN_VEN_PRES_WIDE_LIMIT_MMHG ) && + ( nvInstRcrd->minVenPressWideLimitWindowMMHG >= INSTIT_MIN_MIN_VEN_PRES_WIDE_LIMIT_MMHG ) ? TRUE : FALSE ); + // NOTE: the treatment end blood flow rate in mL/min can be either 0 or 100 <= blood flow mL/min <= 500. + result &= ( ( ( nvInstRcrd->txEndBloodFlowMLPM == 0 ) || + ( nvInstRcrd->txEndBloodFlowMLPM >= TREAT_PARAMS_PROPERTIES[ TREATMENT_PARAM_BLOOD_FLOW ].min.uInt ) ) && + ( nvInstRcrd->txEndBloodFlowMLPM <= TREAT_PARAMS_PROPERTIES[ TREATMENT_PARAM_BLOOD_FLOW ].max.uInt ) ? TRUE : FALSE ); return result; } @@ -1071,17 +1075,29 @@ * treatment parameters. * @details Inputs: none * @details Outputs: hdInstitutionalRecord - * @param nvInstitutionalRecord pointer to the newly received institutional record - * in the non-volatile data management. - * @return none + * @return Institutional record treatment end blood flow in mL/min *************************************************************************/ void setNVInstitutionalRecordToTxParamsRecord( HD_INSTITUTIONAL_RECORD_T* nvInstitutionalRecord ) { - memcpy( &hdInstitutionalRecord, nvInstitutionalRecord, sizeof(HD_INSTITUTIONAL_RECORD_T) ); + memcpy( &hdInstitutionalRecord, nvInstitutionalRecord, sizeof( HD_INSTITUTIONAL_RECORD_T ) ); } /*********************************************************************//** * @brief + * The getNVInstitutionalRecordTxEndBloodFlowMLPM function returns the institutional + * record's treatment end blood flow in mL/min. + * @details Inputs: hdInstitutionalRecord + * @details Outputs: none + * @return none + *************************************************************************/ +U32 getNVInstitutionalRecordTxEndBloodFlowMLPM( void ) +{ + return hdInstitutionalRecord.txEndBloodFlowMLPM; + +} + +/*********************************************************************//** + * @brief * The extractTreatmentParamsFromPayload function extracts the individual * treatment parameters received from the UI into a staging array where * they will be validated and stay until user confirms them. Index: firmware/App/Modes/ModeTreatmentParams.h =================================================================== diff -u -r1a36e9bd718b40ceaee21dd12eca2da353828e30 -r0b8564de1aeab98438bd2e4e1b666d77b4d506df --- firmware/App/Modes/ModeTreatmentParams.h (.../ModeTreatmentParams.h) (revision 1a36e9bd718b40ceaee21dd12eca2da353828e30) +++ firmware/App/Modes/ModeTreatmentParams.h (.../ModeTreatmentParams.h) (revision 0b8564de1aeab98438bd2e4e1b666d77b4d506df) @@ -79,7 +79,6 @@ U32 accepted; ///< Accepted or rejected based on if critical data has been set. TREATMENT_PARAMS_DATA_PAYLOAD_T treatment_parameters; ///< Record structure of treatment parameters F32 uFVolume_L; ///< Current ultrafiltration volume (in L). - } CURRENT_TREATMENT_PARAMS_DATA_PAYLOAD_T; @@ -118,6 +117,7 @@ BOOL isNVInstitutionalRecordInRange( HD_INSTITUTIONAL_RECORD_T* nvInstRcrd ); // Is non-volatile memory institutional record in range void setNVInstitutionalRecordToTxParamsRecord( HD_INSTITUTIONAL_RECORD_T* nvInstitutionalRecord ); // Set the recently received institution record from NV to local tx parameters +U32 getNVInstitutionalRecordTxEndBloodFlowMLPM( void ); F32 getUltrafiltrationVolumeOriginal( void ); // Get the original ultrafiltration volume, set in pre-treatment mode by user. F32 getUltrafiltrationRateOriginal( void ); // Get/calculate the original ultrafiltration rate, by ultrafiltration volume and treatment duration set in pre-treatment mode by user. Index: firmware/App/Modes/TreatmentEnd.c =================================================================== diff -u -r48fda88cb7d8607181efb80f98deaaab1b343a92 -r0b8564de1aeab98438bd2e4e1b666d77b4d506df --- firmware/App/Modes/TreatmentEnd.c (.../TreatmentEnd.c) (revision 48fda88cb7d8607181efb80f98deaaab1b343a92) +++ firmware/App/Modes/TreatmentEnd.c (.../TreatmentEnd.c) (revision 0b8564de1aeab98438bd2e4e1b666d77b4d506df) @@ -20,6 +20,7 @@ #include "DialInFlow.h" #include "DialOutFlow.h" #include "ModeTreatment.h" +#include "ModeTreatmentParams.h" #include "OperationModes.h" #include "SystemCommMessages.h" #include "TaskGeneral.h" @@ -36,8 +37,6 @@ /// Interval at which treatment end progress is to be published to UI. #define TREATMENT_END_DATA_PUBLISH_INTERVAL ( MS_PER_SECOND / TASK_GENERAL_INTERVAL ) -/// Target flow rate for blood while waiting for user to initiate final rinseback. -#define TX_END_BP_FLOW_RATE_ML_MIN 150 /// Max time to wait for user to initiate final rinseback. static const U32 TX_END_TIMEOUT_MS = ( ( 10 * 60 * MS_PER_SECOND ) / TASK_GENERAL_INTERVAL ); @@ -55,6 +54,7 @@ static BOOL txEndDrainCmdSent; ///< Flag indicates DG Drain command has been sent. static U32 treatmentEndPublishTimerCtr; ///< Timer counter for determining interval for treatment end status to be published. static BOOL airTrapFillInProgress; ///< Flag indicates an air trap fill is in progress. +static U32 txEndTargetBloodFlowMLPM; ///< Treatment end target blood flow in mL/min. // ********** private function prototypes ********** @@ -86,6 +86,12 @@ txEndDrainCmdSent = FALSE; resetTreatmentEndFlags(); airTrapFillInProgress = FALSE; // set to false initially - so keep after call to reset function + txEndTargetBloodFlowMLPM = getTreatmentParameterU32( TREATMENT_PARAM_BLOOD_FLOW ); + + if ( getNVInstitutionalRecordTxEndBloodFlowMLPM() != 0 ) + { + txEndTargetBloodFlowMLPM = getNVInstitutionalRecordTxEndBloodFlowMLPM(); + } } /*********************************************************************//** @@ -152,7 +158,7 @@ setValvePosition( VBA, VALVE_POSITION_B_OPEN ); setValvePosition( VBV, VALVE_POSITION_B_OPEN ); // Start blood pump at Tx End slow flow rate - setBloodPumpTargetFlowRate( TX_END_BP_FLOW_RATE_ML_MIN, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_CLOSED_LOOP ); + setBloodPumpTargetFlowRate( txEndTargetBloodFlowMLPM, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_CLOSED_LOOP ); bloodSittingTimerCtr = 0; // Continue air trap leveling control startAirTrapControl(); @@ -288,7 +294,7 @@ // re-open VBV after fill setValvePosition( VBV, VALVE_POSITION_B_OPEN ); // restore BP to Tx End blood flow rate - setBloodPumpTargetFlowRate( TX_END_BP_FLOW_RATE_ML_MIN, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_CLOSED_LOOP ); + setBloodPumpTargetFlowRate( txEndTargetBloodFlowMLPM, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_CLOSED_LOOP ); } return result; Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r1a36e9bd718b40ceaee21dd12eca2da353828e30 -r0b8564de1aeab98438bd2e4e1b666d77b4d506df --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 1a36e9bd718b40ceaee21dd12eca2da353828e30) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 0b8564de1aeab98438bd2e4e1b666d77b4d506df) @@ -96,6 +96,7 @@ U32 minRORejectionRatioPCT; ///< Min RO rejection ratio in percent. F32 minInletWaterCondAlarmLimitUSPCM; ///< Min inlet water conductivity alarm limit in uS/cm. S32 minVenPressWideLimitWindowMMHG; ///< Min venous pressure wide window limit in mmHg. + U32 endTxBloodFlowMLPM; ///< End treatment blood flow in mL/min. } HD_INSTITUTIONAL_LOCAL_RECORD_T; typedef struct