Index: firmware/App/Controllers/ConcentratePumps.c =================================================================== diff -u -r6499ea25921fcf67826fa0c35bb03caf411ba542 -re107dacab9f6c78574f1c26e1004e0dbdc8dba03 --- firmware/App/Controllers/ConcentratePumps.c (.../ConcentratePumps.c) (revision 6499ea25921fcf67826fa0c35bb03caf411ba542) +++ firmware/App/Controllers/ConcentratePumps.c (.../ConcentratePumps.c) (revision e107dacab9f6c78574f1c26e1004e0dbdc8dba03) @@ -209,14 +209,14 @@ #ifndef _RELEASE_ if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_CONCENTRATE_PUMPS_PARK ) != SW_CONFIG_ENABLE_VALUE ) +#endif { BOOL isAcidPumpParked = getMeasuredPumpSpeed( CONCENTRATEPUMPS_CP1_ACID ); BOOL isBicarbPumpParked = getMeasuredPumpSpeed( CONCENTRATEPUMPS_CP2_BICARB ); checkPersistentAlarm( ALARM_ID_DG_ACID_CONCENTRATE_PUMP_PARK_FAULT, isAcidPumpParked, isAcidPumpParked, CONENTREATE_PUMP_PARK_FAULT_TIMEOUT_MS ); checkPersistentAlarm( ALARM_ID_DG_BICARB_CONCENTRATE_PUMP_PARK_FAULT, isBicarbPumpParked, isBicarbPumpParked, CONENTREATE_PUMP_PARK_FAULT_TIMEOUT_MS ); } -#endif if ( ++concentratePumpMonitorTimerCounter >= getU32OverrideValue( &concentratePumpDataPublishInterval ) ) { Index: firmware/App/Controllers/ConductivitySensors.c =================================================================== diff -u -r19ddae332910253204721af6204594467096f468 -re107dacab9f6c78574f1c26e1004e0dbdc8dba03 --- firmware/App/Controllers/ConductivitySensors.c (.../ConductivitySensors.c) (revision 19ddae332910253204721af6204594467096f468) +++ firmware/App/Controllers/ConductivitySensors.c (.../ConductivitySensors.c) (revision e107dacab9f6c78574f1c26e1004e0dbdc8dba03) @@ -307,17 +307,17 @@ case DG_MODE_GENE: case DG_MODE_FILL: case DG_MODE_DRAI: - if ( ( conductivity >= MIN_COND_SENSOR_CPI_WARNING_LOW_US_PER_CM ) && ( TRUE == isAlarmActive( ALARM_ID_INLET_WATER_CONDUCTIVITY_IN_LOW_RANGE ) ) ) + if ( TRUE == isAlarmActive( ALARM_ID_INLET_WATER_CONDUCTIVITY_IN_LOW_RANGE ) ) { - isConductTooLow = FALSE; + isConductTooLow = ( conductivity >= MIN_COND_SENSOR_CPI_WARNING_LOW_US_PER_CM ? FALSE : TRUE ); } // Per PRS 403 checkPersistentAlarm( ALARM_ID_INLET_WATER_CONDUCTIVITY_IN_LOW_RANGE, isConductTooLow, conductivity, MAX_COND_SENSOR_CPI_WARNING_LOW_US_PER_CM ); - if ( ( conductivity <= MIN_COND_SENSOR_CPI_WARNING_HIGH_US_PER_CM ) && ( TRUE == isAlarmActive( ALARM_ID_INLET_WATER_CONDUCTIVITY_IN_HIGH_RANGE ) ) ) + if ( TRUE == isAlarmActive( ALARM_ID_INLET_WATER_CONDUCTIVITY_IN_HIGH_RANGE ) ) { - isConductTooHigh = FALSE; + isConductTooHigh = ( conductivity <= MIN_COND_SENSOR_CPI_WARNING_HIGH_US_PER_CM ? FALSE : TRUE ); } // Per PRS 404 Index: firmware/App/Controllers/Pressures.c =================================================================== diff -u -r19ddae332910253204721af6204594467096f468 -re107dacab9f6c78574f1c26e1004e0dbdc8dba03 --- firmware/App/Controllers/Pressures.c (.../Pressures.c) (revision 19ddae332910253204721af6204594467096f468) +++ firmware/App/Controllers/Pressures.c (.../Pressures.c) (revision e107dacab9f6c78574f1c26e1004e0dbdc8dba03) @@ -151,8 +151,8 @@ msrdPressureSum[ i ] = 0; } - initPersistentAlarm( ALARM_ID_INLET_WATER_PRESSURE_IN_LOW_RANGE, INLET_WATER_PRES_OUT_OF_RANGE_TIMEOUT_MS, INLET_WATER_PRES_OUT_OF_RANGE_CLEAR_MS ); - initPersistentAlarm( ALARM_ID_INLET_WATER_PRESSURE_IN_HIGH_RANGE, INLET_WATER_PRES_OUT_OF_RANGE_TIMEOUT_MS, INLET_WATER_PRES_OUT_OF_RANGE_CLEAR_MS ); + initPersistentAlarm( ALARM_ID_INLET_WATER_PRESSURE_IN_LOW_RANGE, INLET_WATER_PRES_OUT_OF_RANGE_CLEAR_MS, INLET_WATER_PRES_OUT_OF_RANGE_TIMEOUT_MS ); + initPersistentAlarm( ALARM_ID_INLET_WATER_PRESSURE_IN_HIGH_RANGE, INLET_WATER_PRES_OUT_OF_RANGE_CLEAR_MS, INLET_WATER_PRES_OUT_OF_RANGE_TIMEOUT_MS ); initPersistentAlarm( ALARM_ID_DG_PRESSURE_OUT_OF_RANGE, PRESSURE_OUT_OF_RANGE_TIMEOUT_MS, PRESSURE_OUT_OF_RANGE_TIMEOUT_MS ); initPersistentAlarm( ALARM_ID_DG_BARO_PRESSURE_OUT_OF_RANGE, PRESSURE_OUT_OF_RANGE_TIMEOUT_MS, PRESSURE_OUT_OF_RANGE_TIMEOUT_MS ); initPersistentAlarm( ALARM_ID_DG_CLEANING_MODE_INLET_WATER_PRESSURE_TOO_HIGH, INLET_WATER_PRES_OUT_OF_RANGE_TIMEOUT_MS, INLET_WATER_PRES_OUT_OF_RANGE_TIMEOUT_MS ); @@ -183,17 +183,17 @@ case DG_MODE_GENE: case DG_MODE_FILL: case DG_MODE_DRAI: - if ( ( pressure >= MIN_INLET_WATER_PRESSURE_WARNING_LOW_PSIG ) && ( TRUE == isAlarmActive( ALARM_ID_INLET_WATER_PRESSURE_IN_LOW_RANGE ) ) ) + if ( TRUE == isAlarmActive( ALARM_ID_INLET_WATER_PRESSURE_IN_LOW_RANGE ) ) { - isPressureTooLow = FALSE; + isPressureTooLow = ( pressure >= MIN_INLET_WATER_PRESSURE_WARNING_LOW_PSIG ? FALSE : TRUE ); } // Per PRS 401 checkPersistentAlarm( ALARM_ID_INLET_WATER_PRESSURE_IN_LOW_RANGE, isPressureTooLow, pressure, MAX_INLET_WATER_PRESSURE_WARNING_LOW_PSIG ); - if ( ( pressure <= MIN_INLET_WATER_PRESSURE_WARNING_HIGH_PSIG ) && ( TRUE == isAlarmActive( ALARM_ID_INLET_WATER_PRESSURE_IN_HIGH_RANGE ) ) ) + if ( TRUE == isAlarmActive( ALARM_ID_INLET_WATER_PRESSURE_IN_HIGH_RANGE ) ) { - isPressureTooHigh = FALSE; + isPressureTooHigh = ( pressure <= MIN_INLET_WATER_PRESSURE_WARNING_HIGH_PSIG ? FALSE : TRUE ); } // Per PRS 841 Index: firmware/App/Controllers/TemperatureSensors.c =================================================================== diff -u -r19ddae332910253204721af6204594467096f468 -re107dacab9f6c78574f1c26e1004e0dbdc8dba03 --- firmware/App/Controllers/TemperatureSensors.c (.../TemperatureSensors.c) (revision 19ddae332910253204721af6204594467096f468) +++ firmware/App/Controllers/TemperatureSensors.c (.../TemperatureSensors.c) (revision e107dacab9f6c78574f1c26e1004e0dbdc8dba03) @@ -435,17 +435,17 @@ case DG_MODE_GENE: case DG_MODE_FILL: case DG_MODE_DRAI: - if ( ( temperature <= MIN_WATER_TEMPERATURE_WARNING_HIGH_RANGE ) && ( TRUE == isAlarmActive( ALARM_ID_INLET_WATER_TEMPERATURE_IN_HIGH_RANGE ) ) ) + if ( TRUE == isAlarmActive( ALARM_ID_INLET_WATER_TEMPERATURE_IN_HIGH_RANGE ) ) { - isWaterTempInHighRange = FALSE; + isWaterTempInHighRange = ( temperature <= MIN_WATER_TEMPERATURE_WARNING_HIGH_RANGE ? FALSE : TRUE ); } // Per PRS 406 checkPersistentAlarm( ALARM_ID_INLET_WATER_TEMPERATURE_IN_HIGH_RANGE, isWaterTempInHighRange, temperature, MAX_WATER_TEMPERATURE_WARNING_HIGH_RANGE ); - if ( ( temperature >= MAX_WATER_TEMPERATURE_WARNING_LOW_RANGE ) && ( TRUE == isAlarmActive( ALARM_ID_INLET_WATER_TEMPERATURE_IN_LOW_RANGE ) ) ) + if ( TRUE == isAlarmActive( ALARM_ID_INLET_WATER_TEMPERATURE_IN_LOW_RANGE ) ) { - isWaterTempInLowRange = FALSE; + isWaterTempInLowRange = ( temperature >= MAX_WATER_TEMPERATURE_WARNING_LOW_RANGE ? FALSE : TRUE ); } // Per PRS 405 Index: firmware/App/Modes/ModeChemicalDisinfect.c =================================================================== diff -u -rfcaca0915c314d04b9fa96c1960d32b63ab877db -re107dacab9f6c78574f1c26e1004e0dbdc8dba03 --- firmware/App/Modes/ModeChemicalDisinfect.c (.../ModeChemicalDisinfect.c) (revision fcaca0915c314d04b9fa96c1960d32b63ab877db) +++ firmware/App/Modes/ModeChemicalDisinfect.c (.../ModeChemicalDisinfect.c) (revision e107dacab9f6c78574f1c26e1004e0dbdc8dba03) @@ -53,7 +53,7 @@ // Drain R1 & R2 states defines #define DRAIN_PUMP_TARGET_RPM 2400 ///< Drain pump target RPM during drain. -#define DRAIN_WEIGHT_UNCHANGE_TIMEOUT ( 6 * MS_PER_SECOND ) ///< Time period of unchanged weight during draining before timeout. +#define DRAIN_WEIGHT_UNCHANGE_TIMEOUT_MS ( 6 * MS_PER_SECOND ) ///< Time period of unchanged weight during draining before timeout. #define RSRVRS_DRAIN_TIMEOUT_MS ( 2 * SEC_PER_MIN * MS_PER_SECOND ) ///< Reservoirs 1 & 2 drain timeout in ms. #define RSRVRS_INITIAL_DRAIN_TIMEOUT_MS ( 2 * SEC_PER_MIN * MS_PER_SECOND ) ///< Reservoirs 1 & 2 initial drain time out in milliseconds. @@ -107,7 +107,7 @@ #define DISINFECT_TEMP_OUT_OF_RANGE_TIMEOUT_MS ( 1 * MS_PER_SECOND ) ///< Chemical disinfect temperature out of range in milliseconds. // Initial disinfectant fill of R1 and R2 -#define RSRVRS_FULL_VOL_ML 1800.0F ///< Reservoirs 1 & 2 full volume in mL. +#define RSRVRS_FULL_VOL_ML 1850.0F ///< Reservoirs 1 & 2 full volume in mL. #define RSRVRS_LEAK_VOL_TIMEOUT_TASK_INT ( ( 30 * MS_PER_SECOND ) / TASK_GENERAL_INTERVAL ) ///< Time delay for declaring that reservoir is leaking due to volume depletion. #define RSRVRS_MAX_LEAK_VOL_CHANGE_ML 100.0F; ///< Volume loss that is necessary to declare a reservoir leak. @@ -480,7 +480,7 @@ if ( DG_RESERVOIR_ABOVE_TARGET == rsrvr1Status ) { - rsrvr1Status = getRsrvrDrainStatus( DG_RESERVOIR_1, DRAIN_WEIGHT_UNCHANGE_TIMEOUT, RSRVRS_INITIAL_DRAIN_TIMEOUT_MS ); + rsrvr1Status = getRsrvrDrainStatus( DG_RESERVOIR_1, DRAIN_WEIGHT_UNCHANGE_TIMEOUT_MS, RSRVRS_INITIAL_DRAIN_TIMEOUT_MS ); } else if ( DG_RESERVOIR_REACHED_TARGET == rsrvr1Status ) { // Done with draining R1 @@ -522,7 +522,7 @@ if ( DG_RESERVOIR_ABOVE_TARGET == rsrvr2Status ) { - rsrvr2Status = getRsrvrDrainStatus( DG_RESERVOIR_2, DRAIN_WEIGHT_UNCHANGE_TIMEOUT, RSRVRS_INITIAL_DRAIN_TIMEOUT_MS ); + rsrvr2Status = getRsrvrDrainStatus( DG_RESERVOIR_2, DRAIN_WEIGHT_UNCHANGE_TIMEOUT_MS, RSRVRS_INITIAL_DRAIN_TIMEOUT_MS ); } else if ( DG_RESERVOIR_REACHED_TARGET == rsrvr2Status ) { @@ -1175,7 +1175,7 @@ if ( DG_RESERVOIR_ABOVE_TARGET == rsrvr2Status ) { // If the cancellation water path cannot be done, got to basic cancellation path - rsrvr2Status = getRsrvrDrainStatus( DG_RESERVOIR_2, DRAIN_WEIGHT_UNCHANGE_TIMEOUT, RSRVRS_INITIAL_DRAIN_TIMEOUT_MS ); + rsrvr2Status = getRsrvrDrainStatus( DG_RESERVOIR_2, DRAIN_WEIGHT_UNCHANGE_TIMEOUT_MS, RSRVRS_INITIAL_DRAIN_TIMEOUT_MS ); if ( DG_RESERVOIR_REACHED_TARGET == rsrvr2Status ) { @@ -1195,7 +1195,7 @@ if ( ( DG_RESERVOIR_REACHED_TARGET == rsrvr2Status ) && ( DG_RESERVOIR_ABOVE_TARGET == rsrvr1Status ) ) { // If the cancellation water path cannot be done, got to basic cancellation path - rsrvr1Status = getRsrvrDrainStatus( DG_RESERVOIR_1, DRAIN_WEIGHT_UNCHANGE_TIMEOUT, RSRVRS_INITIAL_DRAIN_TIMEOUT_MS ); + rsrvr1Status = getRsrvrDrainStatus( DG_RESERVOIR_1, DRAIN_WEIGHT_UNCHANGE_TIMEOUT_MS, RSRVRS_INITIAL_DRAIN_TIMEOUT_MS ); if ( DG_RESERVOIR_REACHED_TARGET == rsrvr1Status ) { @@ -1625,7 +1625,7 @@ #endif { // If the dialysate cap is open during any state, alarm - if ( STATE_OPEN == getSwitchStatus( DIALYSATE_CAP ) ) + if ( ( STATE_OPEN == getSwitchStatus( DIALYSATE_CAP ) ) && ( chemDisinfectState != DG_CHEM_DISINFECT_STATE_START ) ) { prevChemDisinfectState = chemDisinfectState; chemDisinfectState = DG_CHEM_DISINFECT_STATE_CANCEL_WATER_PATH; Index: firmware/App/Modes/ModeChemicalDisinfectFlush.c =================================================================== diff -u -r19ddae332910253204721af6204594467096f468 -re107dacab9f6c78574f1c26e1004e0dbdc8dba03 --- firmware/App/Modes/ModeChemicalDisinfectFlush.c (.../ModeChemicalDisinfectFlush.c) (revision 19ddae332910253204721af6204594467096f468) +++ firmware/App/Modes/ModeChemicalDisinfectFlush.c (.../ModeChemicalDisinfectFlush.c) (revision e107dacab9f6c78574f1c26e1004e0dbdc8dba03) @@ -52,8 +52,8 @@ // Drain R1 & R2 states defines #define DRAIN_PUMP_TARGET_RPM 2400 ///< Drain pump target RPM during drain. #define RSRVRS_INITIAL_FINAL_DRAIN_TIME_OUT_MS ( 2 * SEC_PER_MIN * MS_PER_SECOND ) ///< Reservoirs 1 & 2 initial drain time out in milliseconds. -#define RSRVRS_INITIAL_DRAIN_TIMEOUT_MS ( 2 * SEC_PER_MIN * MS_PER_SECOND ) ///< Reservoirs 1 & 2 initial drain time out in milliseconds. -#define DRAIN_WEIGHT_UNCHANGE_TIMEOUT ( 6 * MS_PER_SECOND ) ///< Time period of unchanged weight during draining before timeout. +#define RSRVRS_INITIAL_DRAIN_TIMEOUT_MS ( 2 * SEC_PER_MIN * MS_PER_SECOND ) ///< Reservoirs 1 & 2 initial drain time out in milliseconds. +#define DRAIN_WEIGHT_UNCHANGE_TIMEOUT_MS ( 6 * MS_PER_SECOND ) ///< Time period of unchanged weight during draining before timeout. // Flush drain path state defines #define FLUSH_DRAIN_WAIT_TIME_MS ( 1 * SEC_PER_MIN * MS_PER_SECOND ) ///< Flush Drain path wait time in milliseconds. @@ -74,7 +74,7 @@ // Fill reservoirs to full defines #define RESERVOIR_FULL_VOLUME_CHANGE_LIMIT_ML 5.0F ///< The maximum difference between the short-term and long-term filtered reservoir volumes in ml that determines the reservoir is full. -#define RESERVOIR_MINIMUM_FULL_VOLUME_ML 1700.0F ///< When filling the reservoir, the volume reading must be at least this value before checking for the volume to level off. +#define RESERVOIR_MINIMUM_FULL_VOLUME_ML 1850.0F ///< When filling the reservoir, the volume reading must be at least this value before checking for the volume to level off. #define RSRVRS_FILL_TO_FULL_STABLE_TASK_INT ( ( 2 * MS_PER_SECOND ) / TASK_GENERAL_INTERVAL ) ///< Reservoirs 1 & 2 full stable time in task intervals. // Flush disinfectant lines and flush UF defines @@ -371,7 +371,7 @@ if ( DG_RESERVOIR_ABOVE_TARGET == rsrvr1Status ) { - rsrvr1Status = getRsrvrDrainStatus( DG_RESERVOIR_1, DRAIN_WEIGHT_UNCHANGE_TIMEOUT, RSRVRS_INITIAL_FINAL_DRAIN_TIME_OUT_MS ); + rsrvr1Status = getRsrvrDrainStatus( DG_RESERVOIR_1, DRAIN_WEIGHT_UNCHANGE_TIMEOUT_MS, RSRVRS_INITIAL_FINAL_DRAIN_TIME_OUT_MS ); } else if ( DG_RESERVOIR_REACHED_TARGET == rsrvr1Status ) { @@ -412,11 +412,12 @@ if ( DG_RESERVOIR_ABOVE_TARGET == rsrvr2Status ) { - rsrvr2Status = getRsrvrDrainStatus( DG_RESERVOIR_2, DRAIN_WEIGHT_UNCHANGE_TIMEOUT, RSRVRS_INITIAL_FINAL_DRAIN_TIME_OUT_MS ); + rsrvr2Status = getRsrvrDrainStatus( DG_RESERVOIR_2, DRAIN_WEIGHT_UNCHANGE_TIMEOUT_MS, RSRVRS_INITIAL_FINAL_DRAIN_TIME_OUT_MS ); } else if ( DG_RESERVOIR_REACHED_TARGET == rsrvr2Status ) { signalDrainPumpHardStop(); // Done with draining + setValveState( VRD2, VALVE_STATE_CLOSED ); if ( TRUE == isThisLastDrain ) { @@ -591,7 +592,6 @@ else if ( DG_RESERVOIR_NOT_REACHED_TARGET == rsrvr2Status ) { prevChemDisinfectFlushState = state; - alarmDetectedPendingTrigger = ALARM_ID_DG_RESERVOIR_FILL_TIMEOUT; state = DG_CHEM_DISINFECT_FLUSH_STATE_CANCEL_WATER_PATH; } } @@ -663,7 +663,6 @@ else if ( DG_RESERVOIR_NOT_REACHED_TARGET == rsrvr1Status ) { prevChemDisinfectFlushState = state; - alarmDetectedPendingTrigger = ALARM_ID_DG_RESERVOIR_FILL_TIMEOUT; state = DG_CHEM_DISINFECT_FLUSH_STATE_CANCEL_WATER_PATH; } } @@ -713,6 +712,7 @@ if ( ( TRUE == didTimeout( stateTimer, SAMPLE_FLUSH_WAIT_TIME_MS ) ) && ( FALSE == hasAlarmBeenTriggered ) ) { hasAlarmBeenTriggered = TRUE; + setValveState( VRC, VALVE_STATE_RECIRC_C_TO_NC ); activateAlarmNoData( ALARM_ID_DG_CHEM_DISINFECT_FLUSH_FLUSH_SAMPLE ); } @@ -732,7 +732,6 @@ setValveState( VPO, VALVE_STATE_FILL_C_TO_NC ); setValveState( VRD1, VALVE_STATE_OPEN ); setValveState( VRD2, VALVE_STATE_CLOSED ); - setDrainPumpTargetRPM( DRAIN_PUMP_TARGET_RPM ); isThisLastDrain = TRUE; rsrvr1Status = DG_RESERVOIR_ABOVE_TARGET; @@ -807,7 +806,7 @@ if ( DG_RESERVOIR_ABOVE_TARGET == rsrvr2Status ) { // If the cancellation water path cannot be done, got to basic cancellation path - rsrvr2Status = getRsrvrDrainStatus( DG_RESERVOIR_2, DRAIN_WEIGHT_UNCHANGE_TIMEOUT, RSRVRS_INITIAL_DRAIN_TIMEOUT_MS ); + rsrvr2Status = getRsrvrDrainStatus( DG_RESERVOIR_2, DRAIN_WEIGHT_UNCHANGE_TIMEOUT_MS, RSRVRS_INITIAL_DRAIN_TIMEOUT_MS ); if ( DG_RESERVOIR_REACHED_TARGET == rsrvr2Status ) { @@ -827,7 +826,7 @@ if ( ( DG_RESERVOIR_REACHED_TARGET == rsrvr2Status ) && ( DG_RESERVOIR_ABOVE_TARGET == rsrvr1Status ) ) { // If the cancellation water path cannot be done, got to basic cancellation path - rsrvr1Status = getRsrvrDrainStatus( DG_RESERVOIR_1, DRAIN_WEIGHT_UNCHANGE_TIMEOUT, RSRVRS_INITIAL_DRAIN_TIMEOUT_MS ); + rsrvr1Status = getRsrvrDrainStatus( DG_RESERVOIR_1, DRAIN_WEIGHT_UNCHANGE_TIMEOUT_MS, RSRVRS_INITIAL_DRAIN_TIMEOUT_MS ); if ( DG_RESERVOIR_REACHED_TARGET == rsrvr1Status ) { @@ -901,7 +900,7 @@ static DG_RESERVOIR_STATUS_T getRsrvrDrainStatus( DG_RESERVOIR_ID_T r, U32 drainSteadyStateTimeout, U32 timeout ) { DG_RESERVOIR_STATUS_T status = DG_RESERVOIR_ABOVE_TARGET; - BOOL isDrainComplete = hasTargetDrainVolumeBeenReached( r, drainSteadyStateTimeout ); + BOOL isDrainComplete = FALSE; // If the drain parameters of the reservoir is not initialized, initialize them if ( FALSE == haveDrainParamsBeenInit[ r ] ) @@ -910,6 +909,10 @@ haveDrainParamsBeenInit[ r ] = TRUE; } + // NOTE: the drain status should be checked once the reservoirs parameters are initialized. This is to make sure the + // the timers for stable drain time are initialized prior to using them again + isDrainComplete = hasTargetDrainVolumeBeenReached( r, drainSteadyStateTimeout ); + if ( TRUE == isDrainComplete ) { stateTimer = getMSTimerCount(); @@ -943,31 +946,27 @@ { DG_RESERVOIR_STATUS_T status = DG_RESERVOIR_BELOW_TARGET; F32 currentVolume = 0.0F; - F32 filteredVolume = 0.0F; if ( DG_RESERVOIR_1 == r ) { currentVolume = getLoadCellSmallFilteredWeight( LOAD_CELL_RESERVOIR_1_PRIMARY ); - filteredVolume = getLoadCellLargeFilteredWeight( LOAD_CELL_RESERVOIR_1_PRIMARY ); } else if ( DG_RESERVOIR_2 == r ) { currentVolume = getLoadCellSmallFilteredWeight( LOAD_CELL_RESERVOIR_2_PRIMARY ); - filteredVolume = getLoadCellLargeFilteredWeight( LOAD_CELL_RESERVOIR_2_PRIMARY ); } else { SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DG_SOFTWARE_FAULT, SW_FAULT_ID_INVALID_DG_RESERVOIR_SELECTED, r ) } // Check the volume of the reservoir against the previous volume - if ( ( currentVolume > RESERVOIR_MINIMUM_FULL_VOLUME_ML ) && ( fabs( currentVolume - filteredVolume ) < RESERVOIR_FULL_VOLUME_CHANGE_LIMIT_ML ) ) + if ( currentVolume >= RESERVOIR_MINIMUM_FULL_VOLUME_ML ) { if ( ++rsrvrFillToFullStableTimerCounter >= RSRVRS_FILL_TO_FULL_STABLE_TASK_INT ) { status = DG_RESERVOIR_REACHED_TARGET; rsrvrFillToFullStableTimerCounter = 0; - // Set the state timer in case it needs to be used for another timeout check stateTimer = getMSTimerCount(); } } @@ -978,10 +977,7 @@ alarmDetectedPendingTrigger = ALARM_ID_DG_RESERVOIR_FILL_TIMEOUT; status = DG_RESERVOIR_NOT_REACHED_TARGET; } - else - { - rsrvrFillToFullStableTimerCounter = 0; - } + return status; } @@ -1038,9 +1034,12 @@ // If either the dialysate cap or the concentrate cap is open during any state, alarm if ( ( STATE_OPEN == getSwitchStatus( CONCENTRATE_CAP ) ) || ( STATE_OPEN == getSwitchStatus( DIALYSATE_CAP ) ) ) { - prevChemDisinfectFlushState = chemDisinfectFlushState; - chemDisinfectFlushState = DG_CHEM_DISINFECT_FLUSH_STATE_CANCEL_WATER_PATH; - alarmDetectedPendingTrigger = ALARM_ID_DG_DIALYSATE_OR_CONC_CAP_NOT_IN_PROPER_POSITION; + if ( chemDisinfectFlushState != DG_CHEM_DISINFECT_FLUSH_STATE_START ) + { + prevChemDisinfectFlushState = chemDisinfectFlushState; + chemDisinfectFlushState = DG_CHEM_DISINFECT_FLUSH_STATE_CANCEL_WATER_PATH; + alarmDetectedPendingTrigger = ALARM_ID_DG_DIALYSATE_OR_CONC_CAP_NOT_IN_PROPER_POSITION; + } } } Index: firmware/App/Modes/ModeDrain.c =================================================================== diff -u -rb8f298547eb578000b3ff3cf55732fda7a689ce0 -re107dacab9f6c78574f1c26e1004e0dbdc8dba03 --- firmware/App/Modes/ModeDrain.c (.../ModeDrain.c) (revision b8f298547eb578000b3ff3cf55732fda7a689ce0) +++ firmware/App/Modes/ModeDrain.c (.../ModeDrain.c) (revision e107dacab9f6c78574f1c26e1004e0dbdc8dba03) @@ -40,7 +40,7 @@ // ********** private definitions ********** #define TARGET_DRAIN_PUMP_RPM 2400 ///< Target drain pump speed (in RPM). -#define DRAIN_WEIGHT_UNCHANGE_TIMEOUT ( 2 * MS_PER_SECOND ) ///< Time period of unchanged weight during draining before timeout. +#define DRAIN_WEIGHT_UNCHANGE_TIMEOUT_MS ( 2 * MS_PER_SECOND ) ///< Time period of unchanged weight during draining before timeout. #define DRAIN_EMPTY_TARE_WAIT ( MS_PER_SECOND / TASK_GENERAL_INTERVAL ) /// Time period to wait after drain complete and before taring load cells. @@ -232,7 +232,7 @@ DG_RESERVOIR_ID_T inactiveReservoir = getInactiveReservoir(); // if we have reached our target drain to volume (by weight) or cannot drain anymore, we are done draining - go back to generation idle mode - if ( TRUE == hasTargetDrainVolumeBeenReached( inactiveReservoir, DRAIN_WEIGHT_UNCHANGE_TIMEOUT ) ) + if ( TRUE == hasTargetDrainVolumeBeenReached( inactiveReservoir, DRAIN_WEIGHT_UNCHANGE_TIMEOUT_MS ) ) { DG_ACID_CONCENTRATES_RECORD_T acid; F32 acidBottleVolML; Index: firmware/App/Modes/ModeFlush.c =================================================================== diff -u -rfcaca0915c314d04b9fa96c1960d32b63ab877db -re107dacab9f6c78574f1c26e1004e0dbdc8dba03 --- firmware/App/Modes/ModeFlush.c (.../ModeFlush.c) (revision fcaca0915c314d04b9fa96c1960d32b63ab877db) +++ firmware/App/Modes/ModeFlush.c (.../ModeFlush.c) (revision e107dacab9f6c78574f1c26e1004e0dbdc8dba03) @@ -51,7 +51,7 @@ #define DRAIN_PUMP_TARGET_RPM 2400 ///< Drain pump target RPM during drain. // Drain R1 & R2 states defines -#define DRAIN_WEIGHT_UNCHANGE_TIMEOUT ( 6 * MS_PER_SECOND ) ///< Time period of unchanged weight during draining before timeout. +#define DRAIN_WEIGHT_UNCHANGE_TIMEOUT_MS ( 6 * MS_PER_SECOND ) ///< Time period of unchanged weight during draining before timeout. // Flush drain path state defines #define FLUSH_DRAIN_WAIT_TIME_MS ( 2 * 60 * MS_PER_SECOND ) ///< Flush Drain path wait time in milliseconds. @@ -361,7 +361,7 @@ if ( DG_RESERVOIR_ABOVE_TARGET == rsrvr1Status ) { - rsrvr1Status = getRsrvrDrainStatus( DG_RESERVOIR_1, DRAIN_WEIGHT_UNCHANGE_TIMEOUT, RSRVRS_DRAIN_TIMEOUT_MS ); + rsrvr1Status = getRsrvrDrainStatus( DG_RESERVOIR_1, DRAIN_WEIGHT_UNCHANGE_TIMEOUT_MS, RSRVRS_DRAIN_TIMEOUT_MS ); } else if ( DG_RESERVOIR_REACHED_TARGET == rsrvr1Status ) { @@ -407,7 +407,7 @@ if ( DG_RESERVOIR_ABOVE_TARGET == rsrvr2Status ) { - rsrvr2Status = getRsrvrDrainStatus( DG_RESERVOIR_2, DRAIN_WEIGHT_UNCHANGE_TIMEOUT, RSRVRS_DRAIN_TIMEOUT_MS ); + rsrvr2Status = getRsrvrDrainStatus( DG_RESERVOIR_2, DRAIN_WEIGHT_UNCHANGE_TIMEOUT_MS, RSRVRS_DRAIN_TIMEOUT_MS ); } else if ( DG_RESERVOIR_REACHED_TARGET == rsrvr2Status ) { @@ -644,7 +644,7 @@ // If reservoir 1 is empty, turn off the drain pump if ( DG_RESERVOIR_ABOVE_TARGET == rsrvr1Status ) { - rsrvr1Status = getRsrvrDrainStatus( DG_RESERVOIR_1, DRAIN_WEIGHT_UNCHANGE_TIMEOUT, RSRVRS_DRAIN_TIMEOUT_MS ); + rsrvr1Status = getRsrvrDrainStatus( DG_RESERVOIR_1, DRAIN_WEIGHT_UNCHANGE_TIMEOUT_MS, RSRVRS_DRAIN_TIMEOUT_MS ); } else if ( DG_RESERVOIR_REACHED_TARGET == rsrvr1Status ) { @@ -885,7 +885,7 @@ if ( DG_RESERVOIR_ABOVE_TARGET == rsrvr2Status ) { // If the cancellation water path cannot be done, got to basic cancellation path - rsrvr2Status = getRsrvrDrainStatus( DG_RESERVOIR_2, DRAIN_WEIGHT_UNCHANGE_TIMEOUT, RSRVRS_DRAIN_TIMEOUT_MS ); + rsrvr2Status = getRsrvrDrainStatus( DG_RESERVOIR_2, DRAIN_WEIGHT_UNCHANGE_TIMEOUT_MS, RSRVRS_DRAIN_TIMEOUT_MS ); if ( DG_RESERVOIR_REACHED_TARGET == rsrvr2Status ) { @@ -902,7 +902,7 @@ if ( ( DG_RESERVOIR_REACHED_TARGET == rsrvr2Status ) && ( DG_RESERVOIR_ABOVE_TARGET == rsrvr1Status ) ) { // If the cancellation water path cannot be done, go to basic cancellation path - rsrvr1Status = getRsrvrDrainStatus( DG_RESERVOIR_1, DRAIN_WEIGHT_UNCHANGE_TIMEOUT, RSRVRS_DRAIN_TIMEOUT_MS ); + rsrvr1Status = getRsrvrDrainStatus( DG_RESERVOIR_1, DRAIN_WEIGHT_UNCHANGE_TIMEOUT_MS, RSRVRS_DRAIN_TIMEOUT_MS ); if ( DG_RESERVOIR_REACHED_TARGET == rsrvr1Status ) { @@ -1032,6 +1032,7 @@ static DG_RESERVOIR_STATUS_T getRsrvrDrainStatus( DG_RESERVOIR_ID_T r, U32 drainSteadyStateTimeout, U32 timeout ) { DG_RESERVOIR_STATUS_T status = DG_RESERVOIR_ABOVE_TARGET; + BOOL isDrainComplete = FALSE; // If the drain parameters of the reservoir is not initialized, initialize them if ( FALSE == haveDrainParamsBeenInit [ r ] ) @@ -1040,7 +1041,9 @@ haveDrainParamsBeenInit[ r ] = TRUE; } - BOOL isDrainComplete = hasTargetDrainVolumeBeenReached( r, drainSteadyStateTimeout ); + // NOTE: the drain status should be checked once the reservoirs parameters are initialized. This is to make sure the + // the timers for stable drain time are initialized prior to using them again + isDrainComplete = hasTargetDrainVolumeBeenReached( r, drainSteadyStateTimeout ); if ( TRUE == isDrainComplete ) { Index: firmware/App/Modes/ModeHeatDisinfect.c =================================================================== diff -u -rfcaca0915c314d04b9fa96c1960d32b63ab877db -re107dacab9f6c78574f1c26e1004e0dbdc8dba03 --- firmware/App/Modes/ModeHeatDisinfect.c (.../ModeHeatDisinfect.c) (revision fcaca0915c314d04b9fa96c1960d32b63ab877db) +++ firmware/App/Modes/ModeHeatDisinfect.c (.../ModeHeatDisinfect.c) (revision e107dacab9f6c78574f1c26e1004e0dbdc8dba03) @@ -54,7 +54,7 @@ // Drain R1 & R2 states defines #define DRAIN_PUMP_TARGET_RPM 2400 ///< Drain pump target RPM during drain. #define RSRVRS_INITIAL_DRAIN_TIMEOUT_MS ( 2 * SEC_PER_MIN * MS_PER_SECOND ) ///< Reservoirs 1 & 2 initial drain time out in milliseconds. -#define DRAIN_WEIGHT_UNCHANGE_TIMEOUT ( 6 * MS_PER_SECOND ) ///< Time period of unchanged weight during draining before timeout. +#define DRAIN_WEIGHT_UNCHANGE_TIMEOUT_MS ( 6 * MS_PER_SECOND ) ///< Time period of unchanged weight during draining before timeout. // Flush drain path state defines #define FLUSH_DRAIN_WAIT_TIME_MS ( 2 * SEC_PER_MIN * MS_PER_SECOND ) ///< Flush Drain path wait time in milliseconds. @@ -455,7 +455,7 @@ if ( DG_RESERVOIR_ABOVE_TARGET == rsrvr1Status ) { - rsrvr1Status = getRsrvrDrainStatus( DG_RESERVOIR_1, DRAIN_WEIGHT_UNCHANGE_TIMEOUT, RSRVRS_INITIAL_DRAIN_TIMEOUT_MS ); + rsrvr1Status = getRsrvrDrainStatus( DG_RESERVOIR_1, DRAIN_WEIGHT_UNCHANGE_TIMEOUT_MS, RSRVRS_INITIAL_DRAIN_TIMEOUT_MS ); } else if ( DG_RESERVOIR_REACHED_TARGET == rsrvr1Status ) { @@ -503,7 +503,7 @@ if ( DG_RESERVOIR_ABOVE_TARGET == rsrvr2Status ) { - rsrvr2Status = getRsrvrDrainStatus( DG_RESERVOIR_2, DRAIN_WEIGHT_UNCHANGE_TIMEOUT, RSRVRS_INITIAL_DRAIN_TIMEOUT_MS ); + rsrvr2Status = getRsrvrDrainStatus( DG_RESERVOIR_2, DRAIN_WEIGHT_UNCHANGE_TIMEOUT_MS, RSRVRS_INITIAL_DRAIN_TIMEOUT_MS ); } else if ( DG_RESERVOIR_REACHED_TARGET == rsrvr2Status ) { @@ -741,7 +741,7 @@ // If reservoir 1 is empty, turn off the drain pump if ( DG_RESERVOIR_ABOVE_TARGET == rsrvr1Status ) { - rsrvr1Status = getRsrvrDrainStatus( DG_RESERVOIR_1, DRAIN_WEIGHT_UNCHANGE_TIMEOUT, RSRVRS_INITIAL_DRAIN_TIMEOUT_MS ); + rsrvr1Status = getRsrvrDrainStatus( DG_RESERVOIR_1, DRAIN_WEIGHT_UNCHANGE_TIMEOUT_MS, RSRVRS_INITIAL_DRAIN_TIMEOUT_MS ); } else if ( DG_RESERVOIR_REACHED_TARGET == rsrvr1Status ) { @@ -834,7 +834,7 @@ // If reservoir 2 is empty, set the drain valve to drain R1 if ( DG_RESERVOIR_ABOVE_TARGET == rsrvr2Status ) { - rsrvr2Status = getRsrvrDrainStatus( DG_RESERVOIR_2, DRAIN_WEIGHT_UNCHANGE_TIMEOUT, RSRVRS_INITIAL_DRAIN_TIMEOUT_MS ); + rsrvr2Status = getRsrvrDrainStatus( DG_RESERVOIR_2, DRAIN_WEIGHT_UNCHANGE_TIMEOUT_MS, RSRVRS_INITIAL_DRAIN_TIMEOUT_MS ); } else if ( DG_RESERVOIR_REACHED_TARGET == rsrvr2Status ) { @@ -872,7 +872,7 @@ // If reservoir 1 is empty, set the state to fill water state if ( DG_RESERVOIR_ABOVE_TARGET == rsrvr1Status ) { - rsrvr1Status = getRsrvrDrainStatus( DG_RESERVOIR_1, DRAIN_WEIGHT_UNCHANGE_TIMEOUT, RSRVRS_INITIAL_DRAIN_TIMEOUT_MS ); + rsrvr1Status = getRsrvrDrainStatus( DG_RESERVOIR_1, DRAIN_WEIGHT_UNCHANGE_TIMEOUT_MS, RSRVRS_INITIAL_DRAIN_TIMEOUT_MS ); } else if ( DG_RESERVOIR_REACHED_TARGET == rsrvr1Status ) { @@ -1383,7 +1383,7 @@ if ( DG_RESERVOIR_ABOVE_TARGET == rsrvr2Status ) { // If the cancellation water path cannot be done, got to basic cancellation path - rsrvr2Status = getRsrvrDrainStatus( DG_RESERVOIR_2, DRAIN_WEIGHT_UNCHANGE_TIMEOUT, drainTimeoutMS ); + rsrvr2Status = getRsrvrDrainStatus( DG_RESERVOIR_2, DRAIN_WEIGHT_UNCHANGE_TIMEOUT_MS, drainTimeoutMS ); if ( DG_RESERVOIR_REACHED_TARGET == rsrvr2Status ) { @@ -1407,7 +1407,7 @@ if ( ( DG_RESERVOIR_REACHED_TARGET == rsrvr2Status ) && ( DG_RESERVOIR_ABOVE_TARGET == rsrvr1Status ) ) { // If the cancellation water path cannot be done, got to basic cancellation path - rsrvr1Status = getRsrvrDrainStatus( DG_RESERVOIR_1, DRAIN_WEIGHT_UNCHANGE_TIMEOUT, drainTimeoutMS ); + rsrvr1Status = getRsrvrDrainStatus( DG_RESERVOIR_1, DRAIN_WEIGHT_UNCHANGE_TIMEOUT_MS, drainTimeoutMS ); if ( DG_RESERVOIR_REACHED_TARGET == rsrvr1Status ) { Index: firmware/App/Modes/ModeStandby.c =================================================================== diff -u -r6499ea25921fcf67826fa0c35bb03caf411ba542 -re107dacab9f6c78574f1c26e1004e0dbdc8dba03 --- firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision 6499ea25921fcf67826fa0c35bb03caf411ba542) +++ firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision e107dacab9f6c78574f1c26e1004e0dbdc8dba03) @@ -611,23 +611,20 @@ cmdResponse.commandID = DG_CMD_START_CHEM_DISINFECT; cmdResponse.rejected = FALSE; cmdResponse.rejectCode = DG_CMD_REQUEST_REJECT_REASON_NONE; - OPN_CLS_STATE_T concCap = getSwitchStatus( CONCENTRATE_CAP ); OPN_CLS_STATE_T diaCap = getSwitchStatus( DIALYSATE_CAP ); #ifndef _RELEASE_ if ( SW_CONFIG_ENABLE_VALUE == getSoftwareConfigStatus( SW_CONFIG_DISABLE_CAPS_MONITOR ) ) { - concCap = STATE_CLOSED; diaCap = STATE_CLOSED; } #endif - // When chemical disinfect is about to be started, both caps must be closed - if ( ( STATE_OPEN == concCap ) || ( STATE_OPEN == diaCap ) ) + // When chemical disinfect is about to be started, dialysate caps must be closed + if ( STATE_OPEN == diaCap ) { cmdResponse.rejected = TRUE; - cmdResponse.rejectCode = ( STATE_OPEN == getSwitchStatus( DIALYSATE_CAP ) ? REQUEST_REJECT_REASON_DG_DIALYSATE_CAP_OPEN : - REQUEST_REJECT_REASON_DG_CONCENTRATE_CAP_OPEN ); + cmdResponse.rejectCode = REQUEST_REJECT_REASON_DG_DIALYSATE_CAP_OPEN; } else { @@ -661,23 +658,20 @@ // Chemical disinfect flush cannot be run in solo mode because the user has to confirm that the acid is inserted or removed if ( ( DG_MODE_STAN == getCurrentOperationMode() ) && ( DG_STANDBY_MODE_STATE_IDLE == standbyState ) ) { - OPN_CLS_STATE_T concCap = getSwitchStatus( CONCENTRATE_CAP ); OPN_CLS_STATE_T diaCap = getSwitchStatus( DIALYSATE_CAP ); #ifndef _RELEASE_ if ( SW_CONFIG_ENABLE_VALUE == getSoftwareConfigStatus( SW_CONFIG_DISABLE_CAPS_MONITOR ) ) { - concCap = STATE_CLOSED; diaCap = STATE_CLOSED; } #endif - // When chemical disinfect flush is about to be started, both caps must be closed - if ( ( STATE_OPEN == concCap ) || ( STATE_OPEN == diaCap ) ) + // When chemical disinfect flush is about to be started, dialysate cap must be closed + if ( STATE_OPEN == diaCap ) { cmdResponse.rejected = TRUE; - cmdResponse.rejectCode = ( STATE_OPEN == getSwitchStatus( DIALYSATE_CAP ) ? REQUEST_REJECT_REASON_DG_DIALYSATE_CAP_OPEN : - REQUEST_REJECT_REASON_DG_CONCENTRATE_CAP_OPEN ); + cmdResponse.rejectCode = REQUEST_REJECT_REASON_DG_DIALYSATE_CAP_OPEN; } else { Index: firmware/App/Services/FPGA.c =================================================================== diff -u -r6499ea25921fcf67826fa0c35bb03caf411ba542 -re107dacab9f6c78574f1c26e1004e0dbdc8dba03 --- firmware/App/Services/FPGA.c (.../FPGA.c) (revision 6499ea25921fcf67826fa0c35bb03caf411ba542) +++ firmware/App/Services/FPGA.c (.../FPGA.c) (revision e107dacab9f6c78574f1c26e1004e0dbdc8dba03) @@ -575,12 +575,12 @@ { fpgaReadByteSize = sizeof( DG_FPGA_SENSORS_T ); -#ifndef _RELEASE_ +/*#ifndef _RELEASE_ if ( ( HW_CONFIG_BETA == getHardwareConfigStatus() ) || ( DG_MODE_INIT == getCurrentOperationMode() ) ) { fpgaReadByteSize = FPGA_SIZE_OF_V3_READ_BYTES; } -#endif +#endif*/ // FPGA incoming state machine switch ( fpgaState ) @@ -642,12 +642,12 @@ { fpgaReadByteSize = sizeof( DG_FPGA_SENSORS_T ); -#ifndef _RELEASE_ +/*#ifndef _RELEASE_ if ( ( HW_CONFIG_BETA == getHardwareConfigStatus() ) || ( DG_MODE_INIT == getCurrentOperationMode() ) ) { fpgaReadByteSize = FPGA_SIZE_OF_V3_READ_BYTES; } -#endif +#endif*/ // FPGA outgoing state machine switch ( fpgaState )