Index: firmware/App/Modes/ModeFill.c =================================================================== diff -u -rfc771c72bf949b023a934843884f1ee1a1530cb7 -rbd80dccfee1f58fdbc49bf05dd000005b105fe26 --- firmware/App/Modes/ModeFill.c (.../ModeFill.c) (revision fc771c72bf949b023a934843884f1ee1a1530cb7) +++ firmware/App/Modes/ModeFill.c (.../ModeFill.c) (revision bd80dccfee1f58fdbc49bf05dd000005b105fe26) @@ -84,6 +84,11 @@ /// Multiplier to convert flow (mL/min) into volume (mL) for period of general task interval. static const F32 FLOW_INTEGRATOR = ( (F32)TASK_GENERAL_INTERVAL / (F32)( SEC_PER_MIN * MS_PER_SECOND ) ); +static const F32 RO_PUMP_FLUSH_BUBBLES_FLOWS[ RO_PUMP_LOOKUP_TABLE_SIZE ] = { RO_PUMP_400_ML_PER_MIN, ///< Lookup table to determine the desired RO speed in mL/min when flushing bubbles. + RO_PUMP_800_ML_PER_MIN, + RO_PUMP_400_ML_PER_MIN, + RO_PUMP_800_ML_PER_MIN }; + // ********** private data ********** /// Fill conditions status @@ -127,23 +132,20 @@ static F32 totalBicarbConductivity; ///< Total bicarb conductivity over 30 seconds. static F32 totalAcidConductivity; ///< Total acid conductivity over 30 seconds. +static U32 pumpSpeedIndex; ///< Index used to access the desired pump speed in roPumpFlushBubblesSpeed table. + + static OVERRIDE_F32_T usedAcidVolumeML = { 0.0, 0.0, 0.0, 0.0 }; ///< The integrated acid concentration volume has been used in mL. static OVERRIDE_F32_T usedBicarbVolumeML = { 0.0, 0.0, 0.0, 0.0 }; ///< The integrated bicarb concentration volume has been used in mL. static OVERRIDE_U32_T fillModeDataPublishInterval = { FILL_MODE_DATA_PUB_INTERVAL, FILL_MODE_DATA_PUB_INTERVAL, 0, 0 }; ///< Interval (in ms) at which to publish fill mode data to CAN bus. -static F32 roPumpFlushBubblesSpeed[ RO_PUMP_LOOKUP_TABLE_SIZE ] = { RO_PUMP_400_ML_PER_MIN, ///< Lookup table to determine the desired RO speed in mL/min when flushing bubbles. - RO_PUMP_800_ML_PER_MIN, - RO_PUMP_400_ML_PER_MIN, - RO_PUMP_800_ML_PER_MIN }; -static U32 pumpSpeedIndex; ///< Index used to access the desired pump speed in roPumpFlushBubblesSpeed table. - // ********** private function prototypes ********** static DG_FILL_MODE_STATE_T handleTestInletWaterState( void ); -static DG_FILL_MODE_STATE_T handlePrimeConcentrateLines( void ); -static DG_FILL_MODE_STATE_T handleFlushBubbles( void ); +static DG_FILL_MODE_STATE_T handlePrimeConcentrateLinesState( void ); +static DG_FILL_MODE_STATE_T handleFlushBubblesState( void ); static DG_FILL_MODE_STATE_T handleTestBicarbConductivityState( void ); static DG_FILL_MODE_STATE_T handleTestAcidConductivityState( void ); static DG_FILL_MODE_STATE_T handleProduceDialysateState( void ); @@ -265,11 +267,11 @@ break; case DG_FILL_MODE_STATE_PRIME_CONCENTRATE_LINES: - fillState = handlePrimeConcentrateLines(); + fillState = handlePrimeConcentrateLinesState(); break; case DG_FILL_MODE_STATE_FLUSH_BUBBLES: - fillState = handleFlushBubbles(); + fillState = handleFlushBubblesState(); break; case DG_FILL_MODE_STATE_TEST_BICARB_CONDUCTIVITY: @@ -473,13 +475,13 @@ /*********************************************************************//** * @brief - * The handlePrimeConcentrateLines function primes the acid and bicarb + * The handlePrimeConcentrateLinesState function primes the acid and bicarb * lines. * @details Inputs: None * @details Outputs: None * @return the next state *************************************************************************/ -static DG_FILL_MODE_STATE_T handlePrimeConcentrateLines( void ) +static DG_FILL_MODE_STATE_T handlePrimeConcentrateLinesState( void ) { DG_FILL_MODE_STATE_T result = DG_FILL_MODE_STATE_PRIME_CONCENTRATE_LINES; @@ -491,7 +493,7 @@ // Set the RO pump flow rate in according to the roPumpFlushBubblesSpeed table to flush bubbles pumpSpeedIndex = 0; - setROPumpTargetFlowRateLPM( roPumpFlushBubblesSpeed[ pumpSpeedIndex ] / MILLILITERS_PER_LITER, TARGET_RO_PRESSURE_PSI ); + setROPumpTargetFlowRateLPM( RO_PUMP_FLUSH_BUBBLES_FLOWS[ pumpSpeedIndex ] / MILLILITERS_PER_LITER, TARGET_RO_PRESSURE_PSI ); flushBubblesStartTime = getMSTimerCount(); } #endif @@ -503,7 +505,7 @@ /*********************************************************************//** * @brief - * The handleFlushBubbles function removes the bubbles in the RO lines by + * The handleFlushBubblesState function removes the bubbles in the RO lines by * running the RP pump at 400 mL/minute for 2 seconds 0 * then 800 mL/minute for 2 seconds 1 * then 400 mL/minute for 2 seconds 2 @@ -512,15 +514,15 @@ * @details Outputs: request RO pump flow rate in mL/minute * @return the next state *************************************************************************/ -static DG_FILL_MODE_STATE_T handleFlushBubbles( void ) +static DG_FILL_MODE_STATE_T handleFlushBubblesState( void ) { DG_FILL_MODE_STATE_T result = DG_FILL_MODE_STATE_FLUSH_BUBBLES; if ( TRUE == didTimeout( flushBubblesStartTime, FLUSH_BUBBLES_PUMP_TIME_OUT_MS ) ) { - if ( ++pumpSpeedIndex < RO_PUMP_LOOKUP_TABLE_SIZE ) + if ( pumpSpeedIndex < RO_PUMP_LOOKUP_TABLE_SIZE ) { - setROPumpTargetFlowRateLPM( roPumpFlushBubblesSpeed[ pumpSpeedIndex ] / MILLILITERS_PER_LITER, TARGET_RO_PRESSURE_PSI ); + setROPumpTargetFlowRateLPM( RO_PUMP_FLUSH_BUBBLES_FLOWS[ pumpSpeedIndex++ ] / MILLILITERS_PER_LITER, TARGET_RO_PRESSURE_PSI ); flushBubblesStartTime = getMSTimerCount(); } else @@ -569,9 +571,9 @@ requestConcentratePumpOff( CONCENTRATEPUMPS_CP2_BICARB ); totalBicarbConductivity = 0.0; totalAcidConductivity = 0.0; - averageBicarbConductivity = 0.0; - averageAcidConductivity = 0.0; - pctDiffInConductivity = 0.0; + //averageBicarbConductivity = 0.0; + //averageAcidConductivity = 0.0; + //pctDiffInConductivity = 0.0; bicarbConductivitySampleCount = 0; acidConductivitySampleCount = 0; #endif @@ -642,8 +644,8 @@ } else { - SET_ALARM_WITH_1_F32_DATA( ALARM_ID_ACID_CONDUCTIVITY_OUT_OF_RANGE, averageAcidConductivity ); - requestNewOperationMode( DG_MODE_GENE ); + //SET_ALARM_WITH_1_F32_DATA( ALARM_ID_ACID_CONDUCTIVITY_OUT_OF_RANGE, averageAcidConductivity ); + //requestNewOperationMode( DG_MODE_GENE ); } }