mirror of
https://github.com/esphome/esphome.git
synced 2026-02-25 04:45:29 -07:00
[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:
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user