Index: firmware/App/Modes/ModeFill.c =================================================================== diff -u -r012ee7b4f72e47aa351eb723abca0e3104ea677b -ra0f6f397d02c079dc742c8aa09a0d1ce990c0d4e --- firmware/App/Modes/ModeFill.c (.../ModeFill.c) (revision 012ee7b4f72e47aa351eb723abca0e3104ea677b) +++ firmware/App/Modes/ModeFill.c (.../ModeFill.c) (revision a0f6f397d02c079dc742c8aa09a0d1ce990c0d4e) @@ -61,6 +61,9 @@ #define BICARB_CONCENTRATION_BOTTLE_VOLUME_ML 3000.0 ///< Volume of bicarb concentration in ml. #define CONCENTRATION_BOTTLE_LOW_VOLUME_ML 100.0 ///< Concentration bottle low volume in ml. +#define FLOW_MOVING_AVG_TIME_INTERVAL ( 1 * MS_PER_SECOND / TASK_GENERAL_INTERVAL ) ///< Fill flow moving average time interval. +#define NUMBER_OF_FLOW_SAMPLES_FOR_MOVING_AVG 10.0 ///< Number of flow samples to collect for moving average. + /// 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 ) ); @@ -74,7 +77,7 @@ static U32 concentrateTestStartTime; ///< Starting time for concentrate test. static U32 concentratePumpPrimeCount; ///< Interval count for concentrate pump prime. -static F32 totalROFlowRate_mL_min; ///< Total RO flow rate over period of time. +static F32 totalROFlowRate_mL_min; ///< Total RO flow rate over period of time. static F32 acidConductivityTotal; ///< Total of acid conductivity during fill. static F32 dialysateConductivityTotal; ///< Total of dialysate conductivity during fill. static U32 conductivitySampleCount; ///< Sample count of conductivity during fill. @@ -143,8 +146,8 @@ // NOTE: The target flow rate should be set prior to setting the start primary heater // because the initial guess in the heaters driver needs the target flow to calculate // the new PWMs for the main and small primary heaters - setROPumpTargetFlowRate( TARGET_RO_FLOW_RATE_L, TARGET_RO_PRESSURE_PSI ); - startPrimaryHeater(); + //setROPumpTargetFlowRate( TARGET_RO_FLOW_RATE_L, TARGET_RO_PRESSURE_PSI ); + startHeater( DG_PRIMARY_HEATER ); } /*********************************************************************//** @@ -537,7 +540,7 @@ static BOOL checkDialysateTemperature( void ) { F32 const dialysateTemp = getTemperatureValue( TEMPSENSORS_OUTLET_PRIMARY_HEATER ); - F32 const targetTemp = getPrimaryHeaterTargetTemperature(); + F32 const targetTemp = getHeaterTargetTemperature( DG_PRIMARY_HEATER ); return ( ( fabs( dialysateTemp - targetTemp ) <= DIALYSATE_TEMPERATURE_TOLERANCE_C ) ? TRUE : FALSE ); }