Index: firmware/App/Controllers/BalancingChamber.c =================================================================== diff -u -r0e2bb0e29903be865ff96ba88b5f165bf0e2ff3b -rc4e1d97e73dd863ddffe895833d209e172b5ae4a --- firmware/App/Controllers/BalancingChamber.c (.../BalancingChamber.c) (revision 0e2bb0e29903be865ff96ba88b5f165bf0e2ff3b) +++ firmware/App/Controllers/BalancingChamber.c (.../BalancingChamber.c) (revision c4e1d97e73dd863ddffe895833d209e172b5ae4a) @@ -113,10 +113,10 @@ static BAL_CHAMBER_EXEC_STATE_T handleBalChamberState1FillStart( void ); static BAL_CHAMBER_EXEC_STATE_T handleBalChamberConcentrateControl(void); -static BAL_CHAMBER_EXEC_STATE_T handleBalChamberState1ValvesClose( void ); +static BAL_CHAMBER_EXEC_STATE_T handleBalChamberState1FillDetectComplete( void ); static BAL_CHAMBER_EXEC_STATE_T handleBalChamberState1FillEnd(void); static BAL_CHAMBER_EXEC_STATE_T handleBalChamberState2FillStart( void ); -static BAL_CHAMBER_EXEC_STATE_T handleBalChamberState2ValvesClose( void ); +static BAL_CHAMBER_EXEC_STATE_T handleBalChamberState2FillDetectComplete( void ); static BAL_CHAMBER_EXEC_STATE_T handleBalChamberState2FillEnd(void); static BAL_CHAMBER_EXEC_STATE_T handleBalChamberStateIdle( void ); static void publishBalChamberData( void ); @@ -299,8 +299,8 @@ * @brief * The scheduleFirstCycleRelaxAfterQdApply function configures how many BC * switches still use first-cycle relaxations after a Qd timing update. - * @details One full BC cycle is two switches require two - * valve-close segments under the new timing before clearing relaxations. + * @details \b Inputs: none + * @details \b Outputs: bcSwitchingBasedOnClosedPeriodCounter * @return none *************************************************************************/ static void scheduleFirstCycleRelaxAfterQdApply( void ) @@ -384,8 +384,8 @@ balChamberExecState = handleBalChamberConcentrateControl(); break; - case BAL_CHAMBER_STATE1_VALVES_CLOSE: - balChamberExecState = handleBalChamberState1ValvesClose(); + case BAL_CHAMBER_STATE1_FILL_DETECT_COMPLETE: + balChamberExecState = handleBalChamberState1FillDetectComplete(); break; case BAL_CHAMBER_STATE1_FILL_END: @@ -400,8 +400,8 @@ balChamberExecState = handleBalChamberConcentrateControl(); break; - case BAL_CHAMBER_STATE2_VALVES_CLOSE: - balChamberExecState = handleBalChamberState2ValvesClose(); + case BAL_CHAMBER_STATE2_FILL_DETECT_COMPLETE: + balChamberExecState = handleBalChamberState2FillDetectComplete(); break; case BAL_CHAMBER_STATE2_FILL_END: @@ -723,12 +723,12 @@ { // Low-Qd spent slope: baseline = spent pressure on last dosing tick (this task period) before VALVES_CLOSE. prevSpentDialPressure = spentDialPressure; - state = BAL_CHAMBER_STATE1_VALVES_CLOSE; + state = BAL_CHAMBER_STATE1_FILL_DETECT_COMPLETE; } else { prevSpentDialPressure = spentDialPressure; - state = BAL_CHAMBER_STATE2_VALVES_CLOSE; + state = BAL_CHAMBER_STATE2_FILL_DETECT_COMPLETE; } } @@ -737,15 +737,15 @@ /*********************************************************************//** * @brief - * The handleBalChamberState1ValvesClose function check for the balancing chamber + * The handleBalChamberState1FillDetectComplete function check for the balancing chamber * fill complete and close the currently opened valves. * @details \b Inputs: currentBalChamberSwitchingCounter, spent and fresh dialysate pressure * @details \b Outputs: isPressureStalbilizedDuringFill,isBalChamberFillInProgress * @return next balancing chamber state. *************************************************************************/ -static BAL_CHAMBER_EXEC_STATE_T handleBalChamberState1ValvesClose( void ) +static BAL_CHAMBER_EXEC_STATE_T handleBalChamberState1FillDetectComplete( void ) { - BAL_CHAMBER_EXEC_STATE_T state = BAL_CHAMBER_STATE1_VALVES_CLOSE; + BAL_CHAMBER_EXEC_STATE_T state = BAL_CHAMBER_STATE1_FILL_DETECT_COMPLETE; BOOL isBothFillsComplete = FALSE; BOOL isFirstCycleNotDone = FALSE; BOOL isFillCompleteOrFirstCycle = FALSE; @@ -754,7 +754,7 @@ spentDialPressure = getFilteredPressure( D51_PRES ); // After the first BC cycle, fault if fill never completes at the Qd-based timeout. - if ( currentBalChamberFillCounter > balChamberFillTimeoutCount ) + if ( ( currentBalChamberFillCounter > balChamberFillTimeoutCount ) && ( TRUE != getTestConfigStatus( TEST_CONFIG_DD_DISABLE_BC_PRESSURE_ALARMS ) ) ) { SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DD_BC_FILL_TIMEOUT_FAULT, currentBalChamberFillCounter, balChamberFillTimeoutCount ); @@ -827,8 +827,6 @@ * balanceChamberSwitchingOnlyOffRequested * @details \b Alarm: ALARM_ID_DD_BC_STATE1_FILL_PRESSURE_DROP_OUT_OF_RANGE * when pressure drop is not in range during balancing chamber fill in progress. - * @details \b Alarm: ALARM_ID_DD_BC_STATE1_FILL_END_PRESSURE_OUT_OF_RANGE - * when pressure is not in range during balancing chamber fill complete. * @return next balancing chamber state. *************************************************************************/ static BAL_CHAMBER_EXEC_STATE_T handleBalChamberState1FillEnd( void ) @@ -856,14 +854,6 @@ // Move to the idle state state = BAL_CHAMBER_STATE_IDLE; } - else if ( ( TRUE != isPressureStabilizedDuringFill ) && ( TRUE != isSpentFillComplete ) ) - { - // Alarm when switching time expired, but still pressure not in range which indicates fill is not yet completed. - SET_ALARM_WITH_2_F32_DATA( ALARM_ID_DD_BC_STATE1_FILL_END_PRESSURE_OUT_OF_RANGE, freshDialPressure, spentDialPressure ); - - // Move to the idle state - state = BAL_CHAMBER_STATE_IDLE; - } else { // Move to next state when pressure is in range. @@ -1007,15 +997,15 @@ /*********************************************************************//** * @brief - * The handleBalChamberState2ValvesClose function check for the balancing chamber + * The handleBalChamberState2FillDetectComplete function check for the balancing chamber * fill complete and close the currently opened valves. * @details \b Inputs: currentBalChamberSwitchingCounter, spent and fresh dialysate pressure * @details \b Outputs: isPressureStalbilizedDuringFill,isBalChamberFillInProgress * @return next balancing chamber state. *************************************************************************/ -static BAL_CHAMBER_EXEC_STATE_T handleBalChamberState2ValvesClose( void ) +static BAL_CHAMBER_EXEC_STATE_T handleBalChamberState2FillDetectComplete( void ) { - BAL_CHAMBER_EXEC_STATE_T state = BAL_CHAMBER_STATE2_VALVES_CLOSE; + BAL_CHAMBER_EXEC_STATE_T state = BAL_CHAMBER_STATE2_FILL_DETECT_COMPLETE; BOOL isBothFillsComplete = FALSE; BOOL isFirstCycleNotDone = FALSE; BOOL isFillCompleteOrFirstCycle = FALSE; @@ -1039,7 +1029,7 @@ } // After the first BC cycle, fault if fill never completes at the Qd-based timeout. - if ( currentBalChamberFillCounter > balChamberFillTimeoutCount ) + if ( ( currentBalChamberFillCounter > balChamberFillTimeoutCount ) && ( TRUE != getTestConfigStatus( TEST_CONFIG_DD_DISABLE_BC_PRESSURE_ALARMS ) ) ) { SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DD_BC_FILL_TIMEOUT_FAULT, currentBalChamberFillCounter, balChamberFillTimeoutCount ); @@ -1107,8 +1097,6 @@ * balanceChamberSwitchingOnlyOffRequested * @details \b Alarm: ALARM_ID_DD_BC_STATE2_FILL_PRESSURE_DROP_OUT_OF_RANGE * when pressure is not in range during balacing chamber state 2 fill in progress. - * @details \b Alarm: ALARM_ID_DD_BC_STATE2_FILL_END_PRESSURE_OUT_OF_RANGE - * when pressure is not in range during balacing chamber state 2 fill complete. * @return next balancing chamber state. *************************************************************************/ static BAL_CHAMBER_EXEC_STATE_T handleBalChamberState2FillEnd( void ) @@ -1136,14 +1124,6 @@ // Move to the idle state state = BAL_CHAMBER_STATE_IDLE; } - else if ( ( TRUE != isPressureStabilizedDuringFill ) && ( TRUE != isSpentFillComplete ) ) - { - // Alarm when switching time expired, but still pressure not in range which indicates fill is not completed. - SET_ALARM_WITH_2_F32_DATA( ALARM_ID_DD_BC_STATE2_FILL_END_PRESSURE_OUT_OF_RANGE, freshDialPressure, spentDialPressure ); - - // Move to the idle state - state = BAL_CHAMBER_STATE_IDLE; - } else { // Move to next state when pressure is in range. @@ -1559,8 +1539,7 @@ data.balChamberExecState = (U32)balChamberExecState; data.balChamberSWState = (U32)balChamberSWState; data.balChamberSWFreq = getBalChamberSwitchingFreq(); - data.balChamberSwPeriod = getD48PumpSpeedForBCFill(); - data.isBalChamberFillInProgress = isSpentFillComplete; + data.isSpentFillComplete = isSpentFillComplete; data.currentBalChamberSwitchingCounter = currentBalChamberFillCounter; data.isPressureStabilizedDuringFill = isPressureStabilizedDuringFill; data.balChamberSWOnlyState = balanceChamberSwitchingOnly;