mirror of
https://github.com/Threnklyn/esphome-dev.git
synced 2026-06-01 18:48:28 +02:00
Add Safe Mode Restart Switch (#2437)
This commit is contained in:
@@ -48,6 +48,10 @@ class OTAComponent : public Component {
|
||||
|
||||
bool should_enter_safe_mode(uint8_t num_attempts, uint32_t enable_time);
|
||||
|
||||
/// Set to true if the next startup will enter safe mode
|
||||
void set_safe_mode_pending(const bool &pending);
|
||||
bool get_safe_mode_pending();
|
||||
|
||||
#ifdef USE_OTA_STATE_CALLBACK
|
||||
void add_on_state_callback(std::function<void(OTAState, float, uint8_t)> &&callback);
|
||||
#endif
|
||||
@@ -89,6 +93,9 @@ class OTAComponent : public Component {
|
||||
uint8_t safe_mode_num_attempts_;
|
||||
ESPPreferenceObject rtc_;
|
||||
|
||||
static const uint32_t ENTER_SAFE_MODE_MAGIC =
|
||||
0x5afe5afe; ///< a magic number to indicate that safe mode should be entered on next boot
|
||||
|
||||
#ifdef USE_OTA_STATE_CALLBACK
|
||||
CallbackManager<void(OTAState, float, uint8_t)> state_callback_{};
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user