Index: firmware/App/Modes/ModeFill.c =================================================================== diff -u -ra8ee65f27d84c7ae435b8bbae6a1d82a51e804f1 -reeaab2a9a685fb18845888d91040d3aa01977f6d --- firmware/App/Modes/ModeFill.c (.../ModeFill.c) (revision a8ee65f27d84c7ae435b8bbae6a1d82a51e804f1) +++ firmware/App/Modes/ModeFill.c (.../ModeFill.c) (revision eeaab2a9a685fb18845888d91040d3aa01977f6d) @@ -8,7 +8,7 @@ * @file ModeFill.c * * @author (last) Michael Garthwaite -* @date (last) 16-Mar-2023 +* @date (last) 16-May-2023 * * @author (original) Leonardo Baloa * @date (original) 19-Nov-2019 @@ -65,14 +65,12 @@ #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.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.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.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 DELAY_FMP_CHECK_START_BY_MS ( 10 * MS_PER_SECOND ) ///< Delay start of FMP check during dialysate deliver state by this amount of time (in ms). +#define CONCENTRATE_TEST_COND_COLLECTION_DELAY_MS ( 5 * MS_PER_SECOND ) ///< Concentrate test conductivity data collection delay in milliseconds. #define MAX_RO_REJECTION_RATIO_ALLOW 0.10F ///< Maximum RO rejection ratio. #define MAX_CPO_CONDUCTIVITY_ALLOW 100.0F ///< Maximum CPo sensor conductivity value. @@ -107,6 +105,13 @@ BOOL isThisFirstFill; ///< Fill flag to indicate whether it is the first fill or not. } FILL_CONDITION_STATUS_T; +/// Fill acid and bicarb types +typedef struct +{ + DG_ACID_TYPES_T acidType; ///< Acid type. + DG_BICARB_TYPES_T bicarbType; ///< Bicarb type. +} FILL_ACID_BICARB_TYPES_T; + static U32 dataPublishCounter; ///< Used to schedule dialysate fill data publication to CAN bus. static DG_FILL_MODE_STATE_T fillState; ///< Currently active fill state. static U32 dialysateFillStartTime; ///< Current time when starting to fill dialysate. @@ -139,6 +144,11 @@ static U32 pumpSpeedIndex; ///< Index used to access the desired pump speed in roPumpFlushBubblesSpeed table. static BOOL havePauseActuatorsBeenSet; ///< Flag to indicate the actuators have been set to pause for the first time. +static FILL_ACID_BICARB_TYPES_T chemicalsTypes; ///< Chemicals Types (acid and bicarb). + +// NOTE: This variable should be initialized here because the init function is called every time and then this variable is set to FALSE even if the settings from the +// UI wants the RO only mode. +static BOOL hasROOnlyModeBeenEnabled = FALSE; ///< Flag to indicate the RO only mode has been set or not. 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, @@ -157,6 +167,7 @@ static DG_FILL_MODE_STATE_T handlePausedState( void ); static BOOL areInletWaterConditionsAlarmsActive( void ); +static BOOL areConductivityAlarmsActive( void ); static void handleDialysateMixing( F32 measuredROFlowRate_mL_min, F32 acidMixingRatio, F32 bicarbMixingRatio ); static void setFillInfoToRTCRAM( void ); static BOOL isValueWithinPercentRange( F32 testValue, F32 baseValue, F32 percentFactor ); @@ -166,10 +177,7 @@ * @brief * The initFillMode function initializes the fill mode module. * @details Inputs: none - * @details Outputs: fillState, dialysateFillStartTime, reservoirBaseWeight, - * totalROFlowRateMLPM, concentrateTestStartTime, acidConductivityTotal, - * bicarbConductivityTotal, conductivitySampleCount, havePauseActuatorsBeenSet - * concentratePumpPrimeCount + * @details Outputs: fill mode variables initialized. * @return none *************************************************************************/ void initFillMode( void ) @@ -209,7 +217,7 @@ U32 transitionToFillMode( void ) { initFillMode(); - + setCurrentSubState( NO_SUB_STATE ); // Set initial actuator states setValveState( VDR, VALVE_STATE_DRAIN_C_TO_NO ); setValveState( VPO, VALVE_STATE_NOFILL_C_TO_NO ); @@ -240,7 +248,10 @@ checkDialysateTemperatureSensors(); setHeaterTargetTemperature( DG_PRIMARY_HEATER, getPrimaryHeaterTargetTemperature() ); - fillState = ( TRUE == areInletWaterConditionsAlarmsActive() ? DG_FILL_MODE_STATE_PAUSED : fillState ); + if ( ( TRUE == areInletWaterConditionsAlarmsActive() ) || ( TRUE == areConductivityAlarmsActive() ) ) + { + fillState = DG_FILL_MODE_STATE_PAUSED; + } // Execute current Fill state switch ( fillState ) @@ -439,6 +450,7 @@ * @details Inputs: none * @details Outputs: none * @param flag to TRUE if prime is needed otherwise FALSE + * @return none *************************************************************************/ void setThisFisrtFillFlag( BOOL flag ) { @@ -447,6 +459,49 @@ /*********************************************************************//** * @brief + * The enableROOnlyMode function sets the boolean flag that indicates RO + * only mode has been enabled. + * @details Inputs: none + * @details Outputs: hasROOnlyModeBeenEnabled + * @param enableROOnlyMode TRUE if the RO only mode is requested otherwise, FALSE + * @return none + *************************************************************************/ +void setROMode( BOOL enableROOnlyMode ) +{ + hasROOnlyModeBeenEnabled = enableROOnlyMode; +} + +/*********************************************************************//** + * @brief + * The isROOnlyModeEnabled function returns the status of RO only mode. + * @details Inputs: none + * @details Outputs: none + * @return hasROOnlyModeBeenEnabled, TRUE if the RO only mode has been set + * otherwise, FALSE + *************************************************************************/ +BOOL isROOnlyModeEnabled( void ) +{ + return hasROOnlyModeBeenEnabled; +} + +/*********************************************************************//** + * @brief + * The setAcidAndBicarbType function sets the acid and bicarb types to be + * used in filling. + * @details Inputs: none + * @details Outputs: chemicalsTypes + * @param acid which is the type of acid + * @param bicarb which is the type of bicarb + * @return none + *************************************************************************/ +void setAcidAndBicarbType( U32 acid, U32 bicarb ) +{ + chemicalsTypes.acidType = (DG_ACID_TYPES_T)acid; + chemicalsTypes.bicarbType = (DG_BICARB_TYPES_T)bicarb; +} + +/*********************************************************************//** + * @brief * The handleTestInletWaterState function tests for inlet water quality * and if this is the first fill of a treatment, prime the acid and bicarb * lines before jumping to dialysate production state. @@ -554,11 +609,14 @@ bicarbConductivitySampleCount = 0; // Set pumps flow rate to prepare for bicarb conductivity testing - setROPumpTargetFlowRateLPM( RO_PUMP_400_ML_PER_MIN / MILLILITERS_PER_LITER, TARGET_RO_PRESSURE_PSI ); + setROPumpTargetFlowRateLPM( RO_PUMP_800_ML_PER_MIN / MILLILITERS_PER_LITER, TARGET_RO_PRESSURE_PSI ); setConcentratePumpTargetSpeed( CONCENTRATEPUMPS_CP2_BICARB, BICARB_PUMP_40_ML_PER_MIN ); requestConcentratePumpOn( CONCENTRATEPUMPS_CP2_BICARB ); + // Prior to collecting data for bicarb test, change the CD2 calibration table + setCondcutivitySensorCalTable( CONDUCTIVITYSENSORS_CD2_SENSOR, CAL_DATA_CD2_COND_SENSOR_FILL_BICARB_TEST ); + // State transition concentrateTestStartTime = getMSTimerCount(); result = DG_FILL_MODE_STATE_TEST_BICARB_CONDUCTIVITY; @@ -581,15 +639,26 @@ DG_FILL_MODE_STATE_T result = DG_FILL_MODE_STATE_TEST_BICARB_CONDUCTIVITY; F32 bicarbConductivity = getConductivityValue( CONDUCTIVITYSENSORS_CD2_SENSOR ); - totalBicarbConductivity += bicarbConductivity; - bicarbConductivitySampleCount++; + if ( TRUE == didTimeout( concentrateTestStartTime, CONCENTRATE_TEST_COND_COLLECTION_DELAY_MS ) ) + { + totalBicarbConductivity += bicarbConductivity; + bicarbConductivitySampleCount++; + } if ( TRUE == didTimeout( concentrateTestStartTime, CONCENTRATE_TEST_TIME_OUT_MS ) ) { + DG_CHEMICALS_FILL_COND_CAL_RECORD_T chemicalsCond; + F32 bicarbCondUSPerCM = 0.0F; BOOL isConductivityInRange = FALSE; + + getFillChemicalCondRecord( &chemicalsCond ); + + // In the bicarb test, the acid value is 0, so it is not queried + bicarbCondUSPerCM = chemicalsCond.fillCondValues[ chemicalsTypes.acidType ][ FILL_COND_BICARB_TEST ].bicarbConduSPerCM; + averageBicarbConductivity = totalBicarbConductivity / bicarbConductivitySampleCount; - if ( TRUE == isValueWithinPercentRange( averageBicarbConductivity, BICARB_TEST_CD2_TCD, FIVE_PERCENT_FACTOR ) ) + if ( TRUE == isValueWithinPercentRange( averageBicarbConductivity, bicarbCondUSPerCM, FIVE_PERCENT_FACTOR ) ) { isConductivityInRange = TRUE; } @@ -601,7 +670,7 @@ } #endif - if ( TRUE == isConductivityInRange ) + if ( ( TRUE == isConductivityInRange ) || ( TRUE == getTestConfigStatus( TEST_CONFIG_ENABLE_MIXING_WITH_WATER ) ) ) { // Initialization requestConcentratePumpOff( CONCENTRATEPUMPS_CP2_BICARB, NO_PARK_CONC_PUMPS ); @@ -614,14 +683,18 @@ setROPumpTargetFlowRateLPM( RO_PUMP_800_ML_PER_MIN / MILLILITERS_PER_LITER, TARGET_RO_PRESSURE_PSI ); setConcentratePumpTargetSpeed( CONCENTRATEPUMPS_CP1_ACID, ACID_PUMP_20_ML_PER_MIN ); requestConcentratePumpOn( CONCENTRATEPUMPS_CP1_ACID ); + + // Set back the conductivity of CD2 calibration table to the normal calibration table + setCondcutivitySensorCalTable( CONDUCTIVITYSENSORS_CD2_SENSOR, CAL_DATA_CD2_COND_SENSOR ); + // State transition concentrateTestStartTime = getMSTimerCount(); result = DG_FILL_MODE_STATE_TEST_ACID_CONDUCTIVITY; } else { // Bicarb test failed, go to fault - SET_ALARM_WITH_1_F32_DATA( ALARM_ID_BICARB_CONDUCTIVITY_OUT_OF_RANGE, averageBicarbConductivity ); + SET_ALARM_WITH_1_F32_DATA( ALARM_ID_DG_BICARB_CONDUCTIVITY_OUT_OF_RANGE, averageBicarbConductivity ); } } @@ -644,35 +717,62 @@ F32 acidConductivity = getConductivityValue( CONDUCTIVITYSENSORS_CD1_SENSOR ); F32 bicarbConductivity = getConductivityValue( CONDUCTIVITYSENSORS_CD2_SENSOR ); - totalBicarbConductivity += bicarbConductivity; - bicarbConductivitySampleCount++; + if ( TRUE == didTimeout( concentrateTestStartTime, CONCENTRATE_TEST_COND_COLLECTION_DELAY_MS ) ) + { + totalBicarbConductivity += bicarbConductivity; + bicarbConductivitySampleCount++; - totalAcidConductivity += acidConductivity; - acidConductivitySampleCount++; + totalAcidConductivity += acidConductivity; + acidConductivitySampleCount++; + } if ( TRUE == didTimeout( concentrateTestStartTime, CONCENTRATE_TEST_TIME_OUT_MS ) ) { - BOOL haveTestsPassed = FALSE; + DG_CHEMICALS_FILL_COND_CAL_RECORD_T chemicalsCond; + F32 acidCondUSPerCM = 0.0F; + BOOL hasAcidTestPassed = FALSE; + BOOL hasCD1CD2TestPassed = FALSE; + getFillChemicalCondRecord( &chemicalsCond ); + + acidCondUSPerCM = chemicalsCond.fillCondValues[ chemicalsTypes.acidType ][ FILL_COND_ACID_TEST ].acidConduSPerCM; averageBicarbConductivity = totalBicarbConductivity / bicarbConductivitySampleCount; averageAcidConductivity = totalAcidConductivity / acidConductivitySampleCount; pctDiffInConductivity = fabs( 2.0F * ( averageAcidConductivity - averageBicarbConductivity ) / - ( averageAcidConductivity + averageBicarbConductivity ) ); + ( averageAcidConductivity + averageBicarbConductivity ) ); - if ( ( TRUE == isValueWithinPercentRange( averageAcidConductivity, ACID_TEST_CD2_TCD, FIVE_PERCENT_FACTOR ) ) && - ( pctDiffInConductivity < FIVE_PERCENT_FACTOR ) ) +#ifndef _RELEASE_ + if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_ACID_CONDUCTIVITY_TEST ) != SW_CONFIG_ENABLE_VALUE ) +#endif { - haveTestsPassed = TRUE; - } + if ( ( TRUE == isValueWithinPercentRange( averageAcidConductivity, acidCondUSPerCM, FIVE_PERCENT_FACTOR ) ) || + ( TRUE == getTestConfigStatus( TEST_CONFIG_ENABLE_MIXING_WITH_WATER ) ) ) + { + hasAcidTestPassed = TRUE; + } + else + { + SET_ALARM_WITH_1_F32_DATA( ALARM_ID_DG_ACID_CONDUCTIVITY_OUT_OF_RANGE, averageAcidConductivity ) + } + if ( ( pctDiffInConductivity < FIVE_PERCENT_FACTOR ) || ( TRUE == getTestConfigStatus( TEST_CONFIG_ENABLE_MIXING_WITH_WATER ) ) ) + { + hasCD1CD2TestPassed = TRUE; + } + else + { + SET_ALARM_WITH_1_F32_DATA( ALARM_ID_DG_CD1_CD2_CHECK_FAULT, pctDiffInConductivity ) + } + } #ifndef _RELEASE_ - if ( SW_CONFIG_ENABLE_VALUE == getSoftwareConfigStatus( SW_CONFIG_DISABLE_ACID_CONDUCTIVITY_TEST ) ) + else { - haveTestsPassed = TRUE; + hasAcidTestPassed = TRUE; + hasCD1CD2TestPassed = TRUE; } #endif - if ( TRUE == haveTestsPassed ) + if ( ( TRUE == hasAcidTestPassed ) && ( TRUE == hasCD1CD2TestPassed ) ) { DG_ACID_CONCENTRATES_RECORD_T acid; F32 acidMix; @@ -693,11 +793,6 @@ fillStatus.isThisFirstFill = FALSE; result = DG_FILL_MODE_STATE_PRODUCE_DIALYSATE; } - else - { - // Acid conductivity did not pass, fault - SET_ALARM_WITH_1_F32_DATA( ALARM_ID_ACID_CONDUCTIVITY_OUT_OF_RANGE, averageAcidConductivity ); - } } return result; @@ -822,12 +917,16 @@ // If we've reached our target fill to volume (by weight), we're done filling - go back to generation idle mode // SRSDG 398 if ( TRUE == hasTargetFillVolumeBeenReached( inactiveRsrvr ) ) { + DG_CHEMICALS_FILL_COND_CAL_RECORD_T chemicalsCond; + + getFillChemicalCondRecord( &chemicalsCond ); + F32 filledVolumeML = getReservoirWeight( inactiveRsrvr ) - reservoirBaseWeight; - F32 integratedVolumeToLoadCellReadingPercent = fabs( 1.0F - ( filledVolumeML / getIntegratedVolumeML() ) ); + F32 integratedVolumeToLoadCellReadingPercent = fabs( 1.0F - ( getIntegratedVolumeML() / filledVolumeML ) ); // Filled volume more accurate and stable than the integrated volume from the flowmeter F32 avgAcidConductivity = acidConductivityTotal / conductivitySampleCount; F32 avgBicarbConductivity = bicarbConductivityTotal / conductivitySampleCount; - F32 acidNormalConductivity = acid.acidConcentrate[ CAL_DATA_ACID_CONCENTRATE_1 ].acidConductivityUSPerCM; - F32 bicarbNormalConductivity = bicarb.bicarbConcentrate[ CAL_DATA_BICARB_CONCENTRATE_1 ].bicarbConductivityUSPerCM; + F32 acidNormalConductivity = chemicalsCond.fillCondValues[ chemicalsTypes.acidType ][ FILL_COND_NORMAL_OP ].acidConduSPerCM; + F32 bicarbNormalConductivity = chemicalsCond.fillCondValues[ chemicalsTypes.acidType ][ FILL_COND_NORMAL_OP ].bicarbConduSPerCM; SEND_EVENT_WITH_2_F32_DATA( DG_EVENT_AVG_DIALYSATE_FILL_COND_VALUES, avgAcidConductivity, avgBicarbConductivity ) SEND_EVENT_WITH_2_F32_DATA( DG_EVENT_RESERVOIR_FILL_VALUES, reservoirBaseWeight, filledVolumeML ) @@ -842,15 +941,15 @@ F32 avgCPo = sumFillCPoConductivity / (F32)fillCPoConductivitySampleCnt; // sample count incremented above w/o condition so no need for divide by zero checks F32 avgRR = sumFillRejRatio / (F32)fillCPoConductivitySampleCnt; - if ( avgCPo > MAX_CPO_CONDUCTIVITY_ALLOW ) + if ( ( avgCPo > MAX_CPO_CONDUCTIVITY_ALLOW ) && ( getTestConfigStatus( TEST_CONFIG_ENABLE_MIXING_WITH_WATER ) != FALSE ) ) { // Fault alarm per PRS 483 SET_ALARM_WITH_2_F32_DATA( ALARM_ID_DG_OUTLET_PRIMARY_CONDUCTIVITY_OUT_OF_RANGE, avgCPo, MAX_CPO_CONDUCTIVITY_ALLOW ); } - if ( avgRR > MAX_RO_REJECTION_RATIO_ALLOW ) + if ( ( avgRR > MAX_RO_REJECTION_RATIO_ALLOW ) && ( isROOnlyModeEnabled() != TRUE ) ) { // Fault alarm per PRS 483 - SET_ALARM_WITH_2_F32_DATA( ALARM_ID_RO_REJECTION_RATIO_OUT_OF_RANGE, avgRR, MAX_RO_REJECTION_RATIO_ALLOW ); + SET_ALARM_WITH_2_F32_DATA( ALARM_ID_DG_RO_REJECTION_RATIO_OUT_OF_RANGE, avgRR, MAX_RO_REJECTION_RATIO_ALLOW ); } } } @@ -872,22 +971,24 @@ #endif { // SRSDG 400 - if ( FALSE == isValueWithinPercentRange( avgBicarbConductivity, bicarbNormalConductivity, FIVE_PERCENT_FACTOR ) ) + if ( ( FALSE == isValueWithinPercentRange( avgBicarbConductivity, bicarbNormalConductivity, FIVE_PERCENT_FACTOR ) ) && + ( getTestConfigStatus( TEST_CONFIG_ENABLE_MIXING_WITH_WATER ) != TRUE ) ) { setBadAvgConductivityDetectedFlag( TRUE ); // signal idle bad avg conductivity detected setThisFisrtFillFlag( TRUE ); - SET_ALARM_WITH_2_F32_DATA( ALARM_ID_FILL_CONDUCTIVITY_OUT_OF_RANGE, avgBicarbConductivity, bicarbNormalConductivity ); // trigger replace bottles alarm #1 - clearAlarm( ALARM_ID_CREATING_DIALYSATE_PLEASE_WAIT ); // clear this alarm before triggering in case previous fill was bad and still active from before - activateAlarmNoData ( ALARM_ID_CREATING_DIALYSATE_PLEASE_WAIT ); + SET_ALARM_WITH_2_F32_DATA( ALARM_ID_DG_FILL_CONDUCTIVITY_OUT_OF_RANGE, avgBicarbConductivity, bicarbNormalConductivity ); // trigger replace bottles alarm #1 + clearAlarm( ALARM_ID_DG_CREATING_DIALYSATE_PLEASE_WAIT ); // clear this alarm before triggering in case previous fill was bad and still active from before + activateAlarmNoData ( ALARM_ID_DG_CREATING_DIALYSATE_PLEASE_WAIT ); } - if ( FALSE == isValueWithinPercentRange( avgAcidConductivity, acidNormalConductivity, FIVE_PERCENT_FACTOR ) ) + if ( ( FALSE == isValueWithinPercentRange( avgAcidConductivity, acidNormalConductivity, FIVE_PERCENT_FACTOR ) ) && + ( getTestConfigStatus( TEST_CONFIG_ENABLE_MIXING_WITH_WATER ) != TRUE ) ) { setBadAvgConductivityDetectedFlag( TRUE ); // signal idle bad avg conductivity detected setThisFisrtFillFlag( TRUE ); - SET_ALARM_WITH_2_F32_DATA( ALARM_ID_FILL_CONDUCTIVITY_OUT_OF_RANGE, avgAcidConductivity, acidNormalConductivity ); // trigger replace bottles alarm #1 then - clearAlarm( ALARM_ID_CREATING_DIALYSATE_PLEASE_WAIT ); // clear this alarm before triggering in case previous fill was bad and still active from before - activateAlarmNoData ( ALARM_ID_CREATING_DIALYSATE_PLEASE_WAIT ); + SET_ALARM_WITH_2_F32_DATA( ALARM_ID_DG_FILL_CONDUCTIVITY_OUT_OF_RANGE, avgAcidConductivity, acidNormalConductivity ); // trigger replace bottles alarm #1 then + clearAlarm( ALARM_ID_DG_CREATING_DIALYSATE_PLEASE_WAIT ); // clear this alarm before triggering in case previous fill was bad and still active from before + activateAlarmNoData ( ALARM_ID_DG_CREATING_DIALYSATE_PLEASE_WAIT ); } } @@ -929,7 +1030,7 @@ havePauseActuatorsBeenSet = TRUE; } - if ( FALSE == areInletWaterConditionsAlarmsActive() ) + if ( ( FALSE == areInletWaterConditionsAlarmsActive() ) && ( FALSE == areConductivityAlarmsActive() ) ) { havePauseActuatorsBeenSet = FALSE; result = DG_FILL_MODE_STATE_START; @@ -948,21 +1049,21 @@ *************************************************************************/ static BOOL areInletWaterConditionsAlarmsActive( void ) { - // Check inlet water conductivity, temperature, pressure, and RO rejection ratio + // Check inlet water conductivity, temperature, pressure BOOL status = FALSE; checkInletWaterConductivity(); checkInletWaterTemperature(); checkInletWaterPressure(); // Check if any of the alarms are active - if ( ( TRUE == isAlarmActive( ALARM_ID_INLET_WATER_CONDUCTIVITY_IN_LOW_RANGE ) ) || - ( TRUE == isAlarmActive( ALARM_ID_INLET_WATER_CONDUCTIVITY_IN_HIGH_RANGE ) ) || - ( TRUE == isAlarmActive( ALARM_ID_INLET_WATER_TEMPERATURE_IN_HIGH_RANGE ) ) || - ( TRUE == isAlarmActive( ALARM_ID_INLET_WATER_TEMPERATURE_IN_LOW_RANGE ) ) || - ( TRUE == isAlarmActive( ALARM_ID_DG_OUTLET_PRIMARY_CONDUCTIVITY_OUT_OF_RANGE ) ) || - ( TRUE == isAlarmActive( ALARM_ID_RO_REJECTION_RATIO_OUT_OF_RANGE ) ) || - ( TRUE == isAlarmActive( ALARM_ID_INLET_WATER_PRESSURE_IN_HIGH_RANGE ) ) || - ( TRUE == isAlarmActive( ALARM_ID_INLET_WATER_PRESSURE_IN_LOW_RANGE ) ) ) + if ( ( TRUE == isAlarmActive( ALARM_ID_DG_INLET_WATER_CONDUCTIVITY_IN_LOW_RANGE ) ) || + ( TRUE == isAlarmActive( ALARM_ID_DG_INLET_WATER_CONDUCTIVITY_IN_HIGH_RANGE ) ) || + ( TRUE == isAlarmActive( ALARM_ID_DG_INLET_WATER_TEMPERATURE_IN_HIGH_RANGE ) ) || + ( TRUE == isAlarmActive( ALARM_ID_DG_INLET_WATER_TEMPERATURE_IN_LOW_RANGE ) ) || + ( TRUE == isAlarmActive( ALARM_ID_DG_OUTLET_PRIMARY_CONDUCTIVITY_OUT_OF_RANGE ) ) || + ( TRUE == isAlarmActive( ALARM_ID_DG_RO_REJECTION_RATIO_OUT_OF_RANGE ) ) || + ( TRUE == isAlarmActive( ALARM_ID_DG_INLET_WATER_PRESSURE_IN_HIGH_RANGE ) ) || + ( TRUE == isAlarmActive( ALARM_ID_DG_INLET_WATER_PRESSURE_IN_LOW_RANGE ) ) ) { status = TRUE; } @@ -972,6 +1073,27 @@ /*********************************************************************//** * @brief + * The areConductivityAlarmsActive function checks whether the inlet + * acid/bicarb conductivity alarms are active. + * @details Inputs: none + * @details Outputs: None + * @return TRUE if any of the alarms are active, otherwise, FALSE + *************************************************************************/ +static BOOL areConductivityAlarmsActive( void ) +{ + BOOL status = FALSE; + + if ( ( TRUE == isAlarmActive( ALARM_ID_DG_BICARB_CONDUCTIVITY_OUT_OF_RANGE ) ) || + ( TRUE == isAlarmActive( ALARM_ID_DG_ACID_CONDUCTIVITY_OUT_OF_RANGE ) ) ) + { + status = TRUE; + } + + return status; +} + +/*********************************************************************//** + * @brief * The isValueWithinPercentRange function validates if the test value * is within the percentage range specified by the baseValue and * percentFactor. @@ -1063,6 +1185,7 @@ fillModeData.usedAcidVolumeML = getChemicalUsedVolumeML( ACID ); fillModeData.usedBicarbVolumeML = getChemicalUsedVolumeML( BICARB ); fillModeData.integratedVolumeML = getIntegratedVolumeML(); + fillModeData.roOnlyModeStatus = (U32)isROOnlyModeEnabled(); broadcastData( MSG_ID_DG_FILL_MODE_DATA, COMM_BUFFER_OUT_CAN_DG_BROADCAST, (U08*)&fillModeData, sizeof( DG_FILL_MODE_DATA_T ) );