From 0fcc3b9439436ba7a01e2b918bb7934cab44b246 Mon Sep 17 00:00:00 2001 From: Moritz Perschke <moritz.perschke@uibk.ac.at> Date: Tue, 18 Oct 2022 12:53:06 +0200 Subject: [PATCH] renamed time_milis to epoch_seconds --- client/client/lib/espnow/src/ESPNow.cpp | 6 +++--- client/client/lib/espnow/src/ESPNow.hpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/client/client/lib/espnow/src/ESPNow.cpp b/client/client/lib/espnow/src/ESPNow.cpp index 200c1b4..a92f79b 100644 --- a/client/client/lib/espnow/src/ESPNow.cpp +++ b/client/client/lib/espnow/src/ESPNow.cpp @@ -39,6 +39,7 @@ void on_data_recv(const uint8_t *mac, const uint8_t *incomingData, int len) if (!preferences.isKey("host")) { preferences.putBytes("host", new_config.host, sizeof(new_config.host)); ESP_LOGI(TAG, "host MAC address saved to flash"); + // add host to peers esp_now_peer_info_t host; memset(&host, 0, sizeof(host)); @@ -48,13 +49,12 @@ void on_data_recv(const uint8_t *mac, const uint8_t *incomingData, int len) if(esp_now_add_peer(&host) != ESP_OK){ ESP_LOGE(TAG, "Adding host to peers failed"); } + } // host change shouldn't be an issue preferences.end(); // sync time Time::getInstance().setTime( - new_config.time_millis); // see https://www.esp32.com/viewtopic.php?t=9965, maybe this needs an offset - Serial.println("received time: " + (String) new_config.time_millis); - Serial.println("new time: " + (String) Time::getInstance().getMillis()); + new_config.epoch_seconds); // see https://www.esp32.com/viewtopic.php?t=9965, maybe this needs an offset } esp_err_t espnow_setup() diff --git a/client/client/lib/espnow/src/ESPNow.hpp b/client/client/lib/espnow/src/ESPNow.hpp index c28cfe2..df22899 100644 --- a/client/client/lib/espnow/src/ESPNow.hpp +++ b/client/client/lib/espnow/src/ESPNow.hpp @@ -13,7 +13,7 @@ typedef struct config { uint8_t host[6]; - long time_millis; + long epoch_seconds; } config; esp_err_t espnow_setup(); -- GitLab