mirror of
https://github.com/esphome/esphome.git
synced 2026-02-25 21:43:14 -07:00
[core] Optimize DelayAction for no-argument case using if constexpr
This commit is contained in:
@@ -192,12 +192,7 @@ template<typename... Ts> class DelayAction : public Action<Ts...>, public Compon
|
||||
if constexpr (sizeof...(Ts) == 0) {
|
||||
App.scheduler.set_timer_common_(
|
||||
this, Scheduler::SchedulerItem::TIMEOUT,
|
||||
/* is_static_string= */ true, "delay", this->delay_.value(),
|
||||
[this]() {
|
||||
if (this->num_running_ > 0) {
|
||||
this->play_next_();
|
||||
}
|
||||
},
|
||||
/* is_static_string= */ true, "delay", this->delay_.value(), [this]() { this->play_next_(); },
|
||||
/* is_retry= */ false, /* skip_cancel= */ this->num_running_ > 1);
|
||||
} else {
|
||||
// For delays with arguments, use std::bind to preserve argument values
|
||||
|
||||
Reference in New Issue
Block a user