Index: RTC.c =================================================================== diff -u -r757a89d81eede6e9894a4c3199a64cb26bf94923 -r01f42c315442c887cf8050af4ecafa6fe7e7e93b --- RTC.c (.../RTC.c) (revision 757a89d81eede6e9894a4c3199a64cb26bf94923) +++ RTC.c (.../RTC.c) (revision 01f42c315442c887cf8050af4ecafa6fe7e7e93b) @@ -7,8 +7,8 @@ * * @file RTC.c * -* @author (last) Bill Bracken -* @date (last) 30-Jun-2023 +* @author (last) Michael Garthwaite +* @date (last) 14-Sep-2023 * * @author (original) Dara Navaei * @date (original) 11-Jan-2020 @@ -114,6 +114,7 @@ #define FPGA_ACCURACY_TOLERANCE 12U ///< FPGA accuracy tolerance in ms #define RTC_PUBLISH_INTERVAL 18U ///< RTC publish interval in counts (18) #define RTC_REG_ERROR_TIMEOUT_MS ( 3 * MS_PER_SECOND ) ///< RTC register error timeout in milliseconds. +#define RTC_BATTERY_LOW_TIMEOUT_MS ( 3 * MS_PER_SECOND ) ///< RTC battery low timeout in milliseconds. #define TIMER_COUNTER_TO_REQUEST_READ 18U ///< Timer counter for reading time from RTC (18) #define MAX_ALLOWED_FAILED_RTC_TRANSFERS 3U ///< Max allowed failed RTC transfers (3) @@ -281,9 +282,11 @@ #ifdef _DG_ initPersistentAlarm( ALARM_ID_DG_RTC_CONFIG_ERROR, RTC_REG_ERROR_TIMEOUT_MS, RTC_REG_ERROR_TIMEOUT_MS ); + initPersistentAlarm( ALARM_ID_DG_RTC_BATTERY_LOW, RTC_BATTERY_LOW_TIMEOUT_MS, RTC_BATTERY_LOW_TIMEOUT_MS ); #endif #ifdef _HD_ initPersistentAlarm( ALARM_ID_HD_RTC_CONFIG_ERROR, RTC_REG_ERROR_TIMEOUT_MS, RTC_REG_ERROR_TIMEOUT_MS ); + initPersistentAlarm( ALARM_ID_HD_RTC_BATTERY_LOW, RTC_BATTERY_LOW_TIMEOUT_MS, RTC_BATTERY_LOW_TIMEOUT_MS ); #endif } @@ -325,10 +328,6 @@ { isDataOk = FALSE; } - else if ( ( years - YEAR_2000 ) > MAX_ALLOWED_YEARS ) - { - isDataOk = FALSE; - } else { hasWriteToRTCRequested = TRUE;