Index: firmware/App/Controllers/BalancingChamber.c =================================================================== diff -u -radb896670118e8db2f2bfa81c4325e8aad241ff3 -recd204503f9f4837800080a58c07dac8a2e8d602 --- firmware/App/Controllers/BalancingChamber.c (.../BalancingChamber.c) (revision adb896670118e8db2f2bfa81c4325e8aad241ff3) +++ firmware/App/Controllers/BalancingChamber.c (.../BalancingChamber.c) (revision ecd204503f9f4837800080a58c07dac8a2e8d602) @@ -59,7 +59,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 @@ -220,7 +220,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. @@ -513,7 +513,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; @@ -658,12 +658,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 ); @@ -685,15 +687,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(); @@ -824,7 +827,6 @@ isPressureStabilizedDuringFill = FALSE; isPressureDroppedDuringFill = FALSE; balChamberSWState = BAL_CHAMBER_SW_STATE2; - balChamberFillTimeoutCount = 0; lastPrevSpentDialPressure = 0.0F; prevSpentDialPressure = 0.0F; currentBalChamberSwitchingCounter = 0; @@ -908,6 +910,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 ); @@ -922,8 +926,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 ); @@ -935,15 +939,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 -rd0d24b086ffdfa00838570e24ffdf2194beb1e17 -recd204503f9f4837800080a58c07dac8a2e8d602 --- firmware/App/Controllers/ConcentratePumps.c (.../ConcentratePumps.c) (revision d0d24b086ffdfa00838570e24ffdf2194beb1e17) +++ firmware/App/Controllers/ConcentratePumps.c (.../ConcentratePumps.c) (revision ecd204503f9f4837800080a58c07dac8a2e8d602) @@ -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/Controllers/RinsePump.c =================================================================== diff -u -r94789b2f2324d5901685b6ff7b6224d4af3a0276 -recd204503f9f4837800080a58c07dac8a2e8d602 --- firmware/App/Controllers/RinsePump.c (.../RinsePump.c) (revision 94789b2f2324d5901685b6ff7b6224d4af3a0276) +++ firmware/App/Controllers/RinsePump.c (.../RinsePump.c) (revision ecd204503f9f4837800080a58c07dac8a2e8d602) @@ -79,7 +79,7 @@ { // Initialize controller variables rinsePumpDataPublicationTimerCounter = DATA_PUBLISH_COUNTER_START_COUNT; - currentRinsePumpState = RINSE_PUMP_STATE_INIT; + currentRinsePumpState = RINSE_PUMP_STATE_OFF; rinsePumpDataPublishInterval.data = RINSE_PUMP_DATA_PUB_INTERVAL; rinsePumpDataPublishInterval.ovData = RINSE_PUMP_DATA_PUB_INTERVAL; rinsePumpDataPublishInterval.ovInitData = RINSE_PUMP_DATA_PUB_INTERVAL; Index: firmware/App/Controllers/RinsePump.h =================================================================== diff -u -rd7c545dff2f13dd75ebab0af997c45047c844f7a -recd204503f9f4837800080a58c07dac8a2e8d602 --- firmware/App/Controllers/RinsePump.h (.../RinsePump.h) (revision d7c545dff2f13dd75ebab0af997c45047c844f7a) +++ firmware/App/Controllers/RinsePump.h (.../RinsePump.h) (revision ecd204503f9f4837800080a58c07dac8a2e8d602) @@ -52,8 +52,7 @@ /// Enumeration of air pump states. typedef enum RinsePumpControllerStates { - RINSE_PUMP_STATE_INIT = 0, ///< Rinse Pump Initialize state - RINSE_PUMP_STATE_OFF, ///< Rinse Pump Off state + RINSE_PUMP_STATE_OFF = 0, ///< Rinse Pump Off state RINSE_PUMP_STATE_ON, ///< Rinse Pump On state NUM_OF_RINSE_PUMP_STATES, ///< Number of rinse pump states } RINSE_PUMP_STATE_T; Index: firmware/App/DDCommon.h =================================================================== diff -u -r808d694515c024af48d842d52e005411390a7857 -recd204503f9f4837800080a58c07dac8a2e8d602 --- firmware/App/DDCommon.h (.../DDCommon.h) (revision 808d694515c024af48d842d52e005411390a7857) +++ firmware/App/DDCommon.h (.../DDCommon.h) (revision ecd204503f9f4837800080a58c07dac8a2e8d602) @@ -39,8 +39,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 @@ -54,7 +54,13 @@ //Uncomment below to disable revised heater model #define __REVISED_HEATER_MODEL__ 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/Drivers/BloodLeakDriver.c =================================================================== diff -u -r3a539af8f3320cc7e5d81aa1d39795e581e4a86d -recd204503f9f4837800080a58c07dac8a2e8d602 --- firmware/App/Drivers/BloodLeakDriver.c (.../BloodLeakDriver.c) (revision 3a539af8f3320cc7e5d81aa1d39795e581e4a86d) +++ firmware/App/Drivers/BloodLeakDriver.c (.../BloodLeakDriver.c) (revision ecd204503f9f4837800080a58c07dac8a2e8d602) @@ -1008,8 +1008,12 @@ response.responseLen = responseLen; memcpy( response.responseBuffer, responseBuffer, responseLen ); +#ifndef ENABLE_ALARM_1 + // TO0: Uncomment once TD is integrated result = sendMessage( MSG_ID_DD_SEND_BLOOD_LEAK_EMB_MODE_RESPONSE, COMM_BUFFER_OUT_DD_CAN_PC, (U08*)&response, sizeof( BLOOD_LEAK_EMB_MODE_RESP_T ) ); +#endif + return result; } Index: firmware/App/Drivers/ConductivityTeensy.c =================================================================== diff -u -rb04db69f541f245e543df343257bcbdb73fbbc3d -recd204503f9f4837800080a58c07dac8a2e8d602 --- firmware/App/Drivers/ConductivityTeensy.c (.../ConductivityTeensy.c) (revision b04db69f541f245e543df343257bcbdb73fbbc3d) +++ firmware/App/Drivers/ConductivityTeensy.c (.../ConductivityTeensy.c) (revision ecd204503f9f4837800080a58c07dac8a2e8d602) @@ -330,6 +330,10 @@ condCommState = handleConductivityRX(); break; + case COND_COMM_STATE_FAILED: + // TODO: Add handle function + break; + default: SET_ALARM_WITH_1_U32_DATA( ALARM_ID_DD_SOFTWARE_FAULT, ( U32 )condCommState ) break; Index: firmware/App/Modes/ModeFault.c =================================================================== diff -u -r6d0bd19fb192dcd272fa773e8833862cc8a8f750 -recd204503f9f4837800080a58c07dac8a2e8d602 --- firmware/App/Modes/ModeFault.c (.../ModeFault.c) (revision 6d0bd19fb192dcd272fa773e8833862cc8a8f750) +++ firmware/App/Modes/ModeFault.c (.../ModeFault.c) (revision ecd204503f9f4837800080a58c07dac8a2e8d602) @@ -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 -rfd897db8177752330ad08d877e0a13620513dbdc -recd204503f9f4837800080a58c07dac8a2e8d602 --- firmware/App/Monitors/Level.c (.../Level.c) (revision fd897db8177752330ad08d877e0a13620513dbdc) +++ firmware/App/Monitors/Level.c (.../Level.c) (revision ecd204503f9f4837800080a58c07dac8a2e8d602) @@ -206,6 +206,10 @@ SEND_EVENT_WITH_2_U32_DATA( DD_EVENT_D46_LEVL_CHANGE, (U32)status[ i ].data, (U32)currentLevelStatus ); break; + case P25_LEVL: + SEND_EVENT_WITH_2_U32_DATA( FP_EVENT_P25_LEVL_CHANGE, (U32)status[ i ].data, (U32)currentLevelStatus ); + break; + #ifndef _VECTORCAST_ default: SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DD_SOFTWARE_FAULT, SW_FAULT_ID_INVALID_LEVEL_SELECTED, i ); Index: firmware/App/Monitors/Temperature.c =================================================================== diff -u -r94789b2f2324d5901685b6ff7b6224d4af3a0276 -recd204503f9f4837800080a58c07dac8a2e8d602 --- firmware/App/Monitors/Temperature.c (.../Temperature.c) (revision 94789b2f2324d5901685b6ff7b6224d4af3a0276) +++ firmware/App/Monitors/Temperature.c (.../Temperature.c) (revision ecd204503f9f4837800080a58c07dac8a2e8d602) @@ -382,6 +382,7 @@ *************************************************************************/ void checkDialysateTemperatureSensors( void ) { +#ifdef ENABLE_ALARM_3 DD_OP_MODE_T op = getCurrentOperationMode(); if ( ( DD_MODE_GEND == op ) || ( DD_MODE_HEAT == op ) ) @@ -405,6 +406,10 @@ tempDriftEventCheck = FALSE; } } +#else + resetPersistentAlarmTimer( ALARM_ID_DD_DIALYSATE_TEMPERATURE_SENSORS_OUT_OF_RANGE ); + tempDriftEventCheck = FALSE; +#endif } /*********************************************************************//** Index: firmware/App/Services/AlarmMgmtDD.c =================================================================== diff -u -r830213bc6dcc1a684610caf78c79d55f2cb41e93 -recd204503f9f4837800080a58c07dac8a2e8d602 --- firmware/App/Services/AlarmMgmtDD.c (.../AlarmMgmtDD.c) (revision 830213bc6dcc1a684610caf78c79d55f2cb41e93) +++ firmware/App/Services/AlarmMgmtDD.c (.../AlarmMgmtDD.c) (revision ecd204503f9f4837800080a58c07dac8a2e8d602) @@ -116,8 +116,7 @@ if ( TRUE == isTransitionToFaultRequired() ) { // If alarm is a DD fault and the alarm manager can transition to fault immediately, go to fault mode - //TODO : Testing - remove the comment later - //requestNewOperationMode( DD_MODE_FAUL ); + requestNewOperationMode( DD_MODE_FAUL ); } } if ( ( TRUE == props.alarmIsDDFault ) && ( ALM_SRC_FP == props.alarmSource ) ) Index: firmware/App/Services/SystemCommDD.c =================================================================== diff -u -r830213bc6dcc1a684610caf78c79d55f2cb41e93 -recd204503f9f4837800080a58c07dac8a2e8d602 --- firmware/App/Services/SystemCommDD.c (.../SystemCommDD.c) (revision 830213bc6dcc1a684610caf78c79d55f2cb41e93) +++ firmware/App/Services/SystemCommDD.c (.../SystemCommDD.c) (revision ecd204503f9f4837800080a58c07dac8a2e8d602) @@ -91,8 +91,10 @@ // Initialize common system comm unit initSystemComm(); +#ifdef __BAD_MSG_CRC_ALARM_ENABLED__ // initialize bad message CRC time windowed count initTimeWindowedCount( TIME_WINDOWED_COUNT_BAD_MSG_CRC, MAX_COMM_CRC_FAILURES, MAX_COMM_CRC_FAILURE_WINDOW_MS ); +#endif // initialize FPGA clock speed error time windowed count initTimeWindowedCount( TIME_WINDOWED_COUNT_FPGA_CLOCK_SPEED_ERROR, MAX_FPGA_CLOCK_SPEED_ERRORS, MAX_FPGA_CLOCK_SPEED_ERROR_WINDOW_MS); @@ -268,10 +270,13 @@ *************************************************************************/ void checkTooManyBadMsgCRCs( void ) { + //TODO: Remove this as this was my current system specific. +#ifdef __BAD_MSG_CRC_ALARM_ENABLED__ if ( TRUE == incTimeWindowedCount( TIME_WINDOWED_COUNT_BAD_MSG_CRC ) ) { SET_ALARM_WITH_1_U32_DATA( ALARM_ID_DD_COMM_TOO_MANY_BAD_CRCS, 2 ); // 2 for DD } +#endif } /*********************************************************************//**