Index: firmware/App/Controllers/UVReactors.c =================================================================== diff -u -r025612ad77fe630889a364586de54bffe5262d56 -rd7e69554ce0d291ec3f5576367792dd7810a01ea --- firmware/App/Controllers/UVReactors.c (.../UVReactors.c) (revision 025612ad77fe630889a364586de54bffe5262d56) +++ firmware/App/Controllers/UVReactors.c (.../UVReactors.c) (revision d7e69554ce0d291ec3f5576367792dd7810a01ea) @@ -42,6 +42,7 @@ /// Self test wait time after enabling the reactors and before checking for their health in ms. #define SELF_TEST_DELAY_TIME 1000 #define MAX_ALLOWED_UNHEALTHY_REACTOR_PERIOD MS_PER_SECOND ///< UV reactors unhealthy state period. +#define DATA_PUBLISH_COUNTER_START_COUNT 6 ///< Data publish counter start count. /// UV reactors self test states typedef enum self_tests @@ -80,8 +81,8 @@ static OVERRIDE_U32_T uvReactorsDataPublishInterval = { UV_REACTORS_DATA_PUB_INTERVAL, UV_REACTORS_DATA_PUB_INTERVAL, 0, 0 }; ///< UV reactors data publish interval. -static U32 dataPublishCounter = 0; ///< UV reactors data publish counter. -static U32 selfTestElapsedTime = 0; ///< UV reactors self test elapsed time. +static U32 dataPublishCounter; ///< UV reactors data publish counter. +static U32 selfTestElapsedTime; ///< UV reactors self test elapsed time. // Self test functions static UV_REACTORS_SELF_TEST_STATE_T handleUVReactorsSelfTestOff( void ); @@ -102,7 +103,7 @@ * @details Inputs: uvReactorsSelfTestResult, dataPublishCounter, * reactorsStatus, selfTestStates * @details Outputs: uvReactorsSelfTestResult, dataPublishCounter, - * reactorsStatus, selfTestStates + * reactorsStatus, selfTestStates, selfTestElapsedTime * @return none *************************************************************************/ void initUVReactors( void ) @@ -111,7 +112,8 @@ uvReactorsSelfTestResult = SELF_TEST_STATUS_IN_PROGRESS; uvReactorsSelfTestStates = UV_REACTORS_SELF_TEST_OFF; - dataPublishCounter = 0; + dataPublishCounter = DATA_PUBLISH_COUNTER_START_COUNT; + selfTestElapsedTime = 0; // Initialize the UV reactors. These values are specific to the inlet and outlet reactor // so they cannot be in a for loop @@ -320,7 +322,7 @@ BOOL isOutletHealthy = (BOOL)getReactorHealth( OUTLET_UV_REACTOR ); // Check if both of them are healthy and if not, raise an alarm - if ( ( TRUE == isInletHealthy ) &&( TRUE == isOutletHealthy ) ) + if ( ( TRUE == isInletHealthy ) && ( TRUE == isOutletHealthy ) ) { uvReactorsSelfTestResult = SELF_TEST_STATUS_PASSED; } @@ -395,10 +397,8 @@ // Get the health of the reactor (override or non-override) and decide the status BOOL isReactorUnhealthy = ( UV_REACTOR_HEALTHY == getUVReactorHealth( reactor ) ? FALSE : TRUE ); - checkPersistentAlarm( ALARM_ID_UV_REACTOR_NOT_HEALTHY, isReactorUnhealthy, (U32)reactor, MAX_ALLOWED_UNHEALTHY_REACTOR_PERIOD ); - // Check if the alarm has been active - if ( TRUE == isAlarmActive( ALARM_ID_UV_REACTOR_NOT_HEALTHY ) ) + if ( TRUE == checkPersistentAlarm( ALARM_ID_UV_REACTOR_NOT_HEALTHY, isReactorUnhealthy, (U32)reactor, MAX_ALLOWED_UNHEALTHY_REACTOR_PERIOD ) ) { reactorsStatus[ reactor ].switchState = TURN_OFF; }