Index: firmware/App/Controllers/BalancingChamber.c =================================================================== diff -u -r4859dab16682b54caf2eac157443fc6e60f0cd70 -r79474fa07bac40bf70d821cd473967a8d45ef6d2 --- firmware/App/Controllers/BalancingChamber.c (.../BalancingChamber.c) (revision 4859dab16682b54caf2eac157443fc6e60f0cd70) +++ firmware/App/Controllers/BalancingChamber.c (.../BalancingChamber.c) (revision 79474fa07bac40bf70d821cd473967a8d45ef6d2) @@ -42,7 +42,7 @@ #define BAL_CHAMBER_DATA_PUBLISH_INTERVAL ( 250 / TASK_GENERAL_INTERVAL ) ///< Interval (ms/task time) at which the balancing chamber data published. #define BAL_CHAMBER_FILL_PRES_DROP_MS ( 200 / TASK_GENERAL_INTERVAL ) ///< Time (ms/tasktime) to confirm the balancing chamber filling started and corrosponding valves opened. #define BAL_CHAMBER_FILL_COMPLETE_MS ( 300 / TASK_GENERAL_INTERVAL ) ///< Time (ms/tasktime) to confirm the balancing chamber fill completed and pressure is within range -#define SPENT_FILL_COMPLETE_DIFF_PRES 5.0F ///< Difference in spent pressure that indicates fill is complete. +#define SPENT_FILL_COMPLETE_PRES 25.0F ///< Spent pressure that indicates fill is complete. #define SPENT_DIFF_COUNT_ZERO 0 ///< Zero count difference for spent side fill comparing target count #define SPENT_DIFF_COUNT_DEADBAND 1 ///< Stop changing D48 pump speed when fill difference reaches close to target count #define D48_SPEED_ADJUST_FACTOR 0.5F ///< D48 speed adjustment factor ( 50% of speed adjustment = 0.5) @@ -926,21 +926,14 @@ spentDialPressure = getFilteredPressure( D51_PRES ); // Check fresh dialysate pressure back in range to indicate fresh fill complete. - if ( getTestConfigStatus( TEST_CONFIG_DISABLE_BC_PRESSURE_ALARMS ) != TRUE ) + if ( ( freshDialPressure >= FRESH_DIAL_PRESSURE_MIN_PSIG ) && ( freshDialPressure <= FRESH_DIAL_PRESSURE_MAX_PSIG ) ) { - if ( ( freshDialPressure >= FRESH_DIAL_PRESSURE_MIN_PSIG ) && ( freshDialPressure <= FRESH_DIAL_PRESSURE_MAX_PSIG ) ) + if ( ++balChamberFillCompleteStablePressureCounter >= BAL_CHAMBER_FILL_COMPLETE_MS ) { - if ( ++balChamberFillCompleteStablePressureCounter >= BAL_CHAMBER_FILL_COMPLETE_MS ) - { - // stabilized pressure indicating fresh side fill is complete - isPressureStalbilizedDuringFill = TRUE; - } + // stabilized pressure indicating fresh side fill is complete + isPressureStalbilizedDuringFill = TRUE; } } - else - { - isPressureStalbilizedDuringFill = FALSE; - } // Spent side of balancing chamber fill is complete or not checkSpentFillComplete( spentDialPressure ); @@ -1095,21 +1088,14 @@ spentDialPressure = getFilteredPressure( D51_PRES ); // Check fresh and spent dialysate pressure back in range to indicate fill complete. - if ( getTestConfigStatus( TEST_CONFIG_DISABLE_BC_PRESSURE_ALARMS ) != TRUE ) + if ( ( freshDialPressure >= FRESH_DIAL_PRESSURE_MIN_PSIG ) && ( freshDialPressure <= FRESH_DIAL_PRESSURE_MAX_PSIG ) ) { - if ( ( freshDialPressure >= FRESH_DIAL_PRESSURE_MIN_PSIG ) && ( freshDialPressure <= FRESH_DIAL_PRESSURE_MAX_PSIG ) ) + if ( ++balChamberFillCompleteStablePressureCounter >= BAL_CHAMBER_FILL_COMPLETE_MS ) { - if ( ++balChamberFillCompleteStablePressureCounter >= BAL_CHAMBER_FILL_COMPLETE_MS ) - { - // stabilized pressure indicating fresh side fill is complete - isPressureStalbilizedDuringFill = TRUE; - } + // stabilized pressure indicating fresh side fill is complete + isPressureStalbilizedDuringFill = TRUE; } } - else - { - isPressureStalbilizedDuringFill = FALSE; - } // Spent side of balancing chamber fill is complete or not checkSpentFillComplete( spentDialPressure ); @@ -1170,24 +1156,25 @@ { // Move to next state when pressure is in range. state = BAL_CHAMBER_STATE1_FILL_START; - - // Trigger pressure drop alarm after first cycle of balancing chamber switching complete - if ( FALSE == isFirstCycleBCSwitchingCompleted ) - { - isFirstCycleBCSwitchingCompleted = TRUE; - } } } else { // Allow to proceed next state even though pressure is not stabilized. state = BAL_CHAMBER_STATE1_FILL_START; + } } else { state = BAL_CHAMBER_STATE1_FILL_START; } + + // Trigger pressure drop alarm after first cycle of balancing chamber switching complete + if ( FALSE == isFirstCycleBCSwitchingCompleted ) + { + isFirstCycleBCSwitchingCompleted = TRUE; + } } return state; @@ -1217,7 +1204,7 @@ // find the pressure difference for pressure spike detection diffInSpentPressure = fabs(spentDialPressure - lastPrevSpentDialPressure); - if ( ( diffInSpentPressure >= SPENT_FILL_COMPLETE_DIFF_PRES ) && ( isSpentFillComplete != TRUE ) ) + if ( ( spentDialPressure >= SPENT_FILL_COMPLETE_PRES ) && ( isSpentFillComplete != TRUE ) ) { // Check spent fill time against the balancing chamber closing period diffSpentFillCompleteCount = balChamberValveClosePeriod - currentBalChamberFillCounter;