Merge pull request #3686 from marcelverdult/upstream-pr/esp32-rtc-backup-once

Define the RTC backup of ESP32RTCClock once instead of per translation unit
This commit is contained in:
ripplebiz authored and GitHub committed 2026-10-28 14:38:36 +11:00
commit 02c827b27d
2 files changed
+9 -2

No files matched your search

+4
View File
@@ -3,6 +3,10 @@
#include "ESP32Board.h"
#include <target.h>
// The RTC backup of ESP32RTCClock, declared in ESP32Board.h.
RTC_NOINIT_ATTR uint32_t _rtc_backup_time;
RTC_NOINIT_ATTR uint32_t _rtc_backup_magic;
#if defined(ADMIN_PASSWORD) && !defined(DISABLE_WIFI_OTA) // Repeater or Room Server only
#include <WiFi.h>
#include <AsyncTCP.h>
+5 -2
View File
@@ -200,8 +200,11 @@ public:
}
};
static RTC_NOINIT_ATTR uint32_t _rtc_backup_time;
static RTC_NOINIT_ATTR uint32_t _rtc_backup_magic;
// The time ESP32RTCClock restores after a reset, in RTC memory that a reset does
// not clear. Defined once, in ESP32Board.cpp: the inline members below run in
// every translation unit that uses them and must all see the same backup.
extern uint32_t _rtc_backup_time;
extern uint32_t _rtc_backup_magic;
#define RTC_BACKUP_MAGIC 0xAA55CC33
#define RTC_TIME_MIN 1772323200 // 1 Mar 2026