Index: firmware/App/Controllers/ConcentratePumps.c =================================================================== diff -u -r3414e47b2664c56ab6b2f0cd5cd6b30ae9a5e333 -r1722e975682c9e41e0b75551ada1139d3dc522a6 --- firmware/App/Controllers/ConcentratePumps.c (.../ConcentratePumps.c) (revision 3414e47b2664c56ab6b2f0cd5cd6b30ae9a5e333) +++ firmware/App/Controllers/ConcentratePumps.c (.../ConcentratePumps.c) (revision 1722e975682c9e41e0b75551ada1139d3dc522a6) @@ -515,8 +515,6 @@ concentratePumps[ pumpId ].controlTimerCounter = 0; stepConcentratePumpToTargetSpeed( pumpId ); - - concentratePumps[ pumpId ].setStepSpeed( concentratePumps[ pumpId ].togglePeriodCount ); } if ( FALSE == concentratePumps[ pumpId ].hasTurnOnPumpsBeenRequested ) @@ -576,6 +574,8 @@ concentratePumps[ pumpId ].togglePeriodCount = CONCENTRATE_PUMP_ZERO_FLOW_RATE; } + concentratePumps[ pumpId ].setStepSpeed( concentratePumps[ pumpId ].togglePeriodCount ); + return hasTgtBeenReached; } Index: firmware/App/Controllers/TemperatureSensors.c =================================================================== diff -u -r66cc826068b54bc436cde0fae70a05ba6c1ac974 -r1722e975682c9e41e0b75551ada1139d3dc522a6 --- firmware/App/Controllers/TemperatureSensors.c (.../TemperatureSensors.c) (revision 66cc826068b54bc436cde0fae70a05ba6c1ac974) +++ firmware/App/Controllers/TemperatureSensors.c (.../TemperatureSensors.c) (revision 1722e975682c9e41e0b75551ada1139d3dc522a6) @@ -369,7 +369,6 @@ void checkInletWaterTemperature( void ) { #ifndef DISABLE_WATER_QUALITY_CHECK - F32 temperature = getTemperatureValue( TEMPSENSORS_INLET_PRIMARY_HEATER ); BOOL isWaterTempInHighRange = ( temperature > MAX_WATER_TEMPERATURE_WARNING_HIGH_RANGE ? TRUE : FALSE ); BOOL isWaterTempInLowRange = ( temperature < MIN_WATER_TEMPERATURE_WARNING_LOW_RANGE ? TRUE : FALSE ); Index: firmware/App/Modes/ModeDrain.c =================================================================== diff -u -r66cc826068b54bc436cde0fae70a05ba6c1ac974 -r1722e975682c9e41e0b75551ada1139d3dc522a6 --- firmware/App/Modes/ModeDrain.c (.../ModeDrain.c) (revision 66cc826068b54bc436cde0fae70a05ba6c1ac974) +++ firmware/App/Modes/ModeDrain.c (.../ModeDrain.c) (revision 1722e975682c9e41e0b75551ada1139d3dc522a6) @@ -38,30 +38,34 @@ // ********** private definitions ********** -#define TARGET_DRAIN_PUMP_RPM 2300 ///< 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 TARGET_DRAIN_PUMP_RPM 2300 ///< 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_EMPTY_TARE_WAIT ( MS_PER_SECOND / TASK_GENERAL_INTERVAL ) /// Time period to wait after drain complete and before taring load cells. +#define DRAIN_EMPTY_TARE_WAIT ( MS_PER_SECOND / TASK_GENERAL_INTERVAL ) /// Time period to wait after drain complete and before taring load cells. -#define TARGET_RO_PRESSURE_PSI 130 ///< Target pressure for RO pump. -#define TARGET_RO_FLOW_RATE_L 0.3F ///< Target flow rate for RO pump. +#define TARGET_RO_PRESSURE_PSI 130 ///< Target pressure for RO pump. +#define TARGET_RO_FLOW_RATE_L 0.3F ///< Target flow rate for RO pump. -#define DELAY_RES_DRAIN_VALVE_MS 1000 ///< Delay reservoir drain valve open by 1 second. -#define DELAY_DRAIN_PUMP_MS 2000 ///< Delay drain pump on by 2 seconds. +#define DELAY_RES_DRAIN_VALVE_MS 1000 ///< Delay reservoir drain valve open by 1 second. +#define DELAY_DRAIN_PUMP_MS 2000 ///< Delay drain pump on by 2 seconds. -#define DIALYSATE_DRAIN_TIME_OUT ( 2 * SEC_PER_MIN * MS_PER_SECOND ) ///< Dialysate drain time out. +#define DIALYSATE_DRAIN_TIME_OUT ( 2 * SEC_PER_MIN * MS_PER_SECOND ) ///< Dialysate drain time out. -#define RINSE_CONCENTRATE_LINES_WAIT ( 25 * MS_PER_SECOND / TASK_GENERAL_INTERVAL ) ///< Time period to wait for concentrate lines to rinse. +#define RINSE_CONCENTRATE_LINES_WAIT ( 25 * MS_PER_SECOND / TASK_GENERAL_INTERVAL ) ///< Time period to wait for concentrate lines to rinse. -#define RINSE_SPEED ( ( CONCENTRATE_PUMP_MAX_SPEED - 3.0F ) * -1.0F ) ///< Reserver the concentrate speed to rinse out concentrate lines. +#define RINSE_SPEED ( ( CONCENTRATE_PUMP_MAX_SPEED - 3.0F ) * -1.0F ) ///< Reserver the concentrate speed to rinse out concentrate lines. +#define ACID_CONCENTRATION_BOTTLE_VOLUME_ML 3430.0F ///< Bottle volume of acid concentration in mL. +#define BICARB_CONCENTRATION_BOTTLE_VOLUME_ML 3780.0F ///< Bottle volume of bicarb concentration in mL. +#define CONCENTRATION_BOTTLE_LOW_VOLUME_ML 100.0F ///< Concentration bottle low volume in mL. + // ********** private data ********** -static DG_DRAIN_STATE_T drainState; ///< Currently active drain state. -static U32 drainEmptyTareTimerCtr; ///< Timer counter for delay between drain complete and load cell tare. -static BOOL rinseConcentrateLines; ///< Flag indicates to rinse concentrate lines. -static U32 rinseConcentrateLinesTimerCtr; ///< Timer counter for rinsing concentrate lines. -static U32 dialysateDrainStartTime; ///< Dialysate drain start time. +static DG_DRAIN_STATE_T drainState; ///< Currently active drain state. +static U32 drainEmptyTareTimerCtr; ///< Timer counter for delay between drain complete and load cell tare. +static BOOL rinseConcentrateLines; ///< Flag indicates to rinse concentrate lines. +static U32 rinseConcentrateLinesTimerCtr; ///< Timer counter for rinsing concentrate lines. +static U32 dialysateDrainStartTime; ///< Dialysate drain start time. // ********** private function prototypes ********** static DG_DRAIN_STATE_T handleDrainStateStart( void ); @@ -243,15 +247,17 @@ setValveState( VRD2, VALVE_STATE_CLOSED ); } - // check for empty bottles at the end of drain - if ( TRUE == isEmptyAcidBottle() ) // is acid volume < 10% + // Detect empty bottles using integrated volumes + if ( ( ( ACID_CONCENTRATION_BOTTLE_VOLUME_ML - getChemicalUsedVolumeML( ACID ) ) <= CONCENTRATION_BOTTLE_LOW_VOLUME_ML ) ) // || // SRSDG 437 { + resetChemicalUsedVolumeML( ACID ); setThisFisrtFillFlag( TRUE ); // indicates bottles need prime - activateAlarmNoData( ALARM_ID_DG_ACID_BOTTLE_LOW_VOLUME ); // trigger empty acid bottle alarm + activateAlarmNoData( ALARM_ID_DG_ACID_BOTTLE_LOW_VOLUME ); } - if ( TRUE == isEmptyBicarbBottle() ) + if ( ( ( BICARB_CONCENTRATION_BOTTLE_VOLUME_ML - getChemicalUsedVolumeML( BICARB ) ) <= CONCENTRATION_BOTTLE_LOW_VOLUME_ML ) ) // || // SRSDG 438 { + resetChemicalUsedVolumeML( BICARB ); setThisFisrtFillFlag( TRUE ); activateAlarmNoData( ALARM_ID_DG_BICARB_BOTTLE_LOW_VOLUME ); } Index: firmware/App/Modes/ModeFill.c =================================================================== diff -u -r604d8aaceeb8e0b650ac2054644333fc7717bb51 -r1722e975682c9e41e0b75551ada1139d3dc522a6 --- firmware/App/Modes/ModeFill.c (.../ModeFill.c) (revision 604d8aaceeb8e0b650ac2054644333fc7717bb51) +++ firmware/App/Modes/ModeFill.c (.../ModeFill.c) (revision 1722e975682c9e41e0b75551ada1139d3dc522a6) @@ -47,39 +47,34 @@ // ********** private definitions ********** #define TARGET_RO_PRESSURE_PSI 130 ///< Target pressure for RO pump. -#define RO_PUMP_400_ML_PER_MIN 400.0 ///< RO pump speed of 400.0 mL/minute. -#define RO_PUMP_800_ML_PER_MIN 800.0 ///< RO pump speed of 800.0 mL/minute. -#define MILLILITERS_PER_LITER 1000.0 ///< One liter is 1000 milliliters -#define ACID_PUMP_20_ML_PER_MIN 20.0 ///< Acid pump speed of 20.0 mL/minute. -#define BICARB_PUMP_40_ML_PER_MIN 40.0 ///< Bicarb pump speed of 40.0 mL/minute. -#define CONCENTRATE_PUMP_40_ML_PER_MIN 40.0 ///< Concentrate pump speed of 40.0 mL/minute. +#define RO_PUMP_400_ML_PER_MIN 400.0F ///< RO pump speed of 400.0 mL/minute. +#define RO_PUMP_800_ML_PER_MIN 800.0F ///< RO pump speed of 800.0 mL/minute. +#define MILLILITERS_PER_LITER 1000.0F ///< One liter is 1000 milliliters +#define ACID_PUMP_20_ML_PER_MIN 20.0F ///< Acid pump speed of 20.0 mL/minute. +#define BICARB_PUMP_40_ML_PER_MIN 40.0F ///< Bicarb pump speed of 40.0 mL/minute. +#define CONCENTRATE_PUMP_40_ML_PER_MIN 40.0F ///< Concentrate pump speed of 40.0 mL/minute. #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 EMPTY_BOTTLE_DETECT_PERSISTENT_PERIOD_MS ( 1 * MS_PER_SECOND ) ///< Persistent period for empty bottle detect. #define CONCENTRATE_PUMP_PRIME_INTERVAL ( 3 * MS_PER_SECOND / TASK_GENERAL_INTERVAL ) ///< Persistent time interval for concentrate pumps prime. #define FLOW_INTEGRATED_VOLUME_CHECK_TOLERANCE 0.1F ///< Flow integrated volume has 10% tolerance compare to load cell reading. -#define ACID_TEST_CD1_TCD 12252.1 ///< Used for testing CD1 acid theoretical conductivity. +#define ACID_TEST_CD1_TCD 12252.1F ///< Used for testing CD1 acid theoretical conductivity. #define ACID_TEST_CD2_TCD ACID_TEST_CD1_TCD ///< Used for testing CD2 acid theoretical conductivity. -#define BICARB_TEST_CD2_TCD 6820.91 ///< Used for testing CD2 bicarb theoretical conductivity. -#define FIVE_PERCENT_FACTOR 0.05 ///< 5.0 / 100.0 used to calculate conductivity within range of -/+ 5%. +#define BICARB_TEST_CD2_TCD 6820.91F ///< Used for testing CD2 bicarb theoretical conductivity. +#define FIVE_PERCENT_FACTOR 0.05F ///< 5.0 / 100.0 used to calculate conductivity within range of -/+ 5%. #define RO_PUMP_LOOKUP_TABLE_SIZE 4 ///< Size of array used as RO pump speed lookup table. -#define CONCENTRATE_PUMP_PRIME_EXTRA_SPEED_ML_MIN 5.0 ///< Concentrate pump additional speed during priming in mL/min. +#define CONCENTRATE_PUMP_PRIME_EXTRA_SPEED_ML_MIN 5.0F ///< Concentrate pump additional speed during priming in mL/min. #define CONCENTRATE_TEST_TIME_OUT_MS ( 30 * MS_PER_SECOND ) ///< Concentrate test time out period in ms. #define WATER_QUALITY_TEST_TIME_OUT_MS ( 30 * MS_PER_SECOND ) ///< Inlet water quality test time out period in ms. #define PRIME_CONCENTRATE_LINES_TIME_OUT_MS ( 95 * MS_PER_SECOND ) ///< Time required to prime the concentrate lines. #define FLUSH_BUBBLES_PUMP_TIME_OUT_MS ( 2 * MS_PER_SECOND ) ///< RO pump on during flush bubble interval in ms. -#define DIALYSATE_TEMPERATURE_TOLERANCE_C 2.0 ///< Dialysate temperature tolerance in degree C. -#define DIALYSATE_TEMPERATURE_SENSORS_MAX_DRIFT_C 2.0 ///< Dialysate temperature sensors maximum allowed drift in C. +#define DIALYSATE_TEMPERATURE_TOLERANCE_C 2.0F ///< Dialysate temperature tolerance in degree C. +#define DIALYSATE_TEMPERATURE_SENSORS_MAX_DRIFT_C 2.0F ///< Dialysate temperature sensors maximum allowed drift in C. #define DIALYSATE_TEMPERATURE_SENSORS_DRIFT_TIMEOUT_MS ( 10 * MS_PER_SECOND ) ///< Dialysate temperature sensors drift timeout in milliseconds. -#define ACID_CONCENTRATION_BOTTLE_VOLUME_ML 3430.0 ///< Bottle volume of acid concentration in mL. -#define BICARB_CONCENTRATION_BOTTLE_VOLUME_ML 3780.0 ///< Bottle volume of bicarb concentration in mL. -#define CONCENTRATION_BOTTLE_LOW_VOLUME_ML 100.0 ///< Concentration bottle low volume in mL. - #define DATA_PUBLISH_COUNTER_START_COUNT 63 ///< Data publish counter start count. /// Multiplier to convert flow (mL/min) into volume (mL) for period of general task interval. @@ -102,8 +97,6 @@ F32 fillFlowRateAverage; ///< Fill flow average value. F32 fillLastTemperature; ///< Fill last temperature value. BOOL isThisFirstFill; ///< Fill flag to indicate whether it is the first fill or not. - BOOL fillEmptyAcidBottleDetected; ///< Fill acid bottle empty detected. - BOOL fillEmptyBicarbBottleDetected; ///< Fill bicarb bottle empty detected. } FILL_CONDITION_STATUS_T; static U32 dataPublishCounter; ///< Used to schedule dialysate fill data publication to CAN bus. @@ -118,7 +111,7 @@ static U32 flushBubblesStartTime; ///< Starting time for flush bubbles. static U32 concentratePumpPrimeCount; ///< Interval count for concentrate pump prime. -static F32 totalROFlowRateMLPM; ///< Total RO flow rate over period of time. +static F32 integratedVolumeML; ///< Total RO flow rate over period of time. static F32 acidConductivityTotal; ///< Total of acid conductivity during fill. static F32 bicarbConductivityTotal; ///< Total of bicarb conductivity during fill. static U32 conductivitySampleCount; ///< Sample count of conductivity during fill. @@ -174,7 +167,7 @@ dialysateFillStartTime = 0; dataPublishCounter = DATA_PUBLISH_COUNTER_START_COUNT; reservoirBaseWeight = 0.0; - totalROFlowRateMLPM = 0.0; + integratedVolumeML = 0.0; concentrateTestStartTime = 0; acidConductivityTotal = 0.0; bicarbConductivityTotal = 0.0; @@ -189,8 +182,6 @@ totalBicarbConductivity = 0.0; totalAcidConductivity = 0.0; - initPersistentAlarm( ALARM_ID_DG_ACID_BOTTLE_LOW_VOLUME, 0, EMPTY_BOTTLE_DETECT_PERSISTENT_PERIOD_MS ); - initPersistentAlarm( ALARM_ID_DG_BICARB_BOTTLE_LOW_VOLUME, 0, EMPTY_BOTTLE_DETECT_PERSISTENT_PERIOD_MS ); initPersistentAlarm( ALARM_ID_DG_DIALYSATE_TEMPERATURE_SENSORS_DRIFT_TIMEOUT, 0, DIALYSATE_TEMPERATURE_SENSORS_DRIFT_TIMEOUT_MS ); } @@ -366,8 +357,6 @@ fillStatus.fillTemperatureAverage = getHeaterTargetTemperature( DG_TRIMMER_HEATER ); fillStatus.fillLastTemperature = getHeaterTargetTemperature( DG_TRIMMER_HEATER ) + RESERVOIR_EXTRA_TEMPERATURE; fillStatus.isThisFirstFill = TRUE; - fillStatus.fillEmptyAcidBottleDetected = FALSE; - fillStatus.fillEmptyBicarbBottleDetected = FALSE; } /*********************************************************************//** @@ -385,28 +374,48 @@ /*********************************************************************//** * @brief - * The isEmptyAcidBottle function returns the boolean flag that indicates - * whether the acid bottle is empty. + * The getChemicalUsedVolumeML function returns the consumed volume of the called + * chemical bottle in milliliters. * @details Inputs: none * @details Outputs: none - * @return fillStatus.fillEmtyAcidBottleDetected + * @param bottle which the type of bottle (acid or bicarb) can be specified + * @return used chemical volume in millilters *************************************************************************/ -BOOL isEmptyAcidBottle( void ) +F32 getChemicalUsedVolumeML( CHEMICAL_BOTTLES_T bottle ) { - return fillStatus.fillEmptyAcidBottleDetected; + F32 volume; + + if ( ACID == bottle ) + { + volume = getF32OverrideValue( &usedAcidVolumeML ); + } + else if ( BICARB == bottle ) + { + volume = getF32OverrideValue( &usedBicarbVolumeML ); + } + + return volume; } /*********************************************************************//** * @brief - * The isEmptyBicarbBottle function returns the boolean flag that indicates - * whether the bicarb bottle is empty. + * The resetChemicalUsedVolumeML function resets the used volume of a chemical + * bottle. * @details Inputs: none * @details Outputs: none - * @return fillStatus.fillEmtyBicarbBottleDetected + * @param bottle which the type of bottle (acid or bicarb) can be specified + * @return none *************************************************************************/ -BOOL isEmptyBicarbBottle( void ) +void resetChemicalUsedVolumeML( CHEMICAL_BOTTLES_T bottle ) { - return fillStatus.fillEmptyBicarbBottleDetected; + if ( ACID == bottle ) + { + usedAcidVolumeML.data = 0.0; + } + else if ( BICARB == bottle ) + { + usedBicarbVolumeML.data = 0.0; + } } /*********************************************************************//** @@ -441,7 +450,8 @@ { // Prepare the acid and bicarb pumps to prime the concentrate lines setROPumpTargetFlowRateLPM( RO_PUMP_800_ML_PER_MIN / MILLILITERS_PER_LITER, TARGET_RO_PRESSURE_PSI ); - setConcentratePumpTargetSpeed( CONCENTRATEPUMPS_CP1_ACID, CONCENTRATE_PUMP_MAX_SPEED ); + + setConcentratePumpTargetSpeed( CONCENTRATEPUMPS_CP1_ACID, CONCENTRATE_PUMP_MAX_SPEED ); setConcentratePumpTargetSpeed( CONCENTRATEPUMPS_CP2_BICARB, CONCENTRATE_PUMP_MAX_SPEED ); requestConcentratePumpOn( CONCENTRATEPUMPS_CP1_ACID ); // TODO if requestConcentratePumpOn( CONCENTRATEPUMPS_CP2_BICARB ); @@ -451,6 +461,9 @@ } else { + handleDialysateMixing( getMeasuredROFlowRateLPM() * ML_PER_LITER ); + requestConcentratePumpOn( CONCENTRATEPUMPS_CP1_ACID ); + requestConcentratePumpOn( CONCENTRATEPUMPS_CP2_BICARB ); result = DG_FILL_MODE_STATE_PRODUCE_DIALYSATE; } @@ -525,6 +538,7 @@ // Set pumps flow rate to prepare for bicarb conductivity testing setROPumpTargetFlowRateLPM( RO_PUMP_400_ML_PER_MIN / MILLILITERS_PER_LITER, TARGET_RO_PRESSURE_PSI ); + setConcentratePumpTargetSpeed( CONCENTRATEPUMPS_CP2_BICARB, BICARB_PUMP_40_ML_PER_MIN ); requestConcentratePumpOn( CONCENTRATEPUMPS_CP2_BICARB ); @@ -662,7 +676,6 @@ handleDialysateMixing( getMeasuredROFlowRateLPM() * ML_PER_LITER ); #ifndef DISABLE_MIXING - if ( concentratePumpPrimeCount++ > CONCENTRATE_PUMP_PRIME_INTERVAL ) #endif { @@ -684,8 +697,6 @@ *************************************************************************/ static DG_FILL_MODE_STATE_T handleDeliverDialysateState( void ) { - F32 integratedVolumeML; - DG_FILL_MODE_STATE_T result = DG_FILL_MODE_STATE_DELIVER_DIALYSATE; DG_RESERVOIR_ID_T inactiveReservoir = getInactiveReservoir(); F32 acidConductivity = getConductivityValue( CONDUCTIVITYSENSORS_CD1_SENSOR ); @@ -694,8 +705,7 @@ // Set concentrate pumps speed based on the RO pump flow rate handleDialysateMixing( getMeasuredROFlowRateLPM() * ML_PER_LITER ); - totalROFlowRateMLPM += getMeasuredROFlowRateWithConcPumpsLPM() * ML_PER_LITER; - integratedVolumeML = totalROFlowRateMLPM * FLOW_INTEGRATOR; + integratedVolumeML += getMeasuredROFlowRateWithConcPumpsLPM() * ( (F32)TASK_GENERAL_INTERVAL / (F32)( SEC_PER_MIN ) ); usedAcidVolumeML.data += getMeasuredPumpSpeed( CONCENTRATEPUMPS_CP1_ACID ) * FLOW_INTEGRATOR; usedBicarbVolumeML.data += getMeasuredPumpSpeed( CONCENTRATEPUMPS_CP2_BICARB ) * FLOW_INTEGRATOR; @@ -708,31 +718,6 @@ fillStatus.fillFlowRateRunningSum += getMeasuredROFlowRateLPM(); fillStatus.fillTemperatureRunningSum += getTemperatureValue( (U32)TEMPSENSORS_OUTLET_PRIMARY_HEATER ); -#ifndef DISABLE_MIXING - // If you start the fill you should be finished. - - // Detect empty bottles using integrated volumes // TODO: empty bottles detection using conductivity sensors - if ( ( ( ACID_CONCENTRATION_BOTTLE_VOLUME_ML - getF32OverrideValue( &usedAcidVolumeML ) ) <= CONCENTRATION_BOTTLE_LOW_VOLUME_ML ) ) // || // SRSDG 437 - { - usedAcidVolumeML.data = 0.0; - requestConcentratePumpOff( CONCENTRATEPUMPS_CP1_ACID ); - requestConcentratePumpOff( CONCENTRATEPUMPS_CP2_BICARB ); - setValveState( VPO, VALVE_STATE_NOFILL_C_TO_NO ); - fillStatus.isThisFirstFill = TRUE; // empty bottles need replaced, set isThisFirstFill to FALSE so that prime, flush, acid & bicarb test are needed - fillStatus.fillEmptyAcidBottleDetected = TRUE; // set this variable to FALSE when user presses OK on the alarm to confirm bottle has been replaced and resume - } - - if ( ( ( BICARB_CONCENTRATION_BOTTLE_VOLUME_ML - getF32OverrideValue( &usedBicarbVolumeML ) ) <= CONCENTRATION_BOTTLE_LOW_VOLUME_ML ) ) // || // SRSDG 438 - { - usedBicarbVolumeML.data = 0.0; - requestConcentratePumpOff( CONCENTRATEPUMPS_CP1_ACID ); - requestConcentratePumpOff( CONCENTRATEPUMPS_CP2_BICARB ); - setValveState( VPO, VALVE_STATE_NOFILL_C_TO_NO ); - fillStatus.isThisFirstFill = TRUE; - fillStatus.fillEmptyBicarbBottleDetected = TRUE; - } -#endif - setBadAvgConductivityDetectedFlag( FALSE ); // If we've reached our target fill to volume (by weight), we're done filling - go back to generation idle mode // SRSDG 398 @@ -924,9 +909,9 @@ fillModeData.averageBicarbConductivity = averageBicarbConductivity; fillModeData.isThisTheFirstFill = isThisTheFirstFill(); fillModeData.pctDiffInConductivity = pctDiffInConductivity; - fillModeData.usedAcidVolumeML = usedAcidVolumeML.data; - fillModeData.usedBicarbVolumeML = usedBicarbVolumeML.data; - fillModeData.totalIntegratedVolumeML = totalROFlowRateMLPM; + fillModeData.usedAcidVolumeML = getChemicalUsedVolumeML( ACID ); + fillModeData.usedBicarbVolumeML = getChemicalUsedVolumeML( BICARB ); + fillModeData.integratedVolumeML = integratedVolumeML; broadcastData( MSG_ID_DG_FILL_MODE_DATA, COMM_BUFFER_OUT_CAN_DG_BROADCAST, (U08*)&fillModeData, sizeof( DG_FILL_MODE_DATA_T ) ); Index: firmware/App/Modes/ModeFill.h =================================================================== diff -u -r604d8aaceeb8e0b650ac2054644333fc7717bb51 -r1722e975682c9e41e0b75551ada1139d3dc522a6 --- firmware/App/Modes/ModeFill.h (.../ModeFill.h) (revision 604d8aaceeb8e0b650ac2054644333fc7717bb51) +++ firmware/App/Modes/ModeFill.h (.../ModeFill.h) (revision 1722e975682c9e41e0b75551ada1139d3dc522a6) @@ -31,6 +31,13 @@ // ********** public definitions ********** +typedef enum +{ + ACID = 0, + BICARB, + NUM_OF_CHEMICALS, +} CHEMICAL_BOTTLES_T; + /// DG broadcast dialysate fill data structure. typedef struct { @@ -40,7 +47,7 @@ F32 pctDiffInConductivity; ///< The percent difference between CD1 and CD2. F32 usedAcidVolumeML; ///< The used acid volume in ML. F32 usedBicarbVolumeML; ///< The used bicarb volume in ML. - F32 totalIntegratedVolumeML; ///< Total integrated volume in milliliters. + F32 integratedVolumeML; ///< Integrated volume in milliliters. } DG_FILL_MODE_DATA_T; // ********** public function prototypes ********** @@ -63,9 +70,9 @@ BOOL isThisTheFirstFill( void ); -BOOL isEmptyAcidBottle( void ); +F32 getChemicalUsedVolumeML( CHEMICAL_BOTTLES_T bottle ); -BOOL isEmptyBicarbBottle( void ); +void resetChemicalUsedVolumeML( CHEMICAL_BOTTLES_T bottle ); BOOL testSetUsedAcidVolumeMLOverride( F32 value ); BOOL testResetUsedAcidVolumeMLOverride( void );