ESPHome  2024.10.2
safe_mode_button.cpp
Go to the documentation of this file.
1 #include "safe_mode_button.h"
2 #include "esphome/core/hal.h"
3 #include "esphome/core/log.h"
5 
6 namespace esphome {
7 namespace safe_mode {
8 
9 static const char *const TAG = "safe_mode.button";
10 
12  this->safe_mode_component_ = safe_mode_component;
13 }
14 
16  ESP_LOGI(TAG, "Restarting device in safe mode...");
18 
19  // Let MQTT settle a bit
20  delay(100); // NOLINT
21  App.safe_reboot();
22 }
23 
24 void SafeModeButton::dump_config() { LOG_BUTTON("", "Safe Mode Button", this); }
25 
26 } // namespace safe_mode
27 } // namespace esphome
void set_safe_mode_pending(const bool &pending)
Set to true if the next startup will enter safe mode.
Definition: safe_mode.cpp:47
void set_safe_mode(SafeModeComponent *safe_mode_component)
Application App
Global storage of Application pointer - only one Application can exist.
SafeModeComponent provides a safe way to recover from repeated boot failures.
Definition: safe_mode.h:12
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
SafeModeComponent * safe_mode_component_
void IRAM_ATTR HOT delay(uint32_t ms)
Definition: core.cpp:26