Index: firmware/App/Controllers/BalancingChamber.c =================================================================== diff -u -r2245e17875668a9326a5f5155a56747378e139e9 -rf20c3a459d0fa96d8703b34f96b8795af5744ea0 --- firmware/App/Controllers/BalancingChamber.c (.../BalancingChamber.c) (revision 2245e17875668a9326a5f5155a56747378e139e9) +++ firmware/App/Controllers/BalancingChamber.c (.../BalancingChamber.c) (revision f20c3a459d0fa96d8703b34f96b8795af5744ea0) @@ -404,13 +404,9 @@ F32 bicarbVolume = getF32OverrideValue( &bicarbDoseVolume ); // Check fresh and spent dialysate pressure in range or BC switch only flag set -#ifndef __BC_PRESSURE_ALARM__ - if ( 1 ) -#else 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() ) ) -#endif + ( ( spentDialPressure >= SPENT_DIAL_PRESSURE_MIN_PSIG ) && ( spentDialPressure <= SPENT_DIAL_PRESSURE_MAX_PSIG ) ) || + ( TRUE == getBalChamberSwitchingOnlyStatus() ) || ( TRUE == getTestConfigStatus( TEST_CONFIG_DISABLE_BC_PRESSURE_ALARMS ) ) ) { //Valve control for state 1 fill valveControlForBCState1FillStart(); @@ -432,10 +428,9 @@ } else { -#ifdef __BC_PRESSURE_ALARM__ + if ( getTestConfigStatus( TEST_CONFIG_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 ); -#endif } return state; @@ -511,20 +506,23 @@ F32 spentDialPressure = getFilteredPressure( D51_PRES ); // Check fresh and spent dialysate pressure back in range to indicate fill complete. -#ifdef __BC_PRESSURE_ALARM__ - 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 ( getTestConfigStatus( TEST_CONFIG_DISABLE_BC_PRESSURE_ALARMS ) != TRUE ) { - if ( ++balChamberFillCompleteStablePressureCounter >= BAL_CHAMBER_FILL_COMPLETE_MS ) + 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 ) ) ) { - // stabilized pressure indicating fill is complete - isPressureStalbilizedDuringFill = TRUE; - isBalChamberFillInProgress = FALSE; + if ( ++balChamberFillCompleteStablePressureCounter >= BAL_CHAMBER_FILL_COMPLETE_MS ) + { + // stabilized pressure indicating fill is complete + isPressureStalbilizedDuringFill = TRUE; + isBalChamberFillInProgress = FALSE; + } } } -#else + else + { isPressureStalbilizedDuringFill = FALSE; -#endif + } // Switching time met or pressure in range, close valves if ( ( currentBalChamberSwitchingCounter >= balChamberValveClosePeriod ) || @@ -542,26 +540,29 @@ if ( TRUE != getBalChamberSwitchingOnlyStatus() ) { -#ifdef __BC_PRESSURE_ALARM__ - if ( ( TRUE != isPressureDroppedDuringFill ) && ( TRUE == isFirstCycleBCSwitchingCompleted ) ) + if ( getTestConfigStatus( TEST_CONFIG_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_STATE1_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_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 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. + // Allow to proceed next state even though pressure is not stabilized. state = BAL_CHAMBER_STATE2_FILL_START; } -#else - // Allow to proceed next state even though pressure is not stabilized. - state = BAL_CHAMBER_STATE2_FILL_START; -#endif } else { @@ -597,13 +598,9 @@ F32 bicarbVolume = getF32OverrideValue( &bicarbDoseVolume ); // Check fresh and spent dialysate pressure in range -#ifndef __BC_PRESSURE_ALARM__ - if ( 1 ) -#else 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() ) ) -#endif + ( TRUE == getBalChamberSwitchingOnlyStatus() ) || ( getTestConfigStatus( TEST_CONFIG_DISABLE_BC_PRESSURE_ALARMS ) != TRUE ) ) { // Valve control for state 2 fill valveControlForBCState2FillStart(); @@ -625,10 +622,11 @@ } else { -#ifdef __BC_PRESSURE_ALARM__ - //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 ); -#endif + if ( getTestConfigStatus( TEST_CONFIG_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; } @@ -653,20 +651,23 @@ F32 spentDialPressure = getFilteredPressure( D51_PRES ); // Check fresh and spent dialysate pressure back in range to indicate fill complete. -#ifdef __BC_PRESSURE_ALARM__ - 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 ( getTestConfigStatus( TEST_CONFIG_DISABLE_BC_PRESSURE_ALARMS ) != TRUE ) { - if ( ++balChamberFillCompleteStablePressureCounter >= BAL_CHAMBER_FILL_COMPLETE_MS ) + 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 ) ) ) { - // stabilized pressure indicating fill is complete - isPressureStalbilizedDuringFill = TRUE; - isBalChamberFillInProgress = FALSE; + if ( ++balChamberFillCompleteStablePressureCounter >= BAL_CHAMBER_FILL_COMPLETE_MS ) + { + // stabilized pressure indicating fill is complete + isPressureStalbilizedDuringFill = TRUE; + isBalChamberFillInProgress = FALSE; + } } } -#else + else + { isPressureStalbilizedDuringFill = FALSE; -#endif + } // Check switching cycle time or pressure check for valve closure if ( ( currentBalChamberSwitchingCounter >= balChamberValveClosePeriod ) || @@ -685,32 +686,35 @@ // Pressure alarm check if ( TRUE != getBalChamberSwitchingOnlyStatus() ) { -#ifdef __BC_PRESSURE_ALARM__ - if ( ( TRUE != isPressureDroppedDuringFill ) && ( TRUE == isFirstCycleBCSwitchingCompleted ) ) + if ( getTestConfigStatus( TEST_CONFIG_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; + + // Trigger pressure drop alarm after first cycle of balancing chamber switching complete + if ( FALSE == isFirstCycleBCSwitchingCompleted ) + { + isFirstCycleBCSwitchingCompleted = TRUE; + } + } } - 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; - - // 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; -#endif } else { Index: firmware/App/DDCommon.h =================================================================== diff -u -r12929ac400de74684371b01b962926f868922448 -rf20c3a459d0fa96d8703b34f96b8795af5744ea0 --- firmware/App/DDCommon.h (.../DDCommon.h) (revision 12929ac400de74684371b01b962926f868922448) +++ firmware/App/DDCommon.h (.../DDCommon.h) (revision f20c3a459d0fa96d8703b34f96b8795af5744ea0) @@ -54,9 +54,6 @@ //Uncomment below once characterization/study completed //#define ENABLE_ALARM_2 -//Uncomment below if balancing chamber pressure alarm is required -#define __BC_PRESSURE_ALARM__ 1 - //Uncomment below to disable heaters debug message #define __HEATERS_DEBUG__ 1 Index: firmware/App/Drivers/PressureSensor.c =================================================================== diff -u -r2245e17875668a9326a5f5155a56747378e139e9 -rf20c3a459d0fa96d8703b34f96b8795af5744ea0 --- firmware/App/Drivers/PressureSensor.c (.../PressureSensor.c) (revision 2245e17875668a9326a5f5155a56747378e139e9) +++ firmware/App/Drivers/PressureSensor.c (.../PressureSensor.c) (revision f20c3a459d0fa96d8703b34f96b8795af5744ea0) @@ -32,7 +32,7 @@ #define PRES_SENSORS_COUNT_ERROR_TIMEOUT_MS ( 2 * MS_PER_SECOND ) ///< Pressure sensors read and error count timeout in milliseconds. #define HIGH_PRES_MAX_PSI 145.038F ///< Convert pressure to PSI for 10 bar pressure sensor #define LOW_PRES_MAX_PSI 50.7632F ///< Convert pressure to PSI for 3.5 bar pressure sensor -#ifdef __BETA_HW_VER__ +#ifndef __BETA_HW_VER__ #define PRES_MIN_PSI 0.0F ///< Minimum value for PSI conversion #else #define PRES_MIN_PSI -14.5038F ///< Minimum value for PSI conversion