Index: firmware/App/Controllers/UVReactors.c =================================================================== diff -u -r5e99007b56b14a0656fabb7145fe86ac17900f93 -r080a5f15856ba1461784d260fe09157cb77b608b --- firmware/App/Controllers/UVReactors.c (.../UVReactors.c) (revision 5e99007b56b14a0656fabb7145fe86ac17900f93) +++ firmware/App/Controllers/UVReactors.c (.../UVReactors.c) (revision 080a5f15856ba1461784d260fe09157cb77b608b) @@ -2,6 +2,7 @@ #include "gio.h" #include "reg_het.h" +#include "AlarmMgmt.h" #include "Common.h" #include "PersistentAlarm.h" #include "SystemCommMessages.h" @@ -50,7 +51,6 @@ SWITCH_STATES_T switchState; ///< UV reactor turn on/turn off state U32 reactorEnablePin; ///< UV reactor enable pin of GIO port A U32 reactorHealthStatusPin; ///< UV reactor status pin of N2HET1 - U32 reactorUnhealthyCounter; ///< UV reactor counter of the number of times it is unhealthy in a row OVERRIDE_U32_T healthStatus; ///< UV reactor current health status } UV_REACTOR_STATUS_T; @@ -114,7 +114,6 @@ reactorsStatus[ reactor ].pinSignalState = PIN_SIGNAL_LOW; reactorsStatus[ reactor ].execState = UV_REACTOR_STATE_OFF; reactorsStatus[ reactor ].switchState = TURN_OFF; - reactorsStatus[ reactor ].reactorUnhealthyCounter = 0; } initPersistentAlarm( PERSISTENT_ALARM_UV_REACTOR_UNHEALTHY, ALARM_ID_UV_REACTOR_NOT_HEALTHY, TRUE, @@ -384,24 +383,14 @@ BOOL isReactorHealthy = getUVReactorHealth( reactor ); - // Check if the reactor is not healthy and it has not been healthy for a certain period of time - if ( FALSE == isReactorHealthy ) + checkPersistentAlarm( PERSISTENT_ALARM_UV_REACTOR_UNHEALTHY, !isReactorHealthy, (U32)reactor, MAX_UNHEALTHY_REACTOR_COUNT_LIMIT ); + + // Check if the alarm has been active + if( isAlarmActive( ALARM_ID_UV_REACTOR_NOT_HEALTHY ) ) { - if ( ++reactorsStatus[ reactor ].reactorUnhealthyCounter > MAX_UNHEALTHY_REACTOR_COUNT_LIMIT ) - { - // Done with health. turn off the reactor and go to off state - reactorsStatus[ reactor ].reactorUnhealthyCounter = 0; - reactorsStatus[ reactor ].switchState = TURN_OFF; - } + reactorsStatus[ reactor ].switchState = TURN_OFF; } - // If the reactor became healthy again but the counter was > 0, set it to 0 - else - { - reactorsStatus[ reactor ].reactorUnhealthyCounter = 0; - } - checkPersistentAlarm( PERSISTENT_ALARM_UV_REACTOR_UNHEALTHY, !isReactorHealthy, (U32)reactor, MAX_UNHEALTHY_REACTOR_COUNT_LIMIT ); - // Check if it has been requested to turn off a reactor if( TURN_OFF == reactorsStatus[ reactor ].switchState ) {