Index: firmware/App/Controllers/BalancingChamber.c =================================================================== diff -u -r7d7129ebe8a98694bea7cf4118f3bedf62f2157b -r9ac050d6099effbdd62070173d14dd5e225d5310 --- firmware/App/Controllers/BalancingChamber.c (.../BalancingChamber.c) (revision 7d7129ebe8a98694bea7cf4118f3bedf62f2157b) +++ firmware/App/Controllers/BalancingChamber.c (.../BalancingChamber.c) (revision 9ac050d6099effbdd62070173d14dd5e225d5310) @@ -60,7 +60,7 @@ #define D48_SPEED_RANGE_LIMIT 0.25F ///< D48 speed adjustment range check limit ( D48 speed can vary +/-25% of initial calculated speed) #define BICARB_CHAMBER_PERIODIC_FILL_TIME ( 1 * SEC_PER_MIN * \ ( MS_PER_SECOND / TASK_GENERAL_INTERVAL ) ) ///< Periodic bicarb chamber fill request 60 sec x 20 = 1200 -#define BAL_CHAMBER_FILL_TIMEOUT_FACTOR 1.5 ///< Balancing Chamber fill timeout factor (150% of observed fill count) +#define BAL_CHAMBER_FILL_TIMEOUT_FACTOR 2.0F ///< Balancing Chamber fill timeout factor (2000% of observed fill count) /// Payload record structure for balancing chamber switch only request typedef struct @@ -221,7 +221,7 @@ //Update last td dialysate flow rate lastTdDialysateFlowrate = tdDialysateFlowrate; - // Update fill timeout count based on the switching period (e.g. 150% of period) + // Update fill timeout count based on the switching period (e.g. 200% of period) balChamberFillTimeoutCount = (U32)( (F32)balChamberSwitchingPeriod * BAL_CHAMBER_FILL_TIMEOUT_FACTOR ); //Reset the BC switching flag for new Qd. @@ -531,7 +531,7 @@ BAL_CHAMBER_EXEC_STATE_T state = BAL_CHAMBER_STATE1_FILL_START; balChamberSWState = BAL_CHAMBER_SW_STATE1; - balChamberFillTimeoutCount = 0; + // Preserve the Qd-based timeout so a stuck fill can fault. isBalChamberFillInProgress = FALSE; isPressureStabilizedDuringFill = FALSE; isPressureDroppedDuringFill = FALSE; @@ -676,12 +676,14 @@ BOOL isBothFillsComplete = FALSE; BOOL isFirstCycleNotDone = FALSE; BOOL isFillCompleteOrFirstCycle = FALSE; + BOOL isFillTimeoutEnabled = ( ( TRUE == isFirstCycleBCSwitchingCompleted ) && + ( FALSE == getBalChamberSwitchingOnlyStatus() ) ) ? TRUE : FALSE; freshDialPressure = getFilteredPressure( D18_PRES ); spentDialPressure = getFilteredPressure( D51_PRES ); - // If fill is taking too long, set an alarm for fill timeout - if ( ( balChamberFillTimeoutCount > 0 ) && ( currentBalChamberFillCounter > balChamberFillTimeoutCount ) ) + // After the first BC cycle, fault if fill never completes at the Qd-based timeout. + if ( ( TRUE == isFillTimeoutEnabled ) && ( balChamberFillTimeoutCount > 0 ) && ( currentBalChamberFillCounter > balChamberFillTimeoutCount ) ) { SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DD_BC_FILL_TIMEOUT_FAULT, currentBalChamberFillCounter, balChamberFillTimeoutCount ); @@ -703,15 +705,16 @@ checkSpentFillComplete( spentDialPressure ); // Check both spent and fresh side fill is complete - isBothFillsComplete = ( TRUE == isSpentFillComplete ) && ( TRUE == isPressureStabilizedDuringFill ); - isFirstCycleNotDone = ( ( FALSE == isFirstCycleBCSwitchingCompleted ) && ( currentBalChamberSwitchingCounter >= balChamberValveClosePeriod ) && ( TRUE == getBalChamberSwitchingOnlyStatus() ) ); + isBothFillsComplete = ( ( TRUE == isSpentFillComplete ) && ( TRUE == isPressureStabilizedDuringFill ) ) ? TRUE : FALSE; + isFirstCycleNotDone = ( FALSE == isFirstCycleBCSwitchingCompleted ) && ( currentBalChamberSwitchingCounter >= balChamberValveClosePeriod ); if ( FALSE == getBalChamberSwitchingOnlyStatus() ) { - isFillCompleteOrFirstCycle = isBothFillsComplete || isFirstCycleNotDone; + isFillCompleteOrFirstCycle = ( ( TRUE == isBothFillsComplete ) || ( TRUE == isFirstCycleNotDone ) ) ? TRUE : FALSE; } - if ( TRUE == isFillCompleteOrFirstCycle ) + if ( ( TRUE == isFillCompleteOrFirstCycle ) || + ( ( currentBalChamberSwitchingCounter >= balChamberValveClosePeriod ) && ( TRUE == getBalChamberSwitchingOnlyStatus() ) ) ) { // close the state 1 opened valves valveControlForBCState1FillEnd(); @@ -842,7 +845,6 @@ isPressureStabilizedDuringFill = FALSE; isPressureDroppedDuringFill = FALSE; balChamberSWState = BAL_CHAMBER_SW_STATE2; - balChamberFillTimeoutCount = 0; lastPrevSpentDialPressure = 0.0F; prevSpentDialPressure = 0.0F; currentBalChamberSwitchingCounter = 0; @@ -927,6 +929,8 @@ BOOL isBothFillsComplete = FALSE; BOOL isFirstCycleNotDone = FALSE; BOOL isFillCompleteOrFirstCycle = FALSE; + BOOL isFillTimeoutEnabled = ( ( TRUE == isFirstCycleBCSwitchingCompleted ) && + ( FALSE == getBalChamberSwitchingOnlyStatus() ) ) ? TRUE : FALSE; freshDialPressure = getFilteredPressure( D18_PRES ); spentDialPressure = getFilteredPressure( D51_PRES ); @@ -941,8 +945,8 @@ } } - // If fill is taking too long, set an alarm for fill timeout - if ( ( balChamberFillTimeoutCount > 0 ) && ( currentBalChamberFillCounter > balChamberFillTimeoutCount ) ) + // After the first BC cycle, fault if fill never completes at the Qd-based timeout. + if ( ( TRUE == isFillTimeoutEnabled ) && ( balChamberFillTimeoutCount > 0 ) && ( currentBalChamberFillCounter > balChamberFillTimeoutCount ) ) { SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DD_BC_FILL_TIMEOUT_FAULT, currentBalChamberFillCounter, balChamberFillTimeoutCount ); @@ -954,15 +958,16 @@ checkSpentFillComplete( spentDialPressure ); // Check switching cycle time or pressure check for valve closure - isBothFillsComplete = ( TRUE == isSpentFillComplete ) && ( TRUE == isPressureStabilizedDuringFill ); - isFirstCycleNotDone = ( ( FALSE == isFirstCycleBCSwitchingCompleted ) && ( currentBalChamberSwitchingCounter >= balChamberValveClosePeriod ) && ( TRUE == getBalChamberSwitchingOnlyStatus() ) ); + isBothFillsComplete = ( ( TRUE == isSpentFillComplete ) && ( TRUE == isPressureStabilizedDuringFill ) ) ? TRUE : FALSE; + isFirstCycleNotDone = ( ( FALSE == isFirstCycleBCSwitchingCompleted ) && ( currentBalChamberSwitchingCounter >= balChamberValveClosePeriod ) ); if ( FALSE == getBalChamberSwitchingOnlyStatus() ) { - isFillCompleteOrFirstCycle = isBothFillsComplete || isFirstCycleNotDone; + isFillCompleteOrFirstCycle = ( ( TRUE == isBothFillsComplete ) || ( TRUE == isFirstCycleNotDone ) ) ? TRUE : FALSE; } - if ( TRUE == isFillCompleteOrFirstCycle ) + if ( ( TRUE == isFillCompleteOrFirstCycle ) || + ( ( currentBalChamberSwitchingCounter >= balChamberValveClosePeriod ) && ( TRUE == getBalChamberSwitchingOnlyStatus() ) ) ) { // close the valves valveControlForBCState2FillEnd(); Index: firmware/App/Controllers/ConcentratePumps.c =================================================================== diff -u -r99e5d1b4d1e3627576d680318887ac23cd1f34ce -r9ac050d6099effbdd62070173d14dd5e225d5310 --- firmware/App/Controllers/ConcentratePumps.c (.../ConcentratePumps.c) (revision 99e5d1b4d1e3627576d680318887ac23cd1f34ce) +++ firmware/App/Controllers/ConcentratePumps.c (.../ConcentratePumps.c) (revision 9ac050d6099effbdd62070173d14dd5e225d5310) @@ -266,10 +266,13 @@ //Monitor Pump Park status monitorPumpParkStatus(); - //Monitor Pump Speed - monitorPumpSpeed( D11_PUMP, ALARM_ID_DD_D11_PUMP_SPEED_CONTROL_ERROR ); - monitorPumpSpeed( D10_PUMP, ALARM_ID_DD_D10_PUMP_SPEED_CONTROL_ERROR ); - monitorPumpSpeed( D76_PUMP, ALARM_ID_DD_D76_PUMP_SPEED_CONTROL_ERROR ); + // Temporarily disable concentrate pump speed mismatch alarms + // monitorPumpSpeed( D11_PUMP, ALARM_ID_DD_D11_PUMP_SPEED_CONTROL_ERROR ); + // monitorPumpSpeed( D10_PUMP, ALARM_ID_DD_D10_PUMP_SPEED_CONTROL_ERROR ); + // monitorPumpSpeed( D76_PUMP, ALARM_ID_DD_D76_PUMP_SPEED_CONTROL_ERROR ); + resetPersistentAlarmTimer( ALARM_ID_DD_D11_PUMP_SPEED_CONTROL_ERROR ); + resetPersistentAlarmTimer( ALARM_ID_DD_D10_PUMP_SPEED_CONTROL_ERROR ); + resetPersistentAlarmTimer( ALARM_ID_DD_D76_PUMP_SPEED_CONTROL_ERROR ); checkPersistentAlarm( ALARM_ID_DD_CONCENTRATE_PUMP_FAULT, isConcPumpFault, fpgaConcPumpsFault, CONCENTRATE_PUMP_FAULT_PERSISTENCE_PERIOD ); @@ -513,6 +516,8 @@ { concentratePumps[ pumpId ].hasTurnOnPumpsBeenRequested = FALSE; hasParkBeenRequested[ pumpId ].data = park; + stopConcentratePump( pumpId ); + concentratePumps[ pumpId ].execState = CONCENTRATE_PUMP_OFF_STATE; } else { Index: firmware/App/DDCommon.h =================================================================== diff -u -r3215784ad2983eaab5afe0b86482fb6bfda4e8f1 -r9ac050d6099effbdd62070173d14dd5e225d5310 --- firmware/App/DDCommon.h (.../DDCommon.h) (revision 3215784ad2983eaab5afe0b86482fb6bfda4e8f1) +++ firmware/App/DDCommon.h (.../DDCommon.h) (revision 9ac050d6099effbdd62070173d14dd5e225d5310) @@ -40,8 +40,8 @@ //Uncomment below if barometric pressure sensor reading available //#define __BARO_PRES_SENSOR__ 1 -//Uncomment below if required hardware available ( baro and cond sensor) for testing -//#define ENABLE_ALARM_1 +//Uncomment below if TD is integrated with DD +#define ENABLE_ALARM_1 //Uncomment below once characterization/study completed //#define ENABLE_ALARM_2 @@ -57,9 +57,17 @@ //Uncomment below to disable revised heater model #define __REVISED_HEATER_MODEL__ 1 + // comment below to disable bicarb multi level sensor for time based chamber F fill #define CONDUCTIVE_LEVEL_SENSOR_ENABLED 1 +//Uncomment below to enable d30 heater alarm(as all units are not equipped with d30 temp sensor) +//#define ENABLE_ALARM_3 + +//Define to enable the DD too-many-bad-message-CRCs alarm. +//#define __BAD_MSG_CRC_ALARM_ENABLED__ 1 + + #include #include #endif Index: firmware/App/Modes/ModeFault.c =================================================================== diff -u -r6d4aa77e6b85aa7621a234660f631e725fb1d441 -r9ac050d6099effbdd62070173d14dd5e225d5310 --- firmware/App/Modes/ModeFault.c (.../ModeFault.c) (revision 6d4aa77e6b85aa7621a234660f631e725fb1d441) +++ firmware/App/Modes/ModeFault.c (.../ModeFault.c) (revision 9ac050d6099effbdd62070173d14dd5e225d5310) @@ -22,6 +22,7 @@ #include "ModeFault.h" #include "Messaging.h" #include "OperationModes.h" +#include "RinsePump.h" #include "SafetyShutdown.h" #include "Utilities.h" #include "Valves.h" @@ -203,6 +204,7 @@ requestConcentratePumpOff( D76_PUMP, parkPumps ); signalDialysatePumpHardStop( D12_PUMP ); signalDialysatePumpHardStop( D48_PUMP ); + setRinsePumpState( RINSE_PUMP_STATE_OFF ); stopHeater( D5_HEAT ); stopHeater( D45_HEAT ); } @@ -251,6 +253,7 @@ requestConcentratePumpOff( D76_PUMP, parkPumps ); signalDialysatePumpHardStop( D12_PUMP ); signalDialysatePumpHardStop( D48_PUMP ); + setRinsePumpState( RINSE_PUMP_STATE_OFF ); stopHeater( D5_HEAT ); stopHeater( D45_HEAT ); } Index: firmware/App/Monitors/Level.c =================================================================== diff -u -rb0da135bc589efaf8ad6f3c8c1988dcb672f3ca0 -r9ac050d6099effbdd62070173d14dd5e225d5310 --- firmware/App/Monitors/Level.c (.../Level.c) (revision b0da135bc589efaf8ad6f3c8c1988dcb672f3ca0) +++ firmware/App/Monitors/Level.c (.../Level.c) (revision 9ac050d6099effbdd62070173d14dd5e225d5310) @@ -206,6 +206,10 @@ SEND_EVENT_WITH_2_U32_DATA( DD_EVENT_D46_LEVL_CHANGE, (U32)status[ level ].data, (U32)currentLevelStatus ); break; + case P25_LEVL: + SEND_EVENT_WITH_2_U32_DATA( FP_EVENT_P25_LEVL_CHANGE, (U32)status[ level ].data, (U32)currentLevelStatus ); + break; + #ifndef _VECTORCAST_ default: SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DD_SOFTWARE_FAULT, SW_FAULT_ID_INVALID_LEVEL_SELECTED, level);