diff --git a/client/client/lib/espnow/src/espnow.cpp b/client/client/lib/espnow/src/espnow.cpp index 25e45c36868b46a6d2d79bb3b3c2b9628e4ea0bd..7ebf2b6bbc81bc6551a3b38c4330fd1117638adc 100644 --- a/client/client/lib/espnow/src/espnow.cpp +++ b/client/client/lib/espnow/src/espnow.cpp @@ -4,8 +4,7 @@ #include "WiFi.h" #include "espnow.hpp" -uint8_t A_MAC[] = {0x58, 0xCF, 0x79, 0x04, 0x37, 0x38}; -bool host_defined = false; +uint8_t BROADCAST_MAC[] = {0x58, 0xCF, 0x79, 0x04, 0x37, 0x38}; esp_now_peer_info_t hostInfo; Preferences preferences; ESP32Time rtc; @@ -47,9 +46,9 @@ esp_err_t espnow_setup(){ Serial.println("Mac used from flash"); } else{ - memcpy(hostInfo.peer_addr, A_MAC, sizeof(hostInfo.peer_addr)); + memcpy(hostInfo.peer_addr, BROADCAST_MAC, sizeof(hostInfo.peer_addr)); } - preferences.end(); + preferences.end(); // check if there is a host saved in flash mem, broadcast otherwise hostInfo.channel = 0; hostInfo.encrypt = 0; @@ -95,7 +94,7 @@ Message :: Message(){ preferences.getBytes("host", recipient, sizeof(uint8_t) * 6); } else{ - memcpy(recipient, A_MAC, sizeof(A_MAC)); + memcpy(recipient, BROADCAST_MAC, sizeof(BROADCAST_MAC)); Serial.println("backup mac used"); } preferences.end(); diff --git a/host/esp32/lib/espnow/src/espnow.cpp b/host/esp32/lib/espnow/src/espnow.cpp index 71f8c9672dbbb58f1685037ec4c77d5400294447..a8730cfb2d148d947704d34df3aaf1ddcc34d88c 100644 --- a/host/esp32/lib/espnow/src/espnow.cpp +++ b/host/esp32/lib/espnow/src/espnow.cpp @@ -17,10 +17,6 @@ void on_data_recv(const uint8_t *mac, const uint8_t *incomingData, int len){ data_struct lastData; memcpy(&lastData, incomingData, sizeof(lastData)); Serial.println("message copied"); - // for(int i=0; i<lastData.amountData; i++){ - // Serial.print((String) lastData.identifiers[i] + ": "); - // Serial.println((String) lastData.values[i]); - // } Serial.println((String) lastData.values[0]); Serial.println((String) "sent time: " + lastData.timestamp); Serial.println((String) "RTC time: " + rtc.getMillis());