Fisheye: Tag 3bafab778c613a1abd0c421128320408db407ef8 refers to a dead (removed) revision in file `firmware/.settings/com.ti.ccstudio.project.core.prefs'. Fisheye: No comparison available. Pass `N' to diff? Index: firmware/App/Controllers/BalancingChamber.c =================================================================== diff -u -r8e93a6e39b2c7af5f0b47ef1272a2b53446fab0b -r3bafab778c613a1abd0c421128320408db407ef8 --- firmware/App/Controllers/BalancingChamber.c (.../BalancingChamber.c) (revision 8e93a6e39b2c7af5f0b47ef1272a2b53446fab0b) +++ firmware/App/Controllers/BalancingChamber.c (.../BalancingChamber.c) (revision 3bafab778c613a1abd0c421128320408db407ef8) @@ -410,399 +410,13 @@ setValveState( D26_VALV, VALVE_STATE_CLOSED ); } -#if 0 /*********************************************************************//** * @brief * The handleBalChamberState1FillStart function handles the balancing chamber * state 1 fill and time to fill chamber counter being updated. * @details \b Inputs: Pressure * @details \b Outputs: valve states * @details \b Alarm: ALARM_ID_DD_BC_STATE1_FILL_START_PRESSURE_OUT_OF_RANGE - * when pressure is not in range during balacing chamber fill start. - * @return next balancing chamber state. - *************************************************************************/ -static BAL_CHAMBER_EXEC_STATE_T handleBalChamberState1FillStart( void ) -{ - BAL_CHAMBER_EXEC_STATE_T state = BAL_CHAMBER_STATE1_FILL_START; - currentBalChamberSwitchingCounter = 0; - isBalChamberFillInProgress = FALSE; - isPressureStalbilizedDuringFill = FALSE; - isPressureDroppedDuringFill = FALSE; - balChamberSWState = BAL_CHAMBER_SW_STATE1; - - F32 acidVolume = getF32OverrideValue( &acidDoseVolume ); - F32 bicarbVolume = getF32OverrideValue( &bicarbDoseVolume ); - freshDialPressure = getFilteredPressure( D18_PRES ); - spentDialPressure = getFilteredPressure( D51_PRES ); - - // Check fresh and spent dialysate pressure in range or BC switch only flag set - if ( ( ( freshDialPressure >= FRESH_DIAL_PRESSURE_MIN_PSIG ) && ( freshDialPressure <= FRESH_DIAL_PRESSURE_MAX_PSIG ) ) && - ( ( spentDialPressure >= SPENT_DIAL_PRESSURE_MIN_PSIG ) && ( spentDialPressure <= SPENT_DIAL_PRESSURE_MAX_PSIG ) ) || - ( TRUE == getBalChamberSwitchingOnlyStatus() ) || ( TRUE == getTestConfigStatus( TEST_CONFIG_DD_DISABLE_BC_PRESSURE_ALARMS ) ) ) - { - //Valve control for state 1 fill - valveControlForBCState1FillStart(); - - // Update fill status flag to true - isBalChamberFillInProgress = TRUE; - - // Deliver dosing during generate dialysate mode - if ( TRUE != getBalChamberSwitchingOnlyStatus() ) - { - // start acid and bicarb pump with the expected quantity - setConcentratePumpTargetSpeed( D11_PUMP, CONCENTRATE_PUMP_MAX_SPEED, acidVolume ); - setConcentratePumpTargetSpeed( D10_PUMP, CONCENTRATE_PUMP_MAX_SPEED, bicarbVolume ); - requestConcentratePumpOn( D11_PUMP ); - requestConcentratePumpOn( D10_PUMP ); - } - - state = BAL_CHAMBER_STATE1_BICARB_ACID_DOSING_CNTRL; - } - else - { - if ( getTestConfigStatus( TEST_CONFIG_DD_DISABLE_BC_PRESSURE_ALARMS ) != TRUE ) - { - //Alarm when pressure is not in range - SET_ALARM_WITH_2_F32_DATA( ALARM_ID_DD_BC_STATE1_FILL_START_PRESSURE_OUT_OF_RANGE, freshDialPressure, spentDialPressure ); - } - } - - return state; -} - -/*********************************************************************//** - * @brief - * The handleBalChamberConcentrateControl function handles the Acid and Bicarb - * concentrate doisng and checks the conductivity of the dialysate for the treatment. - * @details \b Inputs: balChamberSWState , Concentrate volume - * @details \b Outputs: isPressureDroppedDuringFill, state - * @return next balancing chamber state. - *************************************************************************/ -static BAL_CHAMBER_EXEC_STATE_T handleBalChamberConcentrateControl( void ) -{ - BAL_CHAMBER_EXEC_STATE_T state; - freshDialPressure = getFilteredPressure( D18_PRES ); - spentDialPressure = getFilteredPressure( D51_PRES ); - - if ( BAL_CHAMBER_SW_STATE1 == balChamberSWState ) - { - state = BAL_CHAMBER_STATE1_BICARB_ACID_DOSING_CNTRL; - } - else - { - state = BAL_CHAMBER_STATE2_BICARB_ACID_DOSING_CNTRL; - } - - // Pressure drop check during fill process helps to find if there is any issue with valves opening - if ( ( freshDialPressure <= BC_FRESH_FILL_PRESSURE_PSIG ) && ( spentDialPressure <= BC_SPENT_FILL_PRESSURE_PSIG ) ) - { - if ( ++balChamberFillPressureDropCounter >= BAL_CHAMBER_FILL_PRES_DROP_MS ) - { - isPressureDroppedDuringFill = TRUE; - } - } - - // On dosing completion, transition to next state based on the current switching state - if ( ( ( TRUE == isConcentratePumpDosingCompleted( D11_PUMP ) ) && - ( TRUE == isConcentratePumpDosingCompleted( D10_PUMP ) ) ) || - ( TRUE == getBalChamberSwitchingOnlyStatus() ) ) - { - if ( BAL_CHAMBER_SW_STATE1 == balChamberSWState ) - { - state = BAL_CHAMBER_STATE1_VALVES_CLOSE; - } - else - { - state = BAL_CHAMBER_STATE2_VALVES_CLOSE; - } - } - - return state; -} - -/*********************************************************************//** - * @brief - * The handleBalChamberState1ValvesClose 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 ) -{ - BAL_CHAMBER_EXEC_STATE_T state = BAL_CHAMBER_STATE1_VALVES_CLOSE; - - freshDialPressure = getFilteredPressure( D18_PRES ); - spentDialPressure = getFilteredPressure( D51_PRES ); - - // Check fresh and spent dialysate pressure back in range to indicate fill complete. - if ( getTestConfigStatus( TEST_CONFIG_DD_DISABLE_BC_PRESSURE_ALARMS ) != TRUE ) - { - if ( ( ( freshDialPressure >= FRESH_DIAL_PRESSURE_MIN_PSIG ) && ( freshDialPressure <= FRESH_DIAL_PRESSURE_MAX_PSIG ) ) && - ( ( spentDialPressure >= SPENT_DIAL_PRESSURE_MIN_PSIG ) && ( spentDialPressure <= SPENT_DIAL_PRESSURE_MAX_PSIG ) ) ) - { - if ( ++balChamberFillCompleteStablePressureCounter >= BAL_CHAMBER_FILL_COMPLETE_MS ) - { - // stabilized pressure indicating fill is complete - isPressureStalbilizedDuringFill = TRUE; - } - } - } - else - { - isPressureStalbilizedDuringFill = FALSE; - } - - // Switching time met or pressure in range, close valves - if ( ( currentBalChamberSwitchingCounter >= balChamberValveClosePeriod ) || - ( TRUE == isPressureStalbilizedDuringFill ) ) - { - // close the state 1 opened valves - valveControlForBCState1FillEnd(); - isBalChamberFillInProgress = FALSE; - - //Transition to next state - state = BAL_CHAMBER_STATE1_FILL_END; - } - - return state; -} - -/*********************************************************************//** - * @brief - * The handleBalChamberState1FillEnd function check for the balancing chamber - * switching period and tranistion to next state switching. - * @details \b Inputs: currentBalChamberSwitchingCounter, balChamberSwitchingPeriod - * @details \b Outputs: balChamberFillPressureDropCounter,balChamberFillCompleteStablePressureCounter - * @details \b Alarm: ALARM_ID_DD_BC_STATE1_FILL_PRESSURE_DROP_OUT_OF_RANGE - * when pressure drop is not in range during balacing 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 balacing chamber fill complete. - * @return next balancing chamber state. - *************************************************************************/ -static BAL_CHAMBER_EXEC_STATE_T handleBalChamberState1FillEnd( void ) -{ - BAL_CHAMBER_EXEC_STATE_T state = BAL_CHAMBER_STATE1_FILL_END; - - // On completion of cycle time, transition to next state - if ( currentBalChamberSwitchingCounter >= balChamberSwitchingPeriod ) - { - balChamberFillPressureDropCounter = 0; - balChamberFillCompleteStablePressureCounter = 0; - - if ( TRUE != getBalChamberSwitchingOnlyStatus() ) - { - if ( getTestConfigStatus( TEST_CONFIG_DD_DISABLE_BC_PRESSURE_ALARMS ) != TRUE ) - { - if ( ( TRUE != isPressureDroppedDuringFill ) && ( TRUE == isFirstCycleBCSwitchingCompleted ) ) - { - // When fill initiated, pressure is not dropped to the expected range, possible valve failures. - SET_ALARM_WITH_2_F32_DATA( ALARM_ID_DD_BC_STATE1_FILL_PRESSURE_DROP_OUT_OF_RANGE, freshDialPressure, spentDialPressure ); - } - else if ( TRUE != isPressureStalbilizedDuringFill ) - { - // 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 ); - } - else - { - // Move to next state when pressure is in range. - state = BAL_CHAMBER_STATE2_FILL_START; - } - } - else - { - // Allow to proceed next state even though pressure is not stabilized. - state = BAL_CHAMBER_STATE2_FILL_START; - } - } - else - { - state = BAL_CHAMBER_STATE2_FILL_START; - } - } - - return state; -} - -/*********************************************************************//** - * @brief - * The handleBalChamberState2FillStart function handles the balancing chamber - * state 2 fill and time to fill chamber counter being updated. - * @details \b Inputs: fresh and spent dialysate pressure - * @details \b Outputs: valve states - * @details \b Alarm: ALARM_ID_DD_BC_STATE2_FILL_START_PRESSURE_OUT_OF_RANGE - * when pressure is not in range during balacing chamber state 2 fill start. - * @return next balancing chamber state. - *************************************************************************/ -static BAL_CHAMBER_EXEC_STATE_T handleBalChamberState2FillStart( void ) -{ - BAL_CHAMBER_EXEC_STATE_T state = BAL_CHAMBER_STATE2_FILL_START; - currentBalChamberSwitchingCounter = 0; - isBalChamberFillInProgress = FALSE; - isPressureStalbilizedDuringFill = FALSE; - isPressureDroppedDuringFill = FALSE; - balChamberSWState = BAL_CHAMBER_SW_STATE2; - - F32 acidVolume = getF32OverrideValue( &acidDoseVolume ); - F32 bicarbVolume = getF32OverrideValue( &bicarbDoseVolume ); - freshDialPressure = getFilteredPressure( D18_PRES ); - spentDialPressure = getFilteredPressure( D51_PRES ); - - // Check fresh and spent dialysate pressure in range - if ( ( ( freshDialPressure >= FRESH_DIAL_PRESSURE_MIN_PSIG ) && ( freshDialPressure <= FRESH_DIAL_PRESSURE_MAX_PSIG ) ) && - ( ( spentDialPressure >= SPENT_DIAL_PRESSURE_MIN_PSIG ) && ( spentDialPressure <= SPENT_DIAL_PRESSURE_MAX_PSIG ) ) || - ( TRUE == getBalChamberSwitchingOnlyStatus() ) || ( TRUE == getTestConfigStatus( TEST_CONFIG_DD_DISABLE_BC_PRESSURE_ALARMS ) ) ) - { - // Valve control for state 2 fill - valveControlForBCState2FillStart(); - - // Update fill status flag to true - isBalChamberFillInProgress = TRUE; - - // Deliver dosing during generate dialysate mode - if ( TRUE != getBalChamberSwitchingOnlyStatus() ) - { - // start acid and bicarb pump with the expected quantity - setConcentratePumpTargetSpeed( D11_PUMP, CONCENTRATE_PUMP_MAX_SPEED, acidVolume ); - setConcentratePumpTargetSpeed( D10_PUMP, CONCENTRATE_PUMP_MAX_SPEED, bicarbVolume ); - requestConcentratePumpOn( D11_PUMP ); - requestConcentratePumpOn( D10_PUMP ); - } - - state = BAL_CHAMBER_STATE2_BICARB_ACID_DOSING_CNTRL; - } - else - { - if ( getTestConfigStatus( TEST_CONFIG_DD_DISABLE_BC_PRESSURE_ALARMS ) != TRUE ) - { - //Alarm when pressure is not in range - SET_ALARM_WITH_2_F32_DATA( ALARM_ID_DD_BC_STATE2_FILL_START_PRESSURE_OUT_OF_RANGE, freshDialPressure, spentDialPressure ); - } - } - return state; -} - -/*********************************************************************//** - * @brief - * The handleBalChamberState2ValvesClose 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 ) -{ - BAL_CHAMBER_EXEC_STATE_T state = BAL_CHAMBER_STATE2_VALVES_CLOSE; - - freshDialPressure = getFilteredPressure( D18_PRES ); - spentDialPressure = getFilteredPressure( D51_PRES ); - - // Check fresh and spent dialysate pressure back in range to indicate fill complete. - if ( getTestConfigStatus( TEST_CONFIG_DD_DISABLE_BC_PRESSURE_ALARMS ) != TRUE ) - { - if ( ( ( freshDialPressure >= FRESH_DIAL_PRESSURE_MIN_PSIG ) && ( freshDialPressure <= FRESH_DIAL_PRESSURE_MAX_PSIG ) ) && - ( ( spentDialPressure >= SPENT_DIAL_PRESSURE_MIN_PSIG ) && ( spentDialPressure <= SPENT_DIAL_PRESSURE_MAX_PSIG ) ) ) - { - if ( ++balChamberFillCompleteStablePressureCounter >= BAL_CHAMBER_FILL_COMPLETE_MS ) - { - // stabilized pressure indicating fill is complete - isPressureStalbilizedDuringFill = TRUE; - } - } - } - else - { - isPressureStalbilizedDuringFill = FALSE; - } - - // Check switching cycle time or pressure check for valve closure - if ( ( currentBalChamberSwitchingCounter >= balChamberValveClosePeriod ) || - ( TRUE == isPressureStalbilizedDuringFill ) ) - { - // close the valves - valveControlForBCState2FillEnd(); - isBalChamberFillInProgress = FALSE; - - //Transition to next state - state = BAL_CHAMBER_STATE2_FILL_END; - } - - return state; -} - -/*********************************************************************//** - * @brief - * The handleBalChamberState2FillEnd function check for the balancing chamber - * switching period complete and transition to next state. - * @details \b Inputs: currentBalChamberSwitchingCounter, balChamberSwitchingPeriod - * @details \b Outputs: isPressureStalbilizedDuringFill,isBalChamberFillInProgress - * @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 ) -{ - BAL_CHAMBER_EXEC_STATE_T state = BAL_CHAMBER_STATE2_FILL_END; - - // On completion of cycle time, transition to next state - if ( currentBalChamberSwitchingCounter >= balChamberSwitchingPeriod ) - { - balChamberFillPressureDropCounter = 0; - balChamberFillCompleteStablePressureCounter = 0; - - // Pressure alarm check - if ( TRUE != getBalChamberSwitchingOnlyStatus() ) - { - if ( getTestConfigStatus( TEST_CONFIG_DD_DISABLE_BC_PRESSURE_ALARMS ) != TRUE ) - { - if ( ( TRUE != isPressureDroppedDuringFill ) && ( TRUE == isFirstCycleBCSwitchingCompleted ) ) - { - // When fill initiated, pressure is not dropped to the expected range, possible valve failures. - SET_ALARM_WITH_2_F32_DATA( ALARM_ID_DD_BC_STATE2_FILL_PRESSURE_DROP_OUT_OF_RANGE, freshDialPressure, spentDialPressure ); - } - else if ( TRUE != isPressureStalbilizedDuringFill ) - { - // 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 ); - } - else - { - // 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; - } - } - - return state; -} -#else - -/*********************************************************************//** - * @brief - * The handleBalChamberState1FillStart function handles the balancing chamber - * state 1 fill and time to fill chamber counter being updated. - * @details \b Inputs: Pressure - * @details \b Outputs: valve states - * @details \b Alarm: ALARM_ID_DD_BC_STATE1_FILL_START_PRESSURE_OUT_OF_RANGE * when pressure is not in range during balancing chamber fill start. * @return next balancing chamber state. *************************************************************************/ @@ -942,10 +556,15 @@ // Check both spent and fresh side fill is complete if ( ( TRUE == isSpentFillComplete ) && ( TRUE == isPressureStalbilizedDuringFill ) || ( FALSE == isFirstCycleBCSwitchingCompleted ) ) { + // close the state 1 opened valves valveControlForBCState1FillEnd(); isBalChamberFillInProgress = FALSE; - setDialysatePumpTargetRPM( D48_PUMP, getD48PumpSpeedForBCFill(), TRUE ); + //setDialysatePumpTargetRPM( D48_PUMP, getD48PumpSpeedForBCFill(), TRUE ); + if ( FALSE != isFirstCycleBCSwitchingCompleted ) + { + setDialysatePumpTargetRPM( D48_PUMP, getD48PumpSpeedForBCFill(), TRUE ); + } // Transition to next state state = BAL_CHAMBER_STATE1_FILL_END; @@ -1066,6 +685,7 @@ SET_ALARM_WITH_2_F32_DATA( ALARM_ID_DD_BC_STATE2_FILL_START_PRESSURE_OUT_OF_RANGE, freshDialPressure, spentDialPressure ); } } + return state; } @@ -1103,7 +723,11 @@ // close the valves valveControlForBCState2FillEnd(); isBalChamberFillInProgress = FALSE; - setDialysatePumpTargetRPM( D48_PUMP, getD48PumpSpeedForBCFill(), TRUE ); + //setDialysatePumpTargetRPM( D48_PUMP, getD48PumpSpeedForBCFill(), TRUE ); + if ( FALSE != isFirstCycleBCSwitchingCompleted ) + { + setDialysatePumpTargetRPM( D48_PUMP, getD48PumpSpeedForBCFill(), TRUE ); + } //Transition to next state state = BAL_CHAMBER_STATE2_FILL_END; @@ -1131,50 +755,47 @@ balChamberFillPressureDropCounter = 0; balChamberFillCompleteStablePressureCounter = 0; - // Pressure alarm check - if ( TRUE != getBalChamberSwitchingOnlyStatus() ) - { - if ( getTestConfigStatus( TEST_CONFIG_DD_DISABLE_BC_PRESSURE_ALARMS ) != TRUE ) + // Pressure alarm check + if ( TRUE != getBalChamberSwitchingOnlyStatus() ) { - if ( ( TRUE != isPressureDroppedDuringFill ) && ( TRUE == isFirstCycleBCSwitchingCompleted ) ) + if ( getTestConfigStatus( TEST_CONFIG_DD_DISABLE_BC_PRESSURE_ALARMS ) != TRUE ) { - // When fill initiated, pressure is not dropped to the expected range, possible valve failures. - SET_ALARM_WITH_2_F32_DATA( ALARM_ID_DD_BC_STATE2_FILL_PRESSURE_DROP_OUT_OF_RANGE, freshDialPressure, spentDialPressure ); + if ( ( TRUE != isPressureDroppedDuringFill ) && ( TRUE == isFirstCycleBCSwitchingCompleted ) ) + { + // When fill initiated, pressure is not dropped to the expected range, possible valve failures. + SET_ALARM_WITH_2_F32_DATA( ALARM_ID_DD_BC_STATE2_FILL_PRESSURE_DROP_OUT_OF_RANGE, freshDialPressure, spentDialPressure ); + } + else if ( TRUE != isPressureStalbilizedDuringFill ) + { + // 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 ); + } + else + { + // Move to next state when pressure is in range. + state = BAL_CHAMBER_STATE1_FILL_START; + } } - else if ( TRUE != isPressureStalbilizedDuringFill ) - { - // 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 ); - } else { - // Move to next state when pressure is in range. + // Allow to proceed next state even though pressure is not stabilized. state = BAL_CHAMBER_STATE1_FILL_START; } } else { - // Allow to proceed next state even though pressure is not stabilized. state = BAL_CHAMBER_STATE1_FILL_START; + } + // Trigger pressure drop alarm after first cycle of balancing chamber switching complete + if ( FALSE == isFirstCycleBCSwitchingCompleted ) + { + isFirstCycleBCSwitchingCompleted = TRUE; } - } - 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; } -#endif - /*********************************************************************//** * @brief * The checkSpentFillComplete function checks the pressure difference for @@ -1190,7 +811,7 @@ U32 absDiffSpentFillCount = 0; U32 adjustedSpeed = 0; U32 spentDialPumpSpeed = getD48PumpSpeedForBCFill(); - U32 initialD48PumpSpeed = calculateD48PumpSpeedForBCFill(); + U32 initialD48PumpSpeed = getCalculatedD48PumpSpeedForBCFill(); U32 minD48Speed = initialD48PumpSpeed - ( initialD48PumpSpeed * D48_SPEED_RANGE_LIMIT ); U32 maxD48Speed = initialD48PumpSpeed + ( initialD48PumpSpeed * D48_SPEED_RANGE_LIMIT ); U32 d48SpeedPostRangeCheck = 0; @@ -1358,15 +979,9 @@ data.balChamberExecState = (U32)balChamberExecState; data.balChamberSWState = (U32)balChamberSWState; data.balChamberSWFreq = getBalChamberSwitchingFreq(); -#if 0 - data.balChamberSwPeriod = balChamberSwitchingPeriod; - data.isBalChamberFillInProgress = isBalChamberFillInProgress; - data.currentBalChamberSwitchingCounter = currentBalChamberSwitchingCounter; -#else data.balChamberSwPeriod = getD48PumpSpeedForBCFill(); data.isBalChamberFillInProgress = isSpentFillComplete; data.currentBalChamberSwitchingCounter = currentBalChamberFillCounter; -#endif data.isPressureStalbilizedDuringFill = isPressureStalbilizedDuringFill; data.balChamberSWOnlyState = balanceChamberSwitchingOnly; Index: firmware/App/Controllers/DialysatePumps.h =================================================================== diff -u -r830213bc6dcc1a684610caf78c79d55f2cb41e93 -r3bafab778c613a1abd0c421128320408db407ef8 --- firmware/App/Controllers/DialysatePumps.h (.../DialysatePumps.h) (revision 830213bc6dcc1a684610caf78c79d55f2cb41e93) +++ firmware/App/Controllers/DialysatePumps.h (.../DialysatePumps.h) (revision 3bafab778c613a1abd0c421128320408db407ef8) @@ -34,6 +34,18 @@ #define MIN_DIALYSATE_PUMP_RPM 200 ///< Minimum RPM target for dialysate pump (though zero is allowed if turning pump off). #define MAX_DIALYSATE_PUMP_RPM 2650 ///< Maximum RPM target for dialysate pump. + +#ifdef __NEW_D48_PUMP__ + +#define MIN_DIALYSATE_PUMP_RPM 200 ///< Minimum RPM target for dialysate pump (though zero is allowed if turning pump off). +#define MAX_DIALYSATE_PUMP_RPM 1300 ///< Maximum RPM target for dialysate pump. + +#else + +#define MIN_DIALYSATE_PUMP_RPM 200 ///< Minimum RPM target for dialysate pump (though zero is allowed if turning pump off). +#define MAX_DIALYSATE_PUMP_RPM 2650 ///< Maximum RPM target for dialysate pump. + +#endif #define DEGAS_PUMP_TARGET_PRES_ADJ_THRESHOLD -1.0F ///< Dialysate Pump(D12) target pressure threshold adjustment factor. #define MIN_DIALYSATE_FLOW_RATE ( 100.0F ) ///< Minimum dialysate flow rate Index: firmware/App/DDCommon.h =================================================================== diff -u -refed432eddd3b47deb44b68088e534ac539b47f6 -r3bafab778c613a1abd0c421128320408db407ef8 --- firmware/App/DDCommon.h (.../DDCommon.h) (revision efed432eddd3b47deb44b68088e534ac539b47f6) +++ firmware/App/DDCommon.h (.../DDCommon.h) (revision 3bafab778c613a1abd0c421128320408db407ef8) @@ -52,11 +52,13 @@ //#define __BICARB_CHAMBER_FILL__ 1 //Uncomment below for Maxon controller speed change -#define __MAXON_SPEED_UPDATE__ 1 +//#define __MAXON_SPEED_UPDATE__ 1 //Uncomment below to disable heaters debug message #define __HEATERS_DEBUG__ 1 +//Uncomment below for new D48 pump changes +//#define __NEW_D48_PUMP__ 1 #include #include Index: firmware/App/Modes/ModeGenDialysate.c =================================================================== diff -u -r8e93a6e39b2c7af5f0b47ef1272a2b53446fab0b -r3bafab778c613a1abd0c421128320408db407ef8 --- firmware/App/Modes/ModeGenDialysate.c (.../ModeGenDialysate.c) (revision 8e93a6e39b2c7af5f0b47ef1272a2b53446fab0b) +++ firmware/App/Modes/ModeGenDialysate.c (.../ModeGenDialysate.c) (revision 3bafab778c613a1abd0c421128320408db407ef8) @@ -164,9 +164,13 @@ *************************************************************************/ U32 transitionToGenDialysateMode( void ) { + U32 initialD48PumpSpeed = 0U; + initGenDialysateMode(); setCurrentSubState( NO_SUB_STATE ); - calculateD48PumpSpeedForBCFill(); + //calculateD48PumpSpeedForBCFill(); + initialD48PumpSpeed = getCalculatedD48PumpSpeedForBCFill(); + setD48PumpSpeedForBCFill( initialD48PumpSpeed ); transitionToUltrafiltration(); return genDialysateState; @@ -514,8 +518,8 @@ /*********************************************************************//** * @brief * The setD48PumpSpeedForBCFill function sets the updated D48 pump speed. - * @details \b Inputs: none - * @details \b Outputs: d48PumpSpeed + * @details \b Inputs: d48PumpSpeed + * @details \b Outputs: none * @param pumpSpeed Dialysate pump speed * @return none. *************************************************************************/ @@ -585,17 +589,12 @@ * dialysate flow rate for continuous delivery of dialysate. * @details \b Inputs: Qd. * @details \b Outputs: D48 pump speed - * @return calculated initial D48 pump speed. + * @return calculated D48 pump speed. *************************************************************************/ -U32 calculateD48PumpSpeedForBCFill( void ) +U32 getCalculatedD48PumpSpeedForBCFill( void ) { - // Get the dialysate flow rate from TD - F32 dialFlowrate = getTDDialysateFlowrate(); - - // D48 Pump Speed = (1.24 * Qd ) + 30.0 - d48PumpSpeed = (U32)( ( PUMP_SPEED_SLOPE_FACTOR * dialFlowrate ) + PUMP_SPEED_INTERCEPT_FACTOR ); - - return d48PumpSpeed; + F32 dialFlowrate = getTDDialysateFlowrate(); + return (U32)( ( PUMP_SPEED_SLOPE_FACTOR * dialFlowrate ) + PUMP_SPEED_INTERCEPT_FACTOR ); } /*********************************************************************//** @@ -885,6 +884,8 @@ *************************************************************************/ void updateTreatmentSettings( void ) { + F32 initialPumpSpeed = 0.0F; + // Update any dynamic treatment parameter changes if ( TRUE == isTreatmentParamUpdated ) { @@ -904,8 +905,11 @@ signalUFRateUpdate(); //Update D48 pump speed - calculateD48PumpSpeedForBCFill(); + //calculateD48PumpSpeedForBCFill(); + initialPumpSpeed = getCalculatedD48PumpSpeedForBCFill(); + setD48PumpSpeedForBCFill( initialPumpSpeed ); + //reset the flag isTreatmentParamUpdated = FALSE; } Index: firmware/App/Modes/ModeGenDialysate.h =================================================================== diff -u -r8e93a6e39b2c7af5f0b47ef1272a2b53446fab0b -r3bafab778c613a1abd0c421128320408db407ef8 --- firmware/App/Modes/ModeGenDialysate.h (.../ModeGenDialysate.h) (revision 8e93a6e39b2c7af5f0b47ef1272a2b53446fab0b) +++ firmware/App/Modes/ModeGenDialysate.h (.../ModeGenDialysate.h) (revision 3bafab778c613a1abd0c421128320408db407ef8) @@ -59,7 +59,8 @@ BOOL requestDDGenDialyasteStop( void ); // Stop generate dialysate U32 getD48PumpSpeedForBCFill( void ); // Get D48 pump speed void setD48PumpSpeedForBCFill( U32 pumpSpeed ); // Set D48 pump speed -U32 calculateD48PumpSpeedForBCFill( void ); // Calculate initial D48 pump speed +U32 calculateD48PumpSpeedForBCFill( void ); // Calculate and store initial D48 pump speed +U32 getCalculatedD48PumpSpeedForBCFill( void ); // Get nominal D48 speed from formula only BOOL testDDGenDialysateDataPublishIntervalOverride( MESSAGE_T *message ); // GenD Mode data publish interval override BOOL testDialDeliveryInProgressOverride( MESSAGE_T *message ); // To override the dialysate delivery in progress flag