From 2e0424581db3cdbab9d55c8604e24749ca91c08a Mon Sep 17 00:00:00 2001 From: NP v/d Spek Date: Sat, 24 Aug 2024 19:57:26 +0200 Subject: [PATCH] some fixes --- esphome/components/espnow/espnow.cpp | 4 ++-- esphome/components/espnow/espnow.h | 6 +++--- esphome/components/espnow/espnow_packet.h | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/esphome/components/espnow/espnow.cpp b/esphome/components/espnow/espnow.cpp index b8b4a1e044..ddcc4f4d20 100644 --- a/esphome/components/espnow/espnow.cpp +++ b/esphome/components/espnow/espnow.cpp @@ -1,6 +1,6 @@ #include "espnow.h" -#include +#include #include "esp_mac.h" #include "esp_random.h" @@ -31,7 +31,7 @@ static void application_task(void *param) { } #if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 1) -typedef struct { +using struct { uint16_t frame_head; uint16_t duration; uint8_t destination_address[6]; diff --git a/esphome/components/espnow/espnow.h b/esphome/components/espnow/espnow.h index 9d646b7720..c086613e62 100644 --- a/esphome/components/espnow/espnow.h +++ b/esphome/components/espnow/espnow.h @@ -45,15 +45,15 @@ class ESPNowProtocol : public Parented { class ESPNowDefaultProtocol : public ESPNowProtocol { public: - bool on_receive(ESPNowPacket packet) { + void on_receive(ESPNowPacket packet) { this->on_receive_.call(packet); return true; }; - bool on_sent(ESPNowPacket packet, bool status) { + void on_sent(ESPNowPacket packet, bool status) { this->on_sent_.call(packet, status); return true; }; - bool on_new_peer(ESPNowPacket packet) { + void on_new_peer(ESPNowPacket packet) { this->on_new_peer_.call(packet); return true; }; diff --git a/esphome/components/espnow/espnow_packet.h b/esphome/components/espnow/espnow_packet.h index dd6a3ff119..3dcd1a0130 100644 --- a/esphome/components/espnow/espnow_packet.h +++ b/esphome/components/espnow/espnow_packet.h @@ -53,8 +53,8 @@ struct ESPNowPacket { struct { uint8_t header[3] = {0xC1, 0x99, 0x83}; uint32_t app_id = 0xFFFFFF; - uint1_t ref_id = 0x99; - uint8_t crc16 = 0x1234; + uint8_t ref_id = 0x99; + uint16_t crc16 = 0x1234; uint8_t data[MAX_ESPNOW_DATA_SIZE]; uint8_t space = 0; } __attribute__((packed));