Index: firmware/App/Controllers/ConcentratePumps.c =================================================================== diff -u -r4bd3bf3483660050d3026f7f9adff43782bfc620 -r2d4653fb5bd6b087b5e17d143b55249b7142fa07 --- firmware/App/Controllers/ConcentratePumps.c (.../ConcentratePumps.c) (revision 4bd3bf3483660050d3026f7f9adff43782bfc620) +++ firmware/App/Controllers/ConcentratePumps.c (.../ConcentratePumps.c) (revision 2d4653fb5bd6b087b5e17d143b55249b7142fa07) @@ -65,7 +65,6 @@ #define NUMBER_OF_ACID_AND_BICARB_NV_DATA_TO_CHECK 1 ///< Number of acid and bicarb non-volatile data to check. #define DATA_PUBLISH_COUNTER_START_COUNT 0 ///< Data publish counter start count. -#define CONENTREATE_PUMP_PARK_FAULT_TIMEOUT_MS ( 1 * MS_PER_SECOND ) ///< Concentrate pump park fault timeout in milliseconds. #define CONCENTRATE_PUMP_FAULT_PERSISTENCE_PERIOD 500 ///< Concentrate pump fault persistence period in milliseconds. #define CONCENTRATE_PUMP_TRANS_TO_RAMP_SPEED_THRESHOLD_MLPM 5.0F ///< Concentrate pump transition to ramp to target speed threshold in mL/min. @@ -119,6 +118,7 @@ F32 pulseWidthUS; ///< Concentrate pump pulse width in microseconds. OVERRIDE_U32_T parked; ///< Concentrate pump is currently parked (T/F). OVERRIDE_U32_T parkFaulted; ///< Concentrate pump park command has faulted (T/F). + BOOL isConcPumpParkInProgress; ///< Concentrate pump park progress boolean flag (T/F). } CONCENTRATE_PUMP_T; // ********** private data ********** @@ -157,8 +157,8 @@ { CONCENTRATE_PUMPS_T pumpId; - concentratePumpMonitorTimerCounter = DATA_PUBLISH_COUNTER_START_COUNT; - acidConcentratePumpParkPersistenceClear = FALSE; ///< Boolean acid park persistence clearing. + concentratePumpMonitorTimerCounter = DATA_PUBLISH_COUNTER_START_COUNT; + acidConcentratePumpParkPersistenceClear = FALSE; bicarbConcentratePumpParkPersistenceClear = FALSE; for ( pumpId = CONCENTRATEPUMPS_CP1_ACID; pumpId < NUM_OF_CONCENTRATE_PUMPS; pumpId++ ) @@ -173,14 +173,13 @@ concentratePumps[ pumpId ].pumpTargetSpeed = 0.0F; concentratePumps[ pumpId ].direction = CONCENTRATE_PUMP_FORWARD_DIR; // For V3 concentratePumps[ pumpId ].controlSet = CONCENTRATE_PUMP_CONTROL_FORWARD; // For DVT + concentratePumps[ pumpId ].isConcPumpParkInProgress = FALSE; stopConcentratePump( pumpId ); } initPersistentAlarm( ALARM_ID_DG_CP1_SPEED_CONTROL_ERROR, 0, CONCENTRATE_PUMP_SPEED_OUT_OF_RANGE_TIMEOUT_MS ); initPersistentAlarm( ALARM_ID_DG_CP2_SPEED_CONTROL_ERROR, 0, CONCENTRATE_PUMP_SPEED_OUT_OF_RANGE_TIMEOUT_MS ); initPersistentAlarm( ALARM_ID_DG_CONC_PUMP_HALL_SENSOR_OUT_OF_RANGE, CONCENTRATE_PUMP_HALL_SENSORS_OUT_OF_RANGE_TIME_MS, CONCENTRATE_PUMP_HALL_SENSORS_OUT_OF_RANGE_TIME_MS ); - initPersistentAlarm( ALARM_ID_DG_ACID_CONCENTRATE_PUMP_PARK_FAULT, CONENTREATE_PUMP_PARK_FAULT_TIMEOUT_MS, CONENTREATE_PUMP_PARK_FAULT_TIMEOUT_MS ); - initPersistentAlarm( ALARM_ID_DG_BICARB_CONCENTRATE_PUMP_PARK_FAULT, CONENTREATE_PUMP_PARK_FAULT_TIMEOUT_MS, CONENTREATE_PUMP_PARK_FAULT_TIMEOUT_MS ); initPersistentAlarm( ALARM_ID_DG_CONCENTRATE_PUMP_FAULT, CONCENTRATE_PUMP_FAULT_PERSISTENCE_PERIOD, CONCENTRATE_PUMP_FAULT_PERSISTENCE_PERIOD ); } @@ -214,6 +213,16 @@ concentratePumps[ CONCENTRATEPUMPS_CP1_ACID ].parkFaulted.data = (U32)getFPGAAcidPumpParkFault(); concentratePumps[ CONCENTRATEPUMPS_CP2_BICARB ].parkFaulted.data = (U32)getFPGABicarbPumpParkFault(); + if ( ( TRUE == getConcPumpIsParked( CONCENTRATEPUMPS_CP1_ACID ) ) || ( TRUE == getConcPumpParkIsFaulted( CONCENTRATEPUMPS_CP1_ACID ) ) ) + { + // If the pump has parked or faulted during the park, then it is not in progress + concentratePumps[ CONCENTRATEPUMPS_CP1_ACID ].isConcPumpParkInProgress = FALSE; + } + if ( ( TRUE == getConcPumpIsParked( CONCENTRATEPUMPS_CP2_BICARB ) ) || ( TRUE == getConcPumpParkIsFaulted( CONCENTRATEPUMPS_CP2_BICARB ) ) ) + { + concentratePumps[ CONCENTRATEPUMPS_CP2_BICARB ].isConcPumpParkInProgress = FALSE; + } + // Don't monitor persistence for cp speed alarms if we parked. if ( TRUE == acidConcentratePumpParkPersistenceClear ) { @@ -250,17 +259,6 @@ monitorPumpSpeed( CONCENTRATEPUMPS_CP2_BICARB, ALARM_ID_DG_CP2_SPEED_CONTROL_ERROR ); } -#ifndef _RELEASE_ - if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_CONCENTRATE_PUMPS_PARK ) != SW_CONFIG_ENABLE_VALUE ) -#endif - { - BOOL isAcidPumpParked = getConcPumpParkIsFaulted( CONCENTRATEPUMPS_CP1_ACID ); - BOOL isBicarbPumpParked = getConcPumpParkIsFaulted( 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 ); - } - checkPersistentAlarm( ALARM_ID_DG_CONCENTRATE_PUMP_FAULT, isConcPumpFault, fpgaConcPumpsFault, CONCENTRATE_PUMP_FAULT_PERSISTENCE_PERIOD ); if ( ++concentratePumpMonitorTimerCounter >= getU32OverrideValue( &concentratePumpDataPublishInterval ) ) @@ -270,8 +268,6 @@ U08 cp1Direction = concentratePumps[ CONCENTRATEPUMPS_CP1_ACID ].direction; F32 cp1SetSpeed = concentratePumps[ CONCENTRATEPUMPS_CP1_ACID ].currentPumpSpeed; F32 cp1TgtSpeed = concentratePumps[ CONCENTRATEPUMPS_CP1_ACID ].pumpTargetSpeed; - BOOL cp1Parked = getConcPumpIsParked( CONCENTRATEPUMPS_CP1_ACID ); - BOOL cp2ParkFault = getConcPumpParkIsFaulted( CONCENTRATEPUMPS_CP1_ACID ); U08 cp2Direction = concentratePumps[ CONCENTRATEPUMPS_CP2_BICARB ].direction; F32 cp2SetSpeed = concentratePumps[ CONCENTRATEPUMPS_CP2_BICARB ].currentPumpSpeed; F32 cp2TgtSpeed = concentratePumps[ CONCENTRATEPUMPS_CP2_BICARB ].pumpTargetSpeed; @@ -380,6 +376,8 @@ #endif { concentratePumps[ pumpId ].hasTurnOnPumpsBeenRequested = TRUE; + acidConcentratePumpParkPersistenceClear = FALSE; + bicarbConcentratePumpParkPersistenceClear = FALSE; } } else @@ -431,6 +429,31 @@ /*********************************************************************//** * @brief + * The isConcPumpParkInProgress function requests whether the concentrate + * pump park is in progress or not. + * @details Inputs: concentratePumps + * @details Outputs: none + * @param pumpId concentrate pump id + * @return TRUE if the concentrate pump park is in progress otherwise, FALSE + *************************************************************************/ +BOOL isConcPumpParkInProgress( CONCENTRATE_PUMPS_T pumpId ) +{ + BOOL status = FALSE; + + if ( pumpId < NUM_OF_CONCENTRATE_PUMPS ) + { + status = concentratePumps[ pumpId ].isConcPumpParkInProgress; + } + else + { + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DG_SOFTWARE_FAULT, SW_FAULT_ID_CONCENTRATE_PUMP_INVALID_PUMP_ID, pumpId ); + } + + return status; +} + +/*********************************************************************//** + * @brief * The requestConcentratePumpOff function requests the module to turn off * the concentrate pumps. * @details Inputs: none @@ -679,6 +702,7 @@ setFPGABicarbPumpParkCmd(); bicarbConcentratePumpParkPersistenceClear = TRUE; } + concentratePumps[ pumpId ].isConcPumpParkInProgress = TRUE; } } #ifndef _RELEASE_ Index: firmware/App/Controllers/ConcentratePumps.h =================================================================== diff -u -r4bd3bf3483660050d3026f7f9adff43782bfc620 -r2d4653fb5bd6b087b5e17d143b55249b7142fa07 --- firmware/App/Controllers/ConcentratePumps.h (.../ConcentratePumps.h) (revision 4bd3bf3483660050d3026f7f9adff43782bfc620) +++ firmware/App/Controllers/ConcentratePumps.h (.../ConcentratePumps.h) (revision 2d4653fb5bd6b087b5e17d143b55249b7142fa07) @@ -82,6 +82,7 @@ BOOL getConcPumpIsParked( CONCENTRATE_PUMPS_T pumpId ); BOOL getConcPumpParkIsFaulted( CONCENTRATE_PUMPS_T pumpId ); BOOL handleConcentratePumpParkRequest( void ); +BOOL isConcPumpParkInProgress( CONCENTRATE_PUMPS_T pumpId ); BOOL testSetConcentratePumpDataPublishIntervalOverride( U32 value ); BOOL testResetConcentratePumpDataPublishIntervalOverride( void ); Index: firmware/App/Controllers/LoadCell.c =================================================================== diff -u -r5592e4935a3280fcba66399dbc7c6b5a0afde60a -r2d4653fb5bd6b087b5e17d143b55249b7142fa07 --- firmware/App/Controllers/LoadCell.c (.../LoadCell.c) (revision 5592e4935a3280fcba66399dbc7c6b5a0afde60a) +++ firmware/App/Controllers/LoadCell.c (.../LoadCell.c) (revision 2d4653fb5bd6b087b5e17d143b55249b7142fa07) @@ -49,7 +49,6 @@ #define LOAD_CELL_MIN_ALLOWED_WEIGHT_BEFORE_TARE_GRAMS 1600.0F ///< Load cell minimum allowed weight before tare in grams. #define LOAD_CELL_WEIGHT_OUT_RANGE_PERSISTENT_PERIOD_MS (5 * MS_PER_SECOND) ///< Load cell weight out of range persistent period in milliseconds. #define LOAD_CELL_PRIMARY_BACKUP_MAX_DRIFT_PERSISTENT_PERIOD_MS (5 * MS_PER_SECOND) ///< Load cell primary and backup maximum allowed weight drift persistent period in milliseconds. -#define EMPTY_RESERVOIR_WEIGHT_GRAMS 1700.0F ///< Reservoirs empty weight in grams. #define MAX_ALLOWED_EXTRA_WEIGHT_BEFORE_FIRST_TARE_GRAMS 300.0F ///< Max allowed extra weight before first tare in grams. #define HEAT_ACTIVE_COOL_MAX_ALLOWED_EXTRA_WEIGHT_TARE_GRAMS 200.0F ///< Heat disinfect active cool max allowed weight before tare in grams. #define MAX_ALLOWED_EXTRA_WEIGHT_BEFORE_TARE_GRAMS 60.0F ///< Max allowed extra weight before tare in grams. @@ -88,7 +87,8 @@ static U32 smallReadingsIdx; ///< Index for next sample in load cell small rolling average sample array. static U32 largeReadingsIdx; ///< Index for next sample in load cell large rolling average sample array. static DG_LOAD_CELLS_CAL_RECORD_T loadCellsCalRecord; ///< Load cells calibration record. -static BOOL hasLoadCellBeenTared[ NUM_OF_LOAD_CELLS ]; ///< Flags indicating whether loadcells have been tared yet. +static DG_RESERVOIR_VOLUME_RECORD_T reservoirsCalRecord; ///< DG reservoirs non-volatile record. +static BOOL hasLoadCellBeenTared[ NUM_OF_LOAD_CELLS ]; ///< Flags indicating whether load cells have been tared yet. // ********** private function prototypes ********** @@ -202,14 +202,22 @@ // Check if a new calibration is available if ( TRUE == isNewCalibrationRecordAvailable() ) { + getNVRecord2Driver( GET_CAL_RSRVRS_VOL_RECORD, (U08*)&reservoirsCalRecord, sizeof( DG_RESERVOIR_VOLUME_RECORD_T ), + NUM_OF_CAL_DATA_RSRVRS, ALARM_ID_DG_RESERVOIRS_INVALID_CAL_RECORD ); + getNVRecord2Driver( GET_CAL_LOAD_CELL_SENSORS, (U08*)&loadCellsCalRecord, sizeof( DG_LOAD_CELLS_CAL_RECORD_T ), NUM_OF_CAL_DATA_LOAD_CELLS, ALARM_ID_DG_LOAD_CELLS_INVALID_CAL_RECORD ); - // Zero the current tare values when new calibration data is available - loadcells[ LOAD_CELL_RESERVOIR_1_PRIMARY ].autoCalOffset = EMPTY_RESERVOIR_WEIGHT_GRAMS; - loadcells[ LOAD_CELL_RESERVOIR_1_BACKUP ].autoCalOffset = EMPTY_RESERVOIR_WEIGHT_GRAMS; - loadcells[ LOAD_CELL_RESERVOIR_2_PRIMARY ].autoCalOffset = EMPTY_RESERVOIR_WEIGHT_GRAMS; - loadcells[ LOAD_CELL_RESERVOIR_2_BACKUP ].autoCalOffset = EMPTY_RESERVOIR_WEIGHT_GRAMS; + if ( getCurrentOperationMode() != DG_MODE_SERV ) + { + // In the service mode once the calibration values are set, the NV data management sends the signal to all the drivers and therefore the + // the offset values are set to what is in the calibration records. This is not wanted in the service mode + // Set the current tare values when the values are received from the cal record + loadcells[ LOAD_CELL_RESERVOIR_1_PRIMARY ].autoCalOffset = reservoirsCalRecord.reservoir[ CAL_DATA_RSRVR_1 ].rsrvrUnfilledWeight; + loadcells[ LOAD_CELL_RESERVOIR_1_BACKUP ].autoCalOffset = reservoirsCalRecord.reservoir[ CAL_DATA_RSRVR_1 ].rsrvrUnfilledWeight; + loadcells[ LOAD_CELL_RESERVOIR_2_PRIMARY ].autoCalOffset = reservoirsCalRecord.reservoir[ CAL_DATA_RSRVR_2 ].rsrvrUnfilledWeight; + loadcells[ LOAD_CELL_RESERVOIR_2_BACKUP ].autoCalOffset = reservoirsCalRecord.reservoir[ CAL_DATA_RSRVR_2 ].rsrvrUnfilledWeight; + } } // Rolling average of last 100 raw samples in small filter @@ -303,10 +311,14 @@ SELF_TEST_STATUS_T execLoadCellsSelfTest ( void ) { SELF_TEST_STATUS_T result = SELF_TEST_STATUS_IN_PROGRESS; + BOOL calStatus = FALSE; - BOOL calStatus = getNVRecord2Driver( GET_CAL_LOAD_CELL_SENSORS, (U08*)&loadCellsCalRecord, sizeof( DG_LOAD_CELLS_CAL_RECORD_T ), - NUM_OF_CAL_DATA_LOAD_CELLS, ALARM_ID_DG_LOAD_CELLS_INVALID_CAL_RECORD ); + calStatus |= getNVRecord2Driver( GET_CAL_LOAD_CELL_SENSORS, (U08*)&loadCellsCalRecord, sizeof( DG_LOAD_CELLS_CAL_RECORD_T ), + NUM_OF_CAL_DATA_LOAD_CELLS, ALARM_ID_DG_LOAD_CELLS_INVALID_CAL_RECORD ); + calStatus |= getNVRecord2Driver( GET_CAL_RSRVRS_VOL_RECORD, (U08*)&reservoirsCalRecord, sizeof( DG_RESERVOIR_VOLUME_RECORD_T ), + NUM_OF_CAL_DATA_RSRVRS, ALARM_ID_DG_RESERVOIRS_INVALID_CAL_RECORD ); + if ( TRUE == calStatus ) { result = SELF_TEST_STATUS_PASSED; @@ -355,12 +367,24 @@ BOOL isWeightOutOfRange = FALSE; F32 weight = getLoadCellSmallFilteredWeight( loadCellID ); + if ( ( DG_MODE_SERV == getCurrentOperationMode() ) && ( loadcells[ loadCellID ].autoCalOffset <= NEARLY_ZERO ) ) + { + // In service mode, some of the tests are done when the auto call offset is needed and some when is not needed. + // Once the tare command is issued, an auto cal value other than 0 is needed otherwise the tare will fail since the weight is at least 1700 grams + // which is the weight of the empty reservoirs. So for that matter, if the reservoirs have not been tared in the service mode meaning + // that the auto cal offset is zero, use the default values from the cal records. + CAL_DATA_DG_RESERVOIRS_T rsrvr = ( ( LOAD_CELL_RESERVOIR_1_PRIMARY == loadCellID ) || ( LOAD_CELL_RESERVOIR_1_BACKUP == loadCellID ) ? + CAL_DATA_RSRVR_1 : CAL_DATA_RSRVR_2 ); + + weight -= reservoirsCalRecord.reservoir[ rsrvr ].rsrvrUnfilledWeight; + } + // Check if the load cell is being tared for the first time if ( hasLoadCellBeenTared[ loadCellID ] != TRUE ) { // For the first tare, the weight of the reservoir should be considered so the weight tolerance is bigger // The current weight of the load cell should not be greater than the weight of the reservoir + the extra weight - isWeightOutOfRange = ( weight > MAX_ALLOWED_EXTRA_WEIGHT_BEFORE_FIRST_TARE_GRAMS ? TRUE : FALSE ); + isWeightOutOfRange = ( fabs( weight ) > MAX_ALLOWED_EXTRA_WEIGHT_BEFORE_FIRST_TARE_GRAMS ? TRUE : FALSE ); } else { Index: firmware/App/Controllers/LoadCell.h =================================================================== diff -u -r4bd3bf3483660050d3026f7f9adff43782bfc620 -r2d4653fb5bd6b087b5e17d143b55249b7142fa07 --- firmware/App/Controllers/LoadCell.h (.../LoadCell.h) (revision 4bd3bf3483660050d3026f7f9adff43782bfc620) +++ firmware/App/Controllers/LoadCell.h (.../LoadCell.h) (revision 2d4653fb5bd6b087b5e17d143b55249b7142fa07) @@ -30,6 +30,7 @@ */ // ********** public definitions ********** +#define EMPTY_RESERVOIR_WEIGHT_GRAMS 1700.0F ///< Reservoirs empty weight in grams. // ********** public function prototypes ********** Index: firmware/App/Controllers/UVReactors.c =================================================================== diff -u -r23ebb5812ecd93ca42999259f7f62f46fd482ebd -r2d4653fb5bd6b087b5e17d143b55249b7142fa07 --- firmware/App/Controllers/UVReactors.c (.../UVReactors.c) (revision 23ebb5812ecd93ca42999259f7f62f46fd482ebd) +++ firmware/App/Controllers/UVReactors.c (.../UVReactors.c) (revision 2d4653fb5bd6b087b5e17d143b55249b7142fa07) @@ -383,8 +383,14 @@ *************************************************************************/ static UV_REACTOR_STATE_T handleUVReactorStateOff( UV_REACTORS_T reactor ) { - UV_REACTOR_STATE_T state = UV_REACTOR_STATE_OFF; + UV_REACTOR_STATE_T state = UV_REACTOR_STATE_OFF; + ALARM_ID_T reactorHealthAlarm = ( INLET_UV_REACTOR == reactor ? ALARM_ID_DG_INLET_UV_REACTOR_NOT_HEALTHY : ALARM_ID_DG_OUTLET_UV_REACTOR_NOT_HEALTHY ); + ALARM_ID_T reactorFlowAlarm = ( INLET_UV_REACTOR == reactor ? ALARM_ID_DG_INLET_UV_REACTOR_ON_WITH_NO_FLOW : ALARM_ID_DG_OUTLET_UV_REACTOR_ON_WITH_NO_FLOW ); + // When the reactor is off, clear its health and on with no flow alarms + checkPersistentAlarm( reactorHealthAlarm, FALSE, 0.0F, 0.0F ); + checkPersistentAlarm( reactorFlowAlarm, FALSE, 0.0F, 0.0F ); + // Set the health status to be off. When the reactor is off, it does not report its health status reactorsStatus[ reactor ].healthStatus.data = (U32)UV_REACTOR_OFF; 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; } Index: firmware/App/Modes/ModeGenIdle.c =================================================================== diff -u -r5592e4935a3280fcba66399dbc7c6b5a0afde60a -r2d4653fb5bd6b087b5e17d143b55249b7142fa07 --- firmware/App/Modes/ModeGenIdle.c (.../ModeGenIdle.c) (revision 5592e4935a3280fcba66399dbc7c6b5a0afde60a) +++ firmware/App/Modes/ModeGenIdle.c (.../ModeGenIdle.c) (revision 2d4653fb5bd6b087b5e17d143b55249b7142fa07) @@ -107,6 +107,9 @@ *************************************************************************/ U32 transitionToGenIdleMode( void ) { + BOOL cp1parkStatus = ( getConcPumpIsParked( CONCENTRATEPUMPS_CP1_ACID ) != TRUE ? PARK_CONC_PUMPS : NO_PARK_CONC_PUMPS ); + BOOL cp2parkStatus = ( getConcPumpIsParked( CONCENTRATEPUMPS_CP2_BICARB ) != TRUE ? PARK_CONC_PUMPS : NO_PARK_CONC_PUMPS ); + // Re-initialize each time we transition to generation idle mode initGenIdleMode(); setCurrentSubState( NO_SUB_STATE ); @@ -124,8 +127,8 @@ setCondcutivitySensorCalTable( CONDUCTIVITYSENSORS_CD2_SENSOR, CAL_DATA_CD2_COND_SENSOR ); signalDrainPumpHardStop(); - requestConcentratePumpOff( CONCENTRATEPUMPS_CP1_ACID, NO_PARK_CONC_PUMPS ); - requestConcentratePumpOff( CONCENTRATEPUMPS_CP2_BICARB, NO_PARK_CONC_PUMPS ); + requestConcentratePumpOff( CONCENTRATEPUMPS_CP1_ACID, cp1parkStatus ); + requestConcentratePumpOff( CONCENTRATEPUMPS_CP2_BICARB, cp2parkStatus ); // UV reactors on turnOnUVReactor( INLET_UV_REACTOR ); Index: firmware/App/Modes/ModeService.c =================================================================== diff -u -r4bd3bf3483660050d3026f7f9adff43782bfc620 -r2d4653fb5bd6b087b5e17d143b55249b7142fa07 --- firmware/App/Modes/ModeService.c (.../ModeService.c) (revision 4bd3bf3483660050d3026f7f9adff43782bfc620) +++ firmware/App/Modes/ModeService.c (.../ModeService.c) (revision 2d4653fb5bd6b087b5e17d143b55249b7142fa07) @@ -17,6 +17,7 @@ #include "ConcentratePumps.h" #include "CPLD.h" +#include "LoadCell.h" #include "ModeService.h" #include "OperationModes.h" @@ -59,6 +60,11 @@ deenergizeActuators( NO_PARK_CONC_PUMPS ); initServiceMode(); setCurrentSubState( NO_SUB_STATE ); + resetLoadCellOffset( LOAD_CELL_RESERVOIR_1_PRIMARY ); + resetLoadCellOffset( LOAD_CELL_RESERVOIR_1_BACKUP ); + resetLoadCellOffset( LOAD_CELL_RESERVOIR_2_PRIMARY ); + resetLoadCellOffset( LOAD_CELL_RESERVOIR_2_BACKUP ); + return serviceState; }