Index: firmware/App/Modes/ModeFill.c =================================================================== diff -u -ra1b8dbb69c4bd2f0cc22e62bede7015c9307d378 -re52973e08c03d6c9b10604e6e97259bcde076ebb --- firmware/App/Modes/ModeFill.c (.../ModeFill.c) (revision a1b8dbb69c4bd2f0cc22e62bede7015c9307d378) +++ firmware/App/Modes/ModeFill.c (.../ModeFill.c) (revision e52973e08c03d6c9b10604e6e97259bcde076ebb) @@ -51,6 +51,7 @@ #define FLOW_INTEGRATED_VOLUME_CHECK_TOLERANCE 0.1 ///< Flow integrated volume has 10% tolerance compare to load cell reading. #define CONCENTRATE_TEST_TIME_OUT_MS ( 30 * MS_PER_SECOND ) ///< Concentrate test time out period in ms. +#define WATER_QUALITY_CHECK_TIME_OUT_MS ( 30 * MS_PER_SECOND ) ///< Inlet water quality check time out period in ms. #define CONDUCTIVITY_ERROR_PERSISTENCE_PERIOD_MS ( 5 * MS_PER_SECOND ) ///< Persistence period for conductivity error. @@ -64,6 +65,7 @@ static F32 reservoirBaseWeight; ///< Fill reservoir base weight. static F32 totalROFlowRate_LPM; ///< Total RO flow rate over period of time. static U32 concentrateTestStartTime; ///< Starting time for concentrate test. +static U32 waterQualityCheckStartTime; ///< Starting time for inlet water quality check. // ********** private function prototypes ********** @@ -135,10 +137,13 @@ checkInletPressure(); checkRORejectionRatio(); + // TODO: Check for open straw door status and alarm if closed + // check if run out of time to fill the reservoir - if ( didTimeout( dialysateFillStartTime, DIALYSATE_FILL_TIME_OUT ) ) + if ( TRUE == didTimeout( dialysateFillStartTime, DIALYSATE_FILL_TIME_OUT ) ) { activateAlarmNoData( ALARM_ID_DG_DIALYSATE_FILL_OUT_OF_TIME ); + requestNewOperationMode( DG_MODE_CIRC ); } // execute current Fill state @@ -256,6 +261,12 @@ result = DG_FILL_MODE_STATE_BICARB_PUMP_CHECK; } + if ( TRUE == didTimeout( waterQualityCheckStartTime, WATER_QUALITY_CHECK_TIME_OUT_MS ) ) + { + activateAlarmNoData( ALARM_ID_DG_BAD_INLET_WATER_QUALITY ); + requestNewOperationMode( DG_MODE_CIRC ); + } + return result; }