some fixes

This commit is contained in:
NP v/d Spek 2024-08-24 19:57:26 +02:00
parent a91bc8c790
commit 2e0424581d
3 changed files with 7 additions and 7 deletions

View file

@ -1,6 +1,6 @@
#include "espnow.h" #include "espnow.h"
#include <string.h> #include <cstring>
#include "esp_mac.h" #include "esp_mac.h"
#include "esp_random.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) #if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 1)
typedef struct { using struct {
uint16_t frame_head; uint16_t frame_head;
uint16_t duration; uint16_t duration;
uint8_t destination_address[6]; uint8_t destination_address[6];

View file

@ -45,15 +45,15 @@ class ESPNowProtocol : public Parented<ESPNowComponent> {
class ESPNowDefaultProtocol : public ESPNowProtocol { class ESPNowDefaultProtocol : public ESPNowProtocol {
public: public:
bool on_receive(ESPNowPacket packet) { void on_receive(ESPNowPacket packet) {
this->on_receive_.call(packet); this->on_receive_.call(packet);
return true; return true;
}; };
bool on_sent(ESPNowPacket packet, bool status) { void on_sent(ESPNowPacket packet, bool status) {
this->on_sent_.call(packet, status); this->on_sent_.call(packet, status);
return true; return true;
}; };
bool on_new_peer(ESPNowPacket packet) { void on_new_peer(ESPNowPacket packet) {
this->on_new_peer_.call(packet); this->on_new_peer_.call(packet);
return true; return true;
}; };

View file

@ -53,8 +53,8 @@ struct ESPNowPacket {
struct { struct {
uint8_t header[3] = {0xC1, 0x99, 0x83}; uint8_t header[3] = {0xC1, 0x99, 0x83};
uint32_t app_id = 0xFFFFFF; uint32_t app_id = 0xFFFFFF;
uint1_t ref_id = 0x99; uint8_t ref_id = 0x99;
uint8_t crc16 = 0x1234; uint16_t crc16 = 0x1234;
uint8_t data[MAX_ESPNOW_DATA_SIZE]; uint8_t data[MAX_ESPNOW_DATA_SIZE];
uint8_t space = 0; uint8_t space = 0;
} __attribute__((packed)); } __attribute__((packed));