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:
commit
022ca93c8f
2 files changed
+9
-2
No files matched your search
@@ -3,6 +3,10 @@
|
|||||||
#include "ESP32Board.h"
|
#include "ESP32Board.h"
|
||||||
#include <target.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
|
#if defined(ADMIN_PASSWORD) && !defined(DISABLE_WIFI_OTA) // Repeater or Room Server only
|
||||||
#include <WiFi.h>
|
#include <WiFi.h>
|
||||||
#include <AsyncTCP.h>
|
#include <AsyncTCP.h>
|
||||||
|
|||||||
@@ -200,8 +200,11 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static RTC_NOINIT_ATTR uint32_t _rtc_backup_time;
|
// The time ESP32RTCClock restores after a reset, in RTC memory that a reset does
|
||||||
static RTC_NOINIT_ATTR uint32_t _rtc_backup_magic;
|
// 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_BACKUP_MAGIC 0xAA55CC33
|
||||||
#define RTC_TIME_MIN 1772323200 // 1 Mar 2026
|
#define RTC_TIME_MIN 1772323200 // 1 Mar 2026
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user