Index: firmware/App/Modes/ModeROPermeateSample.c =================================================================== diff -u -rfab0257d4913c021698418277e742c2a61e0368e -rb60a41d0ef4ca2d04287adc357c4cdde2b7cb613 --- firmware/App/Modes/ModeROPermeateSample.c (.../ModeROPermeateSample.c) (revision fab0257d4913c021698418277e742c2a61e0368e) +++ firmware/App/Modes/ModeROPermeateSample.c (.../ModeROPermeateSample.c) (revision b60a41d0ef4ca2d04287adc357c4cdde2b7cb613) @@ -1,3 +1,19 @@ +/************************************************************************** +* +* Copyright (c) 2023-2024 Diality Inc. - All Rights Reserved. +* +* THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN +* WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. +* +* @file ModeROPermeateSample.c +* +* @author (last) Dara Navaei +* @date (last) 27-Jul-2023 +* +* @author (original) Dara Navaei +* @date (original) 24-May-2023 +* +***************************************************************************/ #include "ConcentratePumps.h" #include "ConductivitySensors.h" @@ -32,9 +48,9 @@ // ********** private data ********** #define RO_PERMEATE_SAMPLE_DATA_PUB_INTERVAL ( MS_PER_SECOND / TASK_GENERAL_INTERVAL ) ///< Mode RO permeate sample data publish interval in counts. -#define ACID_PUMP_SPEED_ML_PER_MIN 30.6F ///< Acid concentrate pump speed in mL/min. -// The acid pump is 2% faster than the acid pump to create a flow from acid to bicarb line during sampling -#define BICARB_PUMP_SPEED_ML_PER_MIN -30.0F ///< Bicarb concentrate pump speed in mL/min. +#define ACID_PUMP_SPEED_ML_PER_MIN -30.0F ///< Acid concentrate pump speed in mL/min. +// The bicarb pump is 2% faster than the acid pump to create a flow from bicarb to acid line during sampling +#define BICARB_PUMP_SPEED_ML_PER_MIN 30.6F ///< Bicarb concentrate pump speed in mL/min. #define RO_PUMP_TARGET_FLOW_RATE_LPM 0.8F ///< RO pump target flow rate during flush/fill in L/min. #define RO_PUMP_MAX_PRESSURE_PSI 130 ///< Maximum RO pump pressure during flush/fill states in psi. #define FLUSH_DRAIN_WAIT_TIME_MS ( 2 * SEC_PER_MIN * MS_PER_SECOND ) ///< Flush Drain path wait time in milliseconds. @@ -604,13 +620,16 @@ *************************************************************************/ static void failROPermeateSample( void ) { + // If a fault alarm is active go to mode fault otherwise for cleaning mode alarms, transition to standby + DG_OP_MODE_T nextOpMode = ( FALSE == isDGFaultAlarmActive() ? DG_MODE_STAN : DG_MODE_FAUL ); + // In the cleaning modes the alarms are triggered but the mode is not transitioned to fault automatically // so transition to fault mode is done here if ( alarmDetectedPendingTrigger != ALARM_ID_NO_ALARM ) { SET_ALARM_WITH_1_U32_DATA( alarmDetectedPendingTrigger, roPermeateSamplePrevState ) } - requestNewOperationMode( DG_MODE_STAN ); + requestNewOperationMode( nextOpMode ); } /*********************************************************************//** @@ -732,7 +751,8 @@ // Drain pump setDrainPumpTargetRPM( RSRVR_DRAIN_TARGET_RPM ); // Variables - stateStartTimeMS = getMSTimerCount(); + rsrvrsStatus.rsrvr[ DG_RESERVOIR_1 ].rStatus = DG_RESERVOIR_ABOVE_TARGET; + stateStartTimeMS = getMSTimerCount(); break; case DG_RO_PERM_SAMPLE_STATE_DRAIN_R2: