[safe_mode] Use StaticCallbackManager for on_safe_mode (#16002)
This commit is contained in:
1 parent
bc33260c61
commit
58f6ad2d0c
3 files changed
+4
-2
No files matched your search
@@ -76,8 +76,9 @@ async def to_code(config):
|
||||
var = cg.new_Pvariable(config[CONF_ID])
|
||||
await cg.register_component(var, config)
|
||||
|
||||
if config.get(CONF_ON_SAFE_MODE):
|
||||
if on_safe_mode := config.get(CONF_ON_SAFE_MODE):
|
||||
cg.add_define("USE_SAFE_MODE_CALLBACK")
|
||||
cg.add_define("ESPHOME_SAFE_MODE_CALLBACK_COUNT", len(on_safe_mode))
|
||||
await automation.build_callback_automations(
|
||||
var, config, _CALLBACK_AUTOMATIONS
|
||||
)
|
||||
|
||||
@@ -57,7 +57,7 @@ class SafeModeComponent final : public Component {
|
||||
// Larger objects at the end
|
||||
ESPPreferenceObject rtc_;
|
||||
#ifdef USE_SAFE_MODE_CALLBACK
|
||||
CallbackManager<void()> safe_mode_callback_{};
|
||||
StaticCallbackManager<ESPHOME_SAFE_MODE_CALLBACK_COUNT, void()> safe_mode_callback_{};
|
||||
#endif
|
||||
|
||||
static const uint32_t ENTER_SAFE_MODE_MAGIC =
|
||||
|
||||
@@ -136,6 +136,7 @@
|
||||
#define USE_PREFERENCES_SYNC_EVERY_LOOP
|
||||
#define USE_QR_CODE
|
||||
#define USE_SAFE_MODE_CALLBACK
|
||||
#define ESPHOME_SAFE_MODE_CALLBACK_COUNT 1
|
||||
#define USE_SELECT
|
||||
#define USE_SENSOR
|
||||
#define USE_SENSOR_FILTER
|
||||
|
||||
Reference in new issue
Block a user