mirror of
https://github.com/esphome/esphome.git
synced 2025-08-06 18:37:47 +00:00
Merge branch 'defer_const' into integration
This commit is contained in:
commit
303a8ff87a
@ -248,6 +248,9 @@ bool Component::cancel_defer(const std::string &name) { // NOLINT
|
||||
void Component::defer(const std::string &name, std::function<void()> &&f) { // NOLINT
|
||||
App.scheduler.set_timeout(this, name, 0, std::move(f));
|
||||
}
|
||||
void Component::defer(const char *name, std::function<void()> &&f) { // NOLINT
|
||||
App.scheduler.set_timeout(this, name, 0, std::move(f));
|
||||
}
|
||||
void Component::set_timeout(uint32_t timeout, std::function<void()> &&f) { // NOLINT
|
||||
App.scheduler.set_timeout(this, "", timeout, std::move(f));
|
||||
}
|
||||
|
@ -381,6 +381,21 @@ class Component {
|
||||
*/
|
||||
void defer(const std::string &name, std::function<void()> &&f); // NOLINT
|
||||
|
||||
/** Defer a callback to the next loop() call with a const char* name.
|
||||
*
|
||||
* IMPORTANT: The provided name pointer must remain valid for the lifetime of the deferred task.
|
||||
* This means the name should be:
|
||||
* - A string literal (e.g., "update")
|
||||
* - A static const char* variable
|
||||
* - A pointer with lifetime >= the deferred execution
|
||||
*
|
||||
* For dynamic strings, use the std::string overload instead.
|
||||
*
|
||||
* @param name The name of the defer function (must have static lifetime)
|
||||
* @param f The callback
|
||||
*/
|
||||
void defer(const char *name, std::function<void()> &&f); // NOLINT
|
||||
|
||||
/// Defer a callback to the next loop() call.
|
||||
void defer(std::function<void()> &&f); // NOLINT
|
||||
|
||||
|
@ -15,7 +15,7 @@ click==8.1.7
|
||||
esphome-dashboard==20250514.0
|
||||
aioesphomeapi==34.1.0
|
||||
zeroconf==0.147.0
|
||||
puremagic==1.29
|
||||
puremagic==1.30
|
||||
ruamel.yaml==0.18.14 # dashboard_import
|
||||
esphome-glyphsets==0.2.0
|
||||
pillow==10.4.0
|
||||
|
Loading…
x
Reference in New Issue
Block a user