Index: firmware/App/Modes/ModeFill.c =================================================================== diff -u -reeac2a1df1afbdcf4d1775b62cc810582472404d -r2d4653fb5bd6b087b5e17d143b55249b7142fa07 --- firmware/App/Modes/ModeFill.c (.../ModeFill.c) (revision eeac2a1df1afbdcf4d1775b62cc810582472404d) +++ firmware/App/Modes/ModeFill.c (.../ModeFill.c) (revision 2d4653fb5bd6b087b5e17d143b55249b7142fa07) @@ -61,8 +61,8 @@ #define FILL_MODE_DATA_PUB_INTERVAL ( MS_PER_SECOND / TASK_GENERAL_INTERVAL ) ///< Interval (ms/task time) at which the fill mode data is published on the CAN bus. #define DIALYSATE_FILL_TIME_OUT ( 5 * SEC_PER_MIN * MS_PER_SECOND ) ///< Time out period when reservoir is not filled with correct dialysate. -#define CONC_PUMPS_PRIME_AT_MAX_SPEED_TIME_OUT_MS ( 7 * MS_PER_SECOND ) ///< Concentrate pumps prime at maximum speed timeout in milliseconds. -#define CONC_PUMPS_PRIME_CHECK_COND_SNSRS_TIME_OUT_MS ( 10 * MS_PER_SECOND ) ///< Concentrate pumps prime check conductivity sensors timeout in milliseconds. +#define CONC_PUMPS_PRIME_AT_MAX_SPEED_TIME_OUT_MS ( 10 * MS_PER_SECOND ) ///< Concentrate pumps prime at maximum speed timeout in milliseconds. +#define CONC_PUMPS_PRIME_CHECK_COND_SNSRS_TIME_OUT_MS ( 13 * MS_PER_SECOND ) ///< Concentrate pumps prime check conductivity sensors timeout in milliseconds. #define CONC_PUMPS_PRIME_MAX_ALLOWED_PRIME_TIME_OUT_MS ( 60 * MS_PER_SECOND ) ///< Concentrate pumps prime maximum allowed timeout in prime in milliseconds. #define HUNDRED_PERCENT_FACTOR 1.00F ///< Hundred percent of expected conductivity when first time reaches it. #define FLOW_INTEGRATED_VOLUME_CHECK_TOLERANCE 0.1F ///< Flow integrated volume has 10% tolerance compare to load cell reading. @@ -617,41 +617,44 @@ { DG_FILL_MODE_STATE_T result = DG_FILL_MODE_STATE_TEST_INLET_WATER; - // If this is the first fill of a treatment, prime acid and bicarb lines, otherwise transition - // to dialysate production directly - if ( TRUE == isThisTheFirstFill() ) + if ( ( isConcPumpParkInProgress( CONCENTRATEPUMPS_CP1_ACID ) != TRUE ) && ( isConcPumpParkInProgress( CONCENTRATEPUMPS_CP2_BICARB ) ) != TRUE ) { - resetChemicalUsedVolumeML( BICARB ); - resetChemicalUsedVolumeML( ACID ); - result = DG_FILL_MODE_STATE_PRIME_CONCENTRATE_LINES; - } - else - { - result = DG_FILL_MODE_STATE_PRODUCE_DIALYSATE; - } + // If this is the first fill of a treatment, prime acid and bicarb lines, otherwise transition + // to dialysate production directly + if ( TRUE == isThisTheFirstFill() ) + { + resetChemicalUsedVolumeML( BICARB ); + resetChemicalUsedVolumeML( ACID ); + result = DG_FILL_MODE_STATE_PRIME_CONCENTRATE_LINES; + } + else + { + result = DG_FILL_MODE_STATE_PRODUCE_DIALYSATE; + } - if ( TRUE == isTestingActivated() ) - { - switch ( dialinFillForCalCheck ) + if ( TRUE == isTestingActivated() ) { - case DIALIN_FILL_FOR_CAL_PRIME: - result = DG_FILL_MODE_STATE_PRIME_CONCENTRATE_LINES; - break; + switch ( dialinFillForCalCheck ) + { + case DIALIN_FILL_FOR_CAL_PRIME: + result = DG_FILL_MODE_STATE_PRIME_CONCENTRATE_LINES; + break; - case DIALIN_FILL_FOR_CAL_BICARB_CHECK: - result = DG_FILL_MODE_STATE_TEST_BICARB_CONDUCTIVITY; - break; + case DIALIN_FILL_FOR_CAL_BICARB_CHECK: + result = DG_FILL_MODE_STATE_TEST_BICARB_CONDUCTIVITY; + break; - case DIALIN_FILL_FOR_CAL_ACID_CHECK: - result = DG_FILL_MODE_STATE_TEST_ACID_CONDUCTIVITY; - break; + case DIALIN_FILL_FOR_CAL_ACID_CHECK: + result = DG_FILL_MODE_STATE_TEST_ACID_CONDUCTIVITY; + break; - default: - // Do nothing. This means there is not a request for the fill calibration check so proceed with the normal operations. - break; + default: + // Do nothing. This means there is not a request for the fill calibration check so proceed with the normal operations. + break; + } } + setModeFillStateTransition( result ); } - setModeFillStateTransition( result ); return result; }