From 201927a8252b7c116c346e9ba63566bf58b9c799 Mon Sep 17 00:00:00 2001 From: NP v/d Spek Date: Tue, 8 Oct 2024 12:12:15 +0200 Subject: [PATCH] remove the link to bytebuffer. --- esphome/components/espnow/espnow.h | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/esphome/components/espnow/espnow.h b/esphome/components/espnow/espnow.h index 66375bf576..b51ba07732 100644 --- a/esphome/components/espnow/espnow.h +++ b/esphome/components/espnow/espnow.h @@ -255,12 +255,9 @@ template class SendAction : public Action, public Parente void set_data_template(std::function(Ts...)> func) { this->data_func_ = func; - this->static_ = false; - } - void set_data_static(const std::vector &data) { - this->data_static_ = data; - this->static_ = true; + this->dynamic_ = true; } + void set_data_static(const std::vector &data) { this->data_static_ = data; } void play(Ts... x) override { uint64_t mac = this->mac_.value(x...); @@ -269,7 +266,7 @@ template class SendAction : public Action, public Parente command = this->mac_.value(x...); } - if (!this->static_) { + if (this->dynamic_) { this->data_static_ = this->data_func_(x...); } this->parent_->get_default_protocol()->send(mac, this->data_static_.data(), this->data_static_.size(), command); @@ -278,8 +275,8 @@ template class SendAction : public Action, public Parente protected: TemplatableValue command_{}; TemplatableValue mac_{}; - bool static_{false}; - std::function data_func_{}; + bool dynamic_{false}; + std::function(Ts...)> data_func_{}; std::vector data_static_{}; };