diff --git a/esphome/components/espnow/espnow.cpp b/esphome/components/espnow/espnow.cpp index 96e9beb55a..ce782e87c1 100644 --- a/esphome/components/espnow/espnow.cpp +++ b/esphome/components/espnow/espnow.cpp @@ -263,7 +263,7 @@ void ESPNowComponent::on_data_received(const uint8_t *addr, const uint8_t *data, } else { packet->timestamp = millis(); } - show_packet("Receive", packet); + show_packet("Receive", *packet); if (packet->is_valid()) { xQueueSendToBack(global_esp_now->receive_queue_, packet.get(), 10); @@ -274,7 +274,7 @@ void ESPNowComponent::on_data_received(const uint8_t *addr, const uint8_t *data, bool ESPNowComponent::write(const std::shared_ptr packet) { uint8_t *mac = packet->peer_as_bytes(); - show_packet("Write", packet); + show_packet("Write", *packet); if (this->is_failed()) { ESP_LOGE(TAG, "Cannot send espnow packet, espnow failed to setup"); } else if (this->send_queue_full()) { diff --git a/esphome/components/espnow/espnow.h b/esphome/components/espnow/espnow.h index 4b3ab34dda..1ec7c6dba1 100644 --- a/esphome/components/espnow/espnow.h +++ b/esphome/components/espnow/espnow.h @@ -326,27 +326,27 @@ template class DelPeerAction : public Action, public Pare TemplatableValue mac_{}; }; -class ESPNowSentTrigger : public Trigger { +class ESPNowSentTrigger : public Trigger, bool> { public: explicit ESPNowSentTrigger(ESPNowComponent *parent) { parent->get_default_protocol()->add_on_sent_callback( - [this](std::shared_ptr packet, bool status) { this->trigger(packet, status); }); + [this](std::shared_ptr packet, bool status) { this->trigger(std::move(packet), status); }); } }; -class ESPNowReceiveTrigger : public Trigger { +class ESPNowReceiveTrigger : public Trigger> { public: explicit ESPNowReceiveTrigger(ESPNowComponent *parent) { parent->get_default_protocol()->add_on_receive_callback( - [this](std::shared_ptr packet) { this->trigger(packet); }); + [this](std::shared_ptr packet) { this->trigger(std::move(packet)); }); } }; -class ESPNowNewPeerTrigger : public Trigger { +class ESPNowNewPeerTrigger : public Trigger> { public: explicit ESPNowNewPeerTrigger(ESPNowComponent *parent) { parent->get_default_protocol()->add_on_peer_callback( - [this](std::shared_ptr packet) { this->trigger(packet); }); + [this](std::shared_ptr packet) { this->trigger(std::move(packet)); }); } };