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)
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()
......
......@@ -13,7 +13,7 @@
typedef struct config {
uint8_t host[6];
long time_millis;
long epoch_seconds;
} config;
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