Index: firmware/App/Controllers/Fans.c =================================================================== diff -u -r321e3603df2611c653e4bd330f640ab35822fd6d -r24a3d75da20cdb0804f781d4992a6585f1883e06 --- firmware/App/Controllers/Fans.c (.../Fans.c) (revision 321e3603df2611c653e4bd330f640ab35822fd6d) +++ firmware/App/Controllers/Fans.c (.../Fans.c) (revision 24a3d75da20cdb0804f781d4992a6585f1883e06) @@ -499,12 +499,24 @@ rpmAlarmStartTime = getMSTimerCount(); } } - // If the alarm has been raised the silence the alarm time has elapsed, get ready to raise the alarm in case the RPM was out of range - // Once the alarm is raised, it is not raised again for 24 hours - else if ( ( calcTimeSince( rpmAlarmStartTime ) + getRPMAlarmStartTimeOffset() ) >= SECONDS_IN_A_DAY * MS_PER_SECOND ) + // If the alarm has been raised and the alarm has been silent for at least a day, set the flag to FALSE + // This way, if the fans RPM are out of range the alarm will be raised again. This alarm is supposed to be raised + // and remain silent for a defined period of time. + else if ( TRUE == hasAlarmBeenRaised ) { - hasAlarmBeenRaised = FALSE; - rpmAlarmStartTime = 0; + // Get the offset time since the last alarm. If the offset time has been overridden, then do not include the time that the alarm was raised first. + // Overrides are used to verify the code so what is sent to the firmware from override is intended to be the actual time so check whether the alarm is + // raised properly or not. Adding the start time of the alarm might cause inaccuracy in the verification process. + // For instance, if 86390 seconds is overridden to make sure the alarm is not raise before 24 hours or 86400, if the rpmAlarmStartTime is added to it + // it might make the time to be greater than 86400 seconds and therefore the alarm is raised again while it is not expected. + U32 offsetTime = getRPMAlarmStartTimeOffset(); + U32 elapsedTime = ( OVERRIDE_KEY == rpmAlarmStartTimeOffset.override ? offsetTime : calcTimeSince( rpmAlarmStartTime ) + offsetTime ); + + if ( elapsedTime >= SECONDS_IN_A_DAY * MS_PER_SECOND ) + { + hasAlarmBeenRaised = FALSE; + rpmAlarmStartTime = 0; + } } }