From ab3197788629874d650d16feeefe2f0f9cc66b92 Mon Sep 17 00:00:00 2001 From: NP v/d Spek Date: Thu, 19 Sep 2024 18:18:30 +0200 Subject: [PATCH] fix log messages --- esphome/components/espnow/espnow.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/esphome/components/espnow/espnow.cpp b/esphome/components/espnow/espnow.cpp index 4cd6f60951..93a153f8ce 100644 --- a/esphome/components/espnow/espnow.cpp +++ b/esphome/components/espnow/espnow.cpp @@ -275,18 +275,20 @@ void ESPNowComponent::on_data_received(const esp_now_recv_info_t *recv_info, con void ESPNowComponent::on_data_received(const uint8_t *addr, const uint8_t *data, int size) #endif { - ESPNowPacket packet((uint64_t) *addr, data, size); + bool broadcast = false; wifi_pkt_rx_ctrl_t *rx_ctrl = nullptr; #if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 1) uint8_t *addr = recv_info->src_addr; - packet.broadcast(*recv_info->des_addr == ESPNOW_BROADCAST_ADDR); + broadcast = ((uint64_t) *recv_info->des_addr & ESPNOW_BROADCAST_ADDR) == ESPNOW_BROADCAST_ADDR; rx_ctrl = recv_info->rx_ctrl; #else wifi_promiscuous_pkt_t *promiscuous_pkt = (wifi_promiscuous_pkt_t *) (data - sizeof(wifi_pkt_rx_ctrl_t) - sizeof(espnow_frame_format_t)); rx_ctrl = &promiscuous_pkt->rx_ctrl; #endif + ESPNowPacket packet((uint64_t) *addr, data, size); + packet.broadcast(broadcast); packet.rssi(rx_ctrl->rssi); packet.timestamp(rx_ctrl->timestamp); ESP_LOGVV(TAG, "Read: %s |H:%02x%02x%02x A:%02x%02x%02x %02x T:%02x C:%02x%02x S:%02d", packet.content_bytes(),