some fixes

This commit is contained in:
NP v/d Spek 2024-08-24 20:31:51 +02:00
parent 57d3d8319b
commit bccb306fff
2 changed files with 5 additions and 14 deletions

View file

@ -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)
using struct { 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

@ -26,7 +26,7 @@ class ESPNowProtocol : public Parented<ESPNowComponent> {
public: public:
ESPNowProtocol(){}; ESPNowProtocol(){};
void setup() override; void setup();
virtual void on_receive(ESPNowPacket packet) { return; }; virtual void on_receive(ESPNowPacket packet) { return; };
virtual void on_sent(ESPNowPacket packet, bool status) { return; }; virtual void on_sent(ESPNowPacket packet, bool status) { return; };
@ -45,18 +45,9 @@ class ESPNowProtocol : public Parented<ESPNowComponent> {
class ESPNowDefaultProtocol : public ESPNowProtocol { class ESPNowDefaultProtocol : public ESPNowProtocol {
public: public:
void on_receive(ESPNowPacket packet) { void on_receive(ESPNowPacket packet) { this->on_receive_.call(packet); };
this->on_receive_.call(packet); void on_sent(ESPNowPacket packet, bool status) { this->on_sent_.call(packet, status); };
return true; void on_new_peer(ESPNowPacket packet) { this->on_new_peer_.call(packet); };
};
void on_sent(ESPNowPacket packet, bool status) {
this->on_sent_.call(packet, status);
return true;
};
void on_new_peer(ESPNowPacket packet) {
this->on_new_peer_.call(packet);
return true;
};
uint32_t get_app_id() override { return ESPNOW_DEFAULT_APP_ID; }; uint32_t get_app_id() override { return ESPNOW_DEFAULT_APP_ID; };