Index: firmware/App/Controllers/BloodFlow.c =================================================================== diff -u -r2a3a47ca90ad19851a30c52f6999a56d5f578783 -r5e2d30dcbd02f5eb737aee7ec45c63d868daf252 --- firmware/App/Controllers/BloodFlow.c (.../BloodFlow.c) (revision 2a3a47ca90ad19851a30c52f6999a56d5f578783) +++ firmware/App/Controllers/BloodFlow.c (.../BloodFlow.c) (revision 5e2d30dcbd02f5eb737aee7ec45c63d868daf252) @@ -281,11 +281,17 @@ // Don't interrupt pump control unless rate or mode is changing if ( ( dirFlowRate != targetBloodFlowRate ) || ( mode != bloodPumpControlMode ) ) - { -#ifndef NO_PUMP_FLOW_LIMITS - // Verify flow rate - if ( flowRate <= MAX_SET_BLOOD_FLOW_RATE ) + { + BOOL byPassFlowLimit = FALSE; + +#ifndef _RELEASE_ + if ( SW_CONFIG_ENABLE_VALUE == getSoftwareConfigStatus( SW_CONFIG_DISABLE_PUMPS_FLOW_LIMITS ) ) + { + byPassFlowLimit = TRUE; + } #endif + // Verify flow rate of if the bypass flow limit has been enabled + if ( ( flowRate <= MAX_SET_BLOOD_FLOW_RATE ) || ( TRUE == byPassFlowLimit ) ) { resetBloodPumpRPMMovingAverage(); targetBloodFlowRate = dirFlowRate; Index: firmware/App/Controllers/DialInFlow.c =================================================================== diff -u -r29a2c3c7d7618489c0ada9f98e1d30226b455392 -r5e2d30dcbd02f5eb737aee7ec45c63d868daf252 --- firmware/App/Controllers/DialInFlow.c (.../DialInFlow.c) (revision 29a2c3c7d7618489c0ada9f98e1d30226b455392) +++ firmware/App/Controllers/DialInFlow.c (.../DialInFlow.c) (revision 5e2d30dcbd02f5eb737aee7ec45c63d868daf252) @@ -272,10 +272,17 @@ // Don't interrupt pump control unless rate or mode is changing if ( ( dirFlowRate != targetDialInFlowRate ) || ( mode != dialInPumpControlMode ) ) { -#ifndef NO_PUMP_FLOW_LIMITS + BOOL byPassFlowLimit = FALSE; + +#ifndef _RELEASE_ + if ( SW_CONFIG_ENABLE_VALUE == getSoftwareConfigStatus( SW_CONFIG_DISABLE_PUMPS_FLOW_LIMITS ) ) + { + byPassFlowLimit = TRUE; + } +#endif + // Verify flow rate - if ( flowRate <= MAX_DIAL_IN_FLOW_RATE ) -#endif + if ( ( flowRate <= MAX_DIAL_IN_FLOW_RATE ) || ( TRUE == byPassFlowLimit ) ) { resetDialInFlowMovingAverage(); targetDialInFlowRate = dirFlowRate; @@ -314,12 +321,17 @@ } result = TRUE; } -#ifndef NO_PUMP_FLOW_LIMITS + else // Requested flow rate too high - { - SET_ALARM_WITH_2_U32_DATA( ALARM_ID_HD_SOFTWARE_FAULT, SW_FAULT_ID_DIAL_IN_FLOW_SET_TOO_HIGH, flowRate ) - } + { +#ifndef _RELEASE_ + if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_PUMPS_FLOW_LIMITS ) != SW_CONFIG_ENABLE_VALUE ) #endif + { + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_HD_SOFTWARE_FAULT, SW_FAULT_ID_DIAL_IN_FLOW_SET_TOO_HIGH, flowRate ) + } + } + } } Index: firmware/App/Controllers/DialOutFlow.c =================================================================== diff -u -r29a2c3c7d7618489c0ada9f98e1d30226b455392 -r5e2d30dcbd02f5eb737aee7ec45c63d868daf252 --- firmware/App/Controllers/DialOutFlow.c (.../DialOutFlow.c) (revision 29a2c3c7d7618489c0ada9f98e1d30226b455392) +++ firmware/App/Controllers/DialOutFlow.c (.../DialOutFlow.c) (revision 5e2d30dcbd02f5eb737aee7ec45c63d868daf252) @@ -265,10 +265,17 @@ // Don't interrupt pump control unless rate or mode is changing if ( ( fabs( pwmDC - dialOutPumpPWMDutyCyclePct ) > NEARLY_ZERO ) || ( mode != dialOutPumpControlMode ) ) { -#ifndef NO_PUMP_FLOW_LIMITS - // Verify flow rate - if ( flowRate <= MAX_DIAL_OUT_FLOW_RATE ) + BOOL byPassFlowLimit = FALSE; + +#ifndef _RELEASE_ + if ( SW_CONFIG_ENABLE_VALUE == getSoftwareConfigStatus( SW_CONFIG_DISABLE_PUMPS_FLOW_LIMITS ) ) + { + byPassFlowLimit = TRUE; + } #endif + + // Verify flow rate + if ( ( flowRate <= MAX_DIAL_OUT_FLOW_RATE ) || ( TRUE == byPassFlowLimit ) ) { resetDialOutFlowMovingAverage(); dopControlSignal = FALSE; @@ -309,12 +316,15 @@ } result = TRUE; } -#ifndef NO_PUMP_FLOW_LIMITS else // Requested flow rate too high { - SET_ALARM_WITH_2_U32_DATA( ALARM_ID_HD_SOFTWARE_FAULT, SW_FAULT_ID_DIAL_OUT_FLOW_SET_TOO_HIGH, flowRate ) - } +#ifndef _RELEASE_ + if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_PUMPS_FLOW_LIMITS ) != SW_CONFIG_ENABLE_VALUE ) #endif + { + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_HD_SOFTWARE_FAULT, SW_FAULT_ID_DIAL_OUT_FLOW_SET_TOO_HIGH, flowRate ) + } + } } } Index: firmware/App/Controllers/PresOccl.c =================================================================== diff -u -r35396d8fe531506b5c89bb0003744782ea168b93 -r5e2d30dcbd02f5eb737aee7ec45c63d868daf252 --- firmware/App/Controllers/PresOccl.c (.../PresOccl.c) (revision 35396d8fe531506b5c89bb0003744782ea168b93) +++ firmware/App/Controllers/PresOccl.c (.../PresOccl.c) (revision 5e2d30dcbd02f5eb737aee7ec45c63d868daf252) @@ -191,6 +191,8 @@ initPersistentAlarm( ALARM_ID_HD_ARTERIAL_PRESSURE_OUT_OF_RANGE, 0, PRES_ALARM_PERSISTENCE ); initPersistentAlarm( ALARM_ID_HD_VENOUS_PRESSURE_OUT_OF_RANGE, 0, PRES_ALARM_PERSISTENCE ); initPersistentAlarm( ALARM_ID_HD_BP_OCCLUSION_OUT_OF_RANGE, 0, PRES_ALARM_PERSISTENCE ); + initPersistentAlarm( ALARM_ID_ARTERIAL_PRESSURE_SENSOR_FAULT, 0, PRES_ALARM_PERSISTENCE ); + initPersistentAlarm( ALARM_ID_VENOUS_PRESSURE_SENSOR_FAULT, 0, PRES_ALARM_PERSISTENCE ); lastArterialPressureReadCtr = 0; lastVenousPressureReadCtr = 0; @@ -388,6 +390,10 @@ U08 artPresAlarm = 0; U08 artPresStatus = 0; F32 venPresPSI = 0.0; + U16 fpgaVenPres = getFPGAVenousPressure(); + U16 venPres = fpgaVenPres & 0x3FFF; // 14-bit data + U08 venPresStatus = (U08)( fpgaVenPres >> SHIFT_14_BITS ); // High 2 bits is status code for venous pressure + U08 venReadCtr = getFPGAVenousPressureReadCounter(); if ( SW_CONFIG_ENABLE_VALUE == getSoftwareConfigStatus( SW_CONFIG_ENABLE_DVT_ARTERIAL_PRESSURE_SENSOR ) ) { @@ -404,16 +410,11 @@ artPresAlarm = (U08)( fpgaArtPres >> SHIFT_24_BITS ); // High byte is alarm code for arterial pressure } - U16 fpgaVenPres = getFPGAVenousPressure(); - U16 venPres = fpgaVenPres & 0x3FFF; // 14-bit data - U08 venPresStatus = (U08)( fpgaVenPres >> SHIFT_14_BITS ); // High 2 bits is status code for venous pressure - U08 venReadCtr = getFPGAVenousPressureReadCounter(); - - if ( ARTERIAL_PRESSURE_NORMAL_OP == artPresStatus ) - { #ifndef _RELEASE_ - if ( SW_CONFIG_ENABLE_VALUE == getSoftwareConfigStatus( SW_CONFIG_ENABLE_DVT_ARTERIAL_PRESSURE_SENSOR ) ) + if ( SW_CONFIG_ENABLE_VALUE == getSoftwareConfigStatus( SW_CONFIG_ENABLE_DVT_ARTERIAL_PRESSURE_SENSOR ) ) #endif + { + if ( ARTERIAL_PRESSURE_NORMAL_OP == artPresStatus ) { U08 artReadCtr = getFPGADVTArterialPressureReadCounter(); @@ -429,6 +430,14 @@ (ARTERIAL_PRESSURE_MAX_PSI - ARTERIAL_PRESSURE_MIN_PSI) / (F32)ARTERIAL_PRESSURE_SCALE ) + ARTERIAL_PRESSURE_MIN_PSI; arterialPressure.data = arterialPressure.data * PSI_TO_MMHG; } + else if ( TRUE == isPersistentAlarmTriggered( ALARM_ID_ARTERIAL_PRESSURE_SENSOR_FAULT, TRUE ) ) + { + activateAlarmNoData( ALARM_ID_ARTERIAL_PRESSURE_SENSOR_FAULT ); + } + else + { + resetPersistentAlarmTimer( ALARM_ID_ARTERIAL_PRESSURE_SENSOR_FAULT ); + } } // Convert arterial pressure to mmHg if no fault else if ( 0 == artPresAlarm ) @@ -469,23 +478,28 @@ lastVenousPressureReadCtr = venReadCtr; // Convert venous pressure to PSI and then mmHg - venPresPSI = ( (F32)(venPres - VENOUS_PRESSURE_OFFSET) * (VENOUS_PRESSURE_MAX_PSI - VENOUS_PRESSURE_MIN_PSI) / (F32)VENOUS_PRESSURE_SCALE ) + VENOUS_PRESSURE_MIN_PSI; + venPresPSI = ( (F32)(venPres - VENOUS_PRESSURE_OFFSET) * (VENOUS_PRESSURE_MAX_PSI - VENOUS_PRESSURE_MIN_PSI) / (F32)VENOUS_PRESSURE_SCALE ) + + VENOUS_PRESSURE_MIN_PSI; // Convert venous pressure from PSI to mmHg if sensor status is normal if ( VENOUS_PRESSURE_NORMAL_OP == venPresStatus ) { venousPressure.data = venPresPSI * PSI_TO_MMHG; } // If venous pressure sensor status is not normal, fault - else - { #ifndef _RELEASE_ - if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_PRESSURE_CHECKS ) != SW_CONFIG_ENABLE_VALUE ) + else if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_PRESSURE_CHECKS ) != SW_CONFIG_ENABLE_VALUE ) #endif + { + if ( TRUE == isPersistentAlarmTriggered( ALARM_ID_VENOUS_PRESSURE_SENSOR_FAULT, TRUE ) ) { -// SET_ALARM_WITH_1_U32_DATA( ALARM_ID_VENOUS_PRESSURE_SENSOR_FAULT, (U32)venPresStatus ) // TODO - persistence? YES, need persistence - getting a stale data status. OR maybe speed up ADC in FPGA. + SET_ALARM_WITH_1_U32_DATA( ALARM_ID_VENOUS_PRESSURE_SENSOR_FAULT, (U32)venPresStatus ) } } + else + { + resetPersistentAlarmTimer( ALARM_ID_VENOUS_PRESSURE_SENSOR_FAULT ); + } // Filter inline pressure readings filterInlinePressureReadings( getMeasuredArterialPressure(), getMeasuredVenousPressure() ); @@ -524,8 +538,8 @@ if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_PRESSURE_CHECKS ) != SW_CONFIG_ENABLE_VALUE ) { // Record occlusion read and error counters for next time around - lastBPOcclReadCtr = bpReadCtr; - lastBPErrorCtr = bpErrorCtr; + lastBPOcclReadCtr = bpReadCtr; + lastBPErrorCtr = bpErrorCtr; } } Index: firmware/App/HDCommon.h =================================================================== diff -u -r2a3a47ca90ad19851a30c52f6999a56d5f578783 -r5e2d30dcbd02f5eb737aee7ec45c63d868daf252 --- firmware/App/HDCommon.h (.../HDCommon.h) (revision 2a3a47ca90ad19851a30c52f6999a56d5f578783) +++ firmware/App/HDCommon.h (.../HDCommon.h) (revision 5e2d30dcbd02f5eb737aee7ec45c63d868daf252) @@ -44,17 +44,11 @@ // #define EMC_TEST_BUILD 1 // EMC test build - HD/DG run separately but connected, HD pumps toggle on/off w/ stop button #define DISABLE_WD_AND_SFTY_POST_TESTS 1 // Disable watchdog and safety shutdown POST tests #define DISABLE_UI_POST_TEST 1 // Disable the UI POST - - // TODO convert the new configuration way -// #define RUN_BP_OPEN_LOOP 1 // Run blood pump in open loop mode // Implement -// #define RUN_DPI_OPEN_LOOP 1 // Run dialysate inlet pump in open loop mode // Implement // #define PBA_ESTIMATION 1 // Estimate arterial pressure rather than look at PBA sensor // Part of DVT build switch -// #define USE_PBO_AS_PBA 1 // PBo readings used for PBA, PBo replaced with fixed pressure (100 mmHg) // Not needed + #define SKIP_CAL_CHECK 1 // Implement TODO stays as a build switch until the calibration structure is updated -// #define ALLOW_1_MIN_TREATMENT_DURATION 1 // Allow user to change treatment duration to as low as 1 minute // Implement -// #define NO_PUMP_FLOW_LIMITS 1 // Allow any commanded flow rate for peristaltic pumps // Implement #include #include Index: firmware/App/Modes/Dialysis.c =================================================================== diff -u -r2a3a47ca90ad19851a30c52f6999a56d5f578783 -r5e2d30dcbd02f5eb737aee7ec45c63d868daf252 --- firmware/App/Modes/Dialysis.c (.../Dialysis.c) (revision 2a3a47ca90ad19851a30c52f6999a56d5f578783) +++ firmware/App/Modes/Dialysis.c (.../Dialysis.c) (revision 5e2d30dcbd02f5eb737aee7ec45c63d868daf252) @@ -184,6 +184,8 @@ *************************************************************************/ void transitionToDialysis( void ) { + PUMP_CONTROL_MODE_T mode = PUMP_CONTROL_MODE_CLOSED_LOOP; + // Set last UF timestamp so UF ref is resumed from this time lastUFTimeStamp = getMSTimerCount(); // Send dialysate outlet pump latest UF volumes @@ -200,21 +202,25 @@ setValvePosition( VBA, VALVE_POSITION_B_OPEN ); setValvePosition( VBV, VALVE_POSITION_B_OPEN ); // Restart pumps -#ifndef RUN_PUMPS_OPEN_LOOP -#ifndef RUN_BP_OPEN_LOOP - setBloodPumpTargetFlowRate( setBloodFlowRate, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_CLOSED_LOOP ); -#else - setBloodPumpTargetFlowRate( setBloodFlowRate, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_OPEN_LOOP ); + +#ifndef _RELEASE_ + if ( SW_CONFIG_ENABLE_VALUE == getSoftwareConfigStatus( SW_CONFIG_ENABLE_BLOOD_PUMP_OPEN_LOOP ) ) + { + mode = PUMP_CONTROL_MODE_OPEN_LOOP; + } #endif -#ifndef RUN_DPI_OPEN_LOOP - setDialInPumpTargetFlowRate( setDialysateFlowRate, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_CLOSED_LOOP ); -#else - setDialInPumpTargetFlowRate( setDialysateFlowRate, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_OPEN_LOOP ); + + setBloodPumpTargetFlowRate( setBloodFlowRate, MOTOR_DIR_FORWARD, mode ); + +#ifndef _RELEASE_ + if ( SW_CONFIG_ENABLE_VALUE == getSoftwareConfigStatus( SW_CONFIG_ENABLE_DIALYSATE_INLET_PUMP_OPEN_LOOP ) ) + { + mode = PUMP_CONTROL_MODE_OPEN_LOOP; + } #endif -#else - setBloodPumpTargetFlowRate( setBloodFlowRate, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_OPEN_LOOP ); - setDialInPumpTargetFlowRate( setDialysateFlowRate, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_OPEN_LOOP ); -#endif + + setDialInPumpTargetFlowRate( setDialysateFlowRate, MOTOR_DIR_FORWARD, mode ); + setDialOutPumpTargetRate( setDialysateFlowRate + (S32)setUFRate, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_CLOSED_LOOP ); // Start Heparin pump as appropriate startHeparinPump(); @@ -295,21 +301,24 @@ // Make rate changes in real time if currently performing dialysis. if ( ( TREATMENT_DIALYSIS_STATE == getTreatmentState() ) && ( getDialysisState() != DIALYSIS_SALINE_BOLUS_STATE ) ) { -#ifndef RUN_PUMPS_OPEN_LOOP -#ifndef RUN_BP_OPEN_LOOP - setBloodPumpTargetFlowRate( setBloodFlowRate, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_CLOSED_LOOP ); -#else - setBloodPumpTargetFlowRate( setBloodFlowRate, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_OPEN_LOOP ); + PUMP_CONTROL_MODE_T mode = PUMP_CONTROL_MODE_CLOSED_LOOP; + +#ifndef _RELEASE_ + if ( SW_CONFIG_ENABLE_VALUE == getSoftwareConfigStatus( SW_CONFIG_ENABLE_BLOOD_PUMP_OPEN_LOOP ) ) + { + mode = PUMP_CONTROL_MODE_OPEN_LOOP; + } #endif -#ifndef RUN_DPI_OPEN_LOOP - setDialInPumpTargetFlowRate( setDialysateFlowRate, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_CLOSED_LOOP ); -#else - setDialInPumpTargetFlowRate( setDialysateFlowRate, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_OPEN_LOOP ); + setBloodPumpTargetFlowRate( setBloodFlowRate, MOTOR_DIR_FORWARD, mode ); + +#ifndef _RELEASE_ + if ( SW_CONFIG_ENABLE_VALUE == getSoftwareConfigStatus( SW_CONFIG_ENABLE_DIALYSATE_INLET_PUMP_OPEN_LOOP ) ) + { + mode = PUMP_CONTROL_MODE_OPEN_LOOP; + } #endif -#else - setBloodPumpTargetFlowRate( setBloodFlowRate, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_OPEN_LOOP ); - setDialInPumpTargetFlowRate( setDialysateFlowRate, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_OPEN_LOOP ); -#endif + setDialInPumpTargetFlowRate( setDialysateFlowRate, MOTOR_DIR_FORWARD, mode ); + setDialOutPumpTargetRate( setDialysateFlowRate + (S32)setUFRate, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_CLOSED_LOOP ); } } Index: firmware/App/Modes/ModeTreatment.c =================================================================== diff -u -r61716bc97ecca8af1ec560333844a8cf602eccb0 -r5e2d30dcbd02f5eb737aee7ec45c63d868daf252 --- firmware/App/Modes/ModeTreatment.c (.../ModeTreatment.c) (revision 61716bc97ecca8af1ec560333844a8cf602eccb0) +++ firmware/App/Modes/ModeTreatment.c (.../ModeTreatment.c) (revision 5e2d30dcbd02f5eb737aee7ec45c63d868daf252) @@ -46,11 +46,9 @@ // ********** private definitions ********** #define MAX_TREATMENT_TIME_MINUTES ( 8 * MIN_PER_HOUR ) ///< Maximum treatment time (in minutes). -#ifndef ALLOW_1_MIN_TREATMENT_DURATION + #define MIN_TREATMENT_TIME_MINUTES ( 1 * MIN_PER_HOUR ) ///< Minimum treatment time (in minutes). -#else -#define MIN_TREATMENT_TIME_MINUTES ( 1 ) ///< Minimum treatment time (in minutes). -#endif + #define MAX_DIALYSATE_VOLUME_ML ( 150 * ML_PER_LITER ) ///< Maximum dialysate volume (in mL). #define USER_CONFIRM_CHANGE_TIMEOUT_MS ( 60 * MS_PER_SECOND ) ///< Require user to confirm UF volume change within this time. @@ -135,6 +133,7 @@ static void resetAlarmSignalFlags( void ); static void broadcastTreatmentSettingsRanges( void ); static void broadcastTreatmentPeriodicData(); +static U32 getTreatmentTimeInMinutes( void ); static TREATMENT_STATE_T handleTreatmentStartState( void ); static TREATMENT_STATE_T handleTreatmentBloodPrimeState( void ); static TREATMENT_STATE_T handleTreatmentDialysisState( void ); @@ -975,7 +974,7 @@ // Check if we are in an appropriate treatment state for settings adjustment if ( ( MODE_TREA == currMode ) && ( currentTreatmentState > TREATMENT_START_STATE ) && ( currentTreatmentState < TREATMENT_END_STATE ) && - ( CALC_ELAPSED_TREAT_TIME_IN_MIN() < treatmentTime ) && ( treatmentTime >= MIN_TREATMENT_TIME_MINUTES ) ) + ( CALC_ELAPSED_TREAT_TIME_IN_MIN() < treatmentTime ) && ( treatmentTime >= getTreatmentTimeInMinutes() ) ) { F32 uFVolume; U32 dialVolume = getTreatmentParameterU32( TREATMENT_PARAM_DIALYSATE_FLOW ) * treatmentTime; // In mL @@ -1019,7 +1018,7 @@ { rejectReason = REQUEST_REJECT_REASON_INVALID_TREATMENT_STATE; } - else if ( treatmentTime < MIN_TREATMENT_TIME_MINUTES ) + else if ( treatmentTime < getTreatmentTimeInMinutes() ) { rejectReason = REQUEST_REJECT_REASON_TREATMENT_TIME_LESS_THAN_MINIMUM; } @@ -1097,7 +1096,7 @@ pendingUFRateChange = 0.0; } // Verify treatment duration change would be valid (leave zero if not valid - UI will disable option) - if ( ( trtTime <= MAX_TREATMENT_TIME_MINUTES ) && ( trtTime >= MIN_TREATMENT_TIME_MINUTES ) && + if ( ( trtTime <= MAX_TREATMENT_TIME_MINUTES ) && ( trtTime >= getTreatmentTimeInMinutes() ) && ( dialVolume <= MAX_DIALYSATE_VOLUME_ML ) ) { result = TRUE; @@ -1449,7 +1448,7 @@ // Compute minimum treatment duration U32 presTime = ( presTreatmentTimeSecs / SEC_PER_MIN ); U32 elapseTime = CALC_ELAPSED_TREAT_TIME_IN_MIN(); - U32 minTime = MAX( (elapseTime + 2), MIN_TREATMENT_TIME_MINUTES ); // Treatment duration cannot be < 1 hour. add two minutes to cover rounding and ensure it is valid for next minute + U32 minTime = MAX( (elapseTime + 2), getTreatmentTimeInMinutes() ); // Treatment duration cannot be < 1 hour. add two minutes to cover rounding and ensure it is valid for next minute // Compute maximum treatment duration (from both UF and dialysate volume perspectives) U32 maxTimeRem = ( MAX_UF_VOLUME_ML - (U32)getUltrafiltrationReferenceVolume() ) / ( presUFRate > 0.0 ? (U32)presUFRate : 1 ); U32 maxTime1 = minTime + maxTimeRem; @@ -1529,7 +1528,31 @@ } } +/*********************************************************************//** + * @brief + * The getTreatmentTimeInMinutes function returns the treatment time in minutes. + * @details Inputs: none + * @details Outputs: none + * @return treatment time in minutes + *************************************************************************/ +static U32 getTreatmentTimeInMinutes( void ) +{ + // Assuming a 1 minute treatment + // NOTE: no # define for the 1 minute treatment time since this is only used for testing + U32 treatmentTime = 1; +#ifndef _RELEASE_ + // Check if the 1 minute treatment software configuration has not been enabled + if ( getSoftwareConfigStatus( SW_CONFIG_ENABLE_1_MIN_TREATMENT ) != SW_CONFIG_ENABLE_VALUE ) +#endif + { + treatmentTime = MIN_TREATMENT_TIME_MINUTES; + } + + return treatmentTime; +} + + /************************************************************************* * TEST SUPPORT FUNCTIONS *************************************************************************/