Index: firmware/App/Controllers/UVReactors.c =================================================================== diff -u -r22176ce95e49213c48454f34ddf5d29b8109f2cb -r7f38146626e566ac94d97d785af7290529992fdd --- firmware/App/Controllers/UVReactors.c (.../UVReactors.c) (revision 22176ce95e49213c48454f34ddf5d29b8109f2cb) +++ firmware/App/Controllers/UVReactors.c (.../UVReactors.c) (revision 7f38146626e566ac94d97d785af7290529992fdd) @@ -7,8 +7,8 @@ * * @file UVReactors.c * -* @author (last) Dara Navaei -* @date (last) 02-May-2022 +* @author (last) Bill Bracken +* @date (last) 18-Aug-2022 * * @author (original) Dara Navaei * @date (original) 24-Nov-2020 @@ -43,7 +43,8 @@ #define SELF_TEST_DELAY_TIME 1000 ///< Self test wait time after enabling the reactors and before checking for their health in ms. #define MAX_ALLOWED_UNHEALTHY_REACTOR_PERIOD MS_PER_SECOND ///< UV reactors unhealthy state period. #define DATA_PUBLISH_COUNTER_START_COUNT 90 ///< Data publish counter start count. -#define UV_REACTORS_ON_NO_FLOW_TIMEOUT_MS ( 1 * MS_PER_SECOND ) ///< UV reactors on with no flow time out in milliseconds. +#define UV_REACTORS_ON_NO_FLOW_TIMEOUT_MS ( 2 * MS_PER_SECOND ) ///< UV reactors on with no flow time out in milliseconds. +#define MIN_RO_UV_FLOWRATE_LPM 0.2F ///< Minimum target RO UV flow rate in L/min. /// UV reactors self test states typedef enum self_tests @@ -374,7 +375,7 @@ if ( TURN_ON == reactorsStatus[ reactor ].switchState ) { // Check if the flow is below minimum - reactorsStatus[ reactor ].isFlowBelowMin = ( getMeasuredROFlowRateLPM() < MIN_RO_FLOWRATE_LPM ? TRUE : FALSE ); + reactorsStatus[ reactor ].isFlowBelowMin = ( getMeasuredROFlowRateLPM() < MIN_RO_UV_FLOWRATE_LPM ? TRUE : FALSE ); // If the flow is no longer below minimum and the reactor is requested to be on, turn it back on if ( FALSE == reactorsStatus[ reactor ].isFlowBelowMin ) @@ -410,15 +411,15 @@ if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_UV_REACTORS ) != SW_CONFIG_ENABLE_VALUE ) #endif { - // Check if the alarm has been active - if ( TRUE == checkPersistentAlarm( ALARM_ID_UV_REACTOR_NOT_HEALTHY, isReactorUnhealthy, (U32)reactor, MAX_ALLOWED_UNHEALTHY_REACTOR_PERIOD ) ) + checkPersistentAlarm( ALARM_ID_UV_REACTOR_NOT_HEALTHY, isReactorUnhealthy, (U32)reactor, MAX_ALLOWED_UNHEALTHY_REACTOR_PERIOD ); + if ( TRUE == isPersistentAlarmTriggered( ALARM_ID_UV_REACTOR_NOT_HEALTHY, isReactorUnhealthy) ) { reactorsStatus[ reactor ].switchState = TURN_OFF; } } // Check if the flow is below minimum - BOOL isFlowBelowMin = ( getMeasuredROFlowRateLPM() < MIN_RO_FLOWRATE_LPM ? TRUE : FALSE ); + BOOL isFlowBelowMin = ( getMeasuredROFlowRateLPM() < MIN_RO_UV_FLOWRATE_LPM ? TRUE : FALSE ); if ( TRUE == isFlowBelowMin ) { @@ -433,16 +434,14 @@ // If the flow is below minimum and the allowed time has elapsed, set the reactor's signal to be low and set its state // to be off. setReactorEnableStatus( reactor, PIN_SIGNAL_LOW ); - // The state is directly changed here because the switch state is not changed to be off - reactorsStatus[ reactor ].execState = UV_REACTOR_STATE_OFF; + state = UV_REACTOR_STATE_OFF; } } // Check if it has been requested to turn off a reactor if ( TURN_OFF == reactorsStatus[ reactor ].switchState ) { setReactorEnableStatus( reactor, PIN_SIGNAL_LOW ); - state = UV_REACTOR_STATE_OFF; }