mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-11-03 04:22:25 +00:00
fix(esp32): define the RTC backup of ESP32RTCClock once
ESP32Board.h defined _rtc_backup_time and _rtc_backup_magic as static in the header, so every translation unit that includes it has its own copy, and the inline members of ESP32RTCClock read and write the copy of the unit they are compiled in. Today one unit per image uses them; a second one could restore a copy that setCurrentTime() never wrote. The header now declares them, and ESP32Board.cpp defines them once.
This commit is contained in:
2 files changed
+9
-2
No files matched your search
@@ -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>
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in new issue
Block a user