mirror of
https://github.com/timmbogner/Farm-Data-Relay-System
synced 2024-11-08 13:10:29 +00:00
Patch for ESP-NOW API change
Co-Authored-By: Heinz Haeberle <281508+kheinz57@users.noreply.github.com> #209
This commit is contained in:
parent
33fca6e8c3
commit
86cacd6e2a
@ -32,19 +32,20 @@ bool pingFlagEspNow = false;
|
||||
#if defined(ESP8266)
|
||||
void OnDataSent(uint8_t *mac_addr, uint8_t sendStatus)
|
||||
{
|
||||
esp_now_sent_flag = true;
|
||||
esp_now_sent_flag = true;
|
||||
}
|
||||
void OnDataRecv(uint8_t *mac, uint8_t *incomingData, uint8_t len)
|
||||
{
|
||||
memcpy(&incMAC, mac, sizeof(incMAC));
|
||||
#elif defined(ESP32)
|
||||
void OnDataSent(const uint8_t *mac_addr, esp_now_send_status_t status)
|
||||
{
|
||||
esp_now_sent_flag = true;
|
||||
esp_now_sent_flag = true;
|
||||
}
|
||||
void OnDataRecv(const uint8_t *mac, const uint8_t *incomingData, int len)
|
||||
void OnDataRecv(const esp_now_recv_info *pkt_info, const uint8_t *incomingData, int len)
|
||||
{
|
||||
#endif
|
||||
memcpy(&incMAC, mac, sizeof(incMAC));
|
||||
memcpy(&incMAC, pkt_info->src_addr, sizeof(incMAC));
|
||||
#endif
|
||||
if (len < sizeof(DataReading))
|
||||
{
|
||||
DBG1("Incoming ESP-NOW System Packet from 0x" + String(incMAC[5], HEX));
|
||||
|
@ -68,6 +68,7 @@ void OnDataSent(uint8_t *mac_addr, uint8_t sendStatus)
|
||||
}
|
||||
void OnDataRecv(uint8_t *mac, uint8_t *incomingData, uint8_t len)
|
||||
{
|
||||
memcpy(&incMAC, mac, sizeof(incMAC));
|
||||
#elif defined(ESP32)
|
||||
void OnDataSent(const uint8_t *mac_addr, esp_now_send_status_t status)
|
||||
{
|
||||
@ -80,10 +81,10 @@ void OnDataSent(const uint8_t *mac_addr, esp_now_send_status_t status)
|
||||
esp_now_ack_flag = CRC_BAD;
|
||||
}
|
||||
}
|
||||
void OnDataRecv(const uint8_t *mac, const uint8_t *incomingData, int len)
|
||||
void OnDataRecv(const esp_now_recv_info *pkt_info, const uint8_t *incomingData, int len)
|
||||
{
|
||||
memcpy(&incMAC, pkt_info->src_addr, sizeof(incMAC));
|
||||
#endif
|
||||
memcpy(&incMAC, mac, sizeof(incMAC));
|
||||
if (len == sizeof(SystemPacket))
|
||||
{
|
||||
SystemPacket command;
|
||||
|
Loading…
Reference in New Issue
Block a user