Index: firmware/App/Modes/ModeFill.c =================================================================== diff -u -r6835f89b10dfac6fa12d27b357a85670fdcde088 -r83e2e219e3a8aeea65d6dbaeea15c9498427fd78 --- firmware/App/Modes/ModeFill.c (.../ModeFill.c) (revision 6835f89b10dfac6fa12d27b357a85670fdcde088) +++ firmware/App/Modes/ModeFill.c (.../ModeFill.c) (revision 83e2e219e3a8aeea65d6dbaeea15c9498427fd78) @@ -55,6 +55,9 @@ #define CONDUCTIVITY_ERROR_PERSISTENCE_PERIOD_MS ( 5 * MS_PER_SECOND ) ///< Persistence period for conductivity error. +#define MAXIMUM_DIALYSATE_TEMPERATURE 42.0 ///< Maximum allowed dialysate temperature in degree C. +#define MINIMUM_DIALYSATE_TEMPERATURE 33.0 ///< Minimum allowed dialysate temperature in degree C. + /// Multiplier to convert flow (L/min) into volume (mL) for period of general task interval. static const F32 RO_FLOW_INTEGRATOR = ( ( ML_PER_LITER * TASK_GENERAL_INTERVAL ) / ( SEC_PER_MIN * MS_PER_SECOND ) ); @@ -71,6 +74,7 @@ static BOOL isWaterQualityGood( void ); static BOOL checkDialysateConductivity( void ); +static BOOL checkDialysateTemperature( void ); static DG_FILL_MODE_STATE_T handleCheckInletWaterState( void ); static DG_FILL_MODE_STATE_T handleBicarbPumpCheckState( void ); static DG_FILL_MODE_STATE_T handleAcidPumpCheckState( void ); @@ -238,6 +242,27 @@ /*********************************************************************//** * @brief + * The checkDialysateTemperature function checks dialysate temperature after + * it gets heated up by primary heater. + * @details Inputs: TPo temperature value + * @details Outputs: None + * @return TRUE if dialysate temperature is good, otherwise FALSE + *************************************************************************/ +static BOOL checkDialysateTemperature( void ) +{ + BOOL result = FALSE; + F32 const dialysateTemp = getTemperatureValue( TEMPSENSORS_OUTLET_PRIMARY_HEATER ); + + if ( ( MINIMUM_DIALYSATE_TEMPERATURE <= dialysateTemp ) && ( dialysateTemp <= MAXIMUM_DIALYSATE_TEMPERATURE ) ) + { + result = TRUE; + } + + return result; +} + +/*********************************************************************//** + * @brief * The handleCheckInletWaterState function checks for inlet water quality * before jumping to dialysate production state. * @details Inputs: Temperature and conductivity alarms @@ -350,9 +375,8 @@ handleDialysateMixing(); - // TODO - transition when temperature and mix is in range #ifndef DISABLE_DIALYSATE_CHECK - if ( TRUE == checkDialysateConductivity() ) + if ( ( TRUE == checkDialysateConductivity() ) && ( TRUE == checkDialysateTemperature() ) ) #endif { setValveState( VPO, VALVE_STATE_FILL_C_TO_NC ); @@ -378,8 +402,7 @@ handleDialysateMixing(); - // TODO - transition back when temperature or mix out of range - if ( FALSE == checkDialysateConductivity() ) + if ( ( FALSE == checkDialysateConductivity() ) || ( FALSE == checkDialysateTemperature() ) ) { #ifndef DISABLE_DIALYSATE_CHECK setValveState( VPO, VALVE_STATE_NOFILL_C_TO_NO ); Index: firmware/App/Modes/ModeRecirculate.c =================================================================== diff -u -rebbb1f85550a1f9b8f946655f7b2b63f76fbf67d -r83e2e219e3a8aeea65d6dbaeea15c9498427fd78 --- firmware/App/Modes/ModeRecirculate.c (.../ModeRecirculate.c) (revision ebbb1f85550a1f9b8f946655f7b2b63f76fbf67d) +++ firmware/App/Modes/ModeRecirculate.c (.../ModeRecirculate.c) (revision 83e2e219e3a8aeea65d6dbaeea15c9498427fd78) @@ -91,21 +91,13 @@ setROPumpTargetFlowRate( TARGET_RO_FLOW_RATE_L, TARGET_RO_PRESSURE_PSI ); signalDrainPumpHardStop(); - startPrimaryHeater(); + stopPrimaryHeater(); requestConcentratePumpsOff( CONCENTRATEPUMPS_CP1_ACID ); requestConcentratePumpsOff( CONCENTRATEPUMPS_CP2_BICARB ); // UV on turnOnUVReactor( INLET_UV_REACTOR ); turnOnUVReactor( OUTLET_UV_REACTOR ); - -#ifndef _VECTORCAST_ - { // TODO - test code to start the fan since we're turning the heater on - F32 fanPWM = 0.25; - etpwmSetCmpA( etpwmREG6, (U32)( (S32)( ( fanPWM * (F32)(etpwmREG6->TBPRD) ) + FLOAT_TO_INT_ROUNDUP_OFFSET ) ) ); - etpwmSetCmpB( etpwmREG6, (U32)( (S32)( ( fanPWM * (F32)(etpwmREG6->TBPRD) ) + FLOAT_TO_INT_ROUNDUP_OFFSET ) ) ); - } -#endif } /*********************************************************************//**