Skip to content
Snippets Groups Projects
Commit 0fcc3b94 authored by Moritz Perschke's avatar Moritz Perschke
Browse files

renamed time_milis to epoch_seconds

parent 0ffa95b1
No related branches found
No related tags found
4 merge requests!39Merge Develop into Main,!19development into master,!17Inital Host, initial Client,!6Espnow
...@@ -39,6 +39,7 @@ void on_data_recv(const uint8_t *mac, const uint8_t *incomingData, int len) ...@@ -39,6 +39,7 @@ void on_data_recv(const uint8_t *mac, const uint8_t *incomingData, int len)
if (!preferences.isKey("host")) { if (!preferences.isKey("host")) {
preferences.putBytes("host", new_config.host, sizeof(new_config.host)); preferences.putBytes("host", new_config.host, sizeof(new_config.host));
ESP_LOGI(TAG, "host MAC address saved to flash"); ESP_LOGI(TAG, "host MAC address saved to flash");
// add host to peers // add host to peers
esp_now_peer_info_t host; esp_now_peer_info_t host;
memset(&host, 0, sizeof(host)); memset(&host, 0, sizeof(host));
...@@ -48,13 +49,12 @@ void on_data_recv(const uint8_t *mac, const uint8_t *incomingData, int len) ...@@ -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){ if(esp_now_add_peer(&host) != ESP_OK){
ESP_LOGE(TAG, "Adding host to peers failed"); ESP_LOGE(TAG, "Adding host to peers failed");
} }
} // host change shouldn't be an issue } // host change shouldn't be an issue
preferences.end(); preferences.end();
// sync time // sync time
Time::getInstance().setTime( Time::getInstance().setTime(
new_config.time_millis); // see https://www.esp32.com/viewtopic.php?t=9965, maybe this needs an offset new_config.epoch_seconds); // 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());
} }
esp_err_t espnow_setup() esp_err_t espnow_setup()
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
typedef struct config { typedef struct config {
uint8_t host[6]; uint8_t host[6];
long time_millis; long epoch_seconds;
} config; } config;
esp_err_t espnow_setup(); esp_err_t espnow_setup();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment