[safe_mode] Extract RTC_KEY constant for shared use (#14121)

Co-authored-by: J. Nick Koston <nick+github@koston.org>
This commit is contained in:
Pawelo
2026-02-20 21:08:31 +01:00
committed by GitHub
parent edfc3e3501
commit 48115eca18
2 changed files with 4 additions and 1 deletions

View File

@@ -104,7 +104,7 @@ bool SafeModeComponent::should_enter_safe_mode(uint8_t num_attempts, uint32_t en
this->safe_mode_enable_time_ = enable_time;
this->safe_mode_boot_is_good_after_ = boot_is_good_after;
this->safe_mode_num_attempts_ = num_attempts;
this->rtc_ = global_preferences->make_preference<uint32_t>(233825507UL, false);
this->rtc_ = global_preferences->make_preference<uint32_t>(RTC_KEY, false);
#if defined(USE_ESP32) && defined(USE_OTA_ROLLBACK)
// Check partition state to detect if bootloader supports rollback

View File

@@ -11,6 +11,9 @@
namespace esphome::safe_mode {
/// RTC key for storing boot loop counter - used by safe_mode and preferences backends
constexpr uint32_t RTC_KEY = 233825507UL;
/// SafeModeComponent provides a safe way to recover from repeated boot failures
class SafeModeComponent : public Component {
public: