make NTP arduino3 ready

This commit is contained in:
MichaelDvP
2023-10-03 10:57:20 +02:00
parent 17d7487423
commit 62eeca944b
4 changed files with 7 additions and 8 deletions

View File

@@ -1,5 +1,4 @@
#include <NTPSettingsService.h>
#include <esp_sntp.h>
#include "../../src/emsesp_stub.hpp"
@@ -50,13 +49,13 @@ void NTPSettingsService::configureNTP() {
emsesp::EMSESP::system_.ntp_connected(false);
if (connected_ && _state.enabled) {
emsesp::EMSESP::logger().info("Starting NTP service");
sntp_set_sync_interval(3600000); // one hour
sntp_set_time_sync_notification_cb(ntp_received);
esp_sntp_set_sync_interval(3600000); // one hour
esp_sntp_set_time_sync_notification_cb(ntp_received);
configTzTime(_state.tzFormat.c_str(), _state.server.c_str());
} else {
setenv("TZ", _state.tzFormat.c_str(), 1);
tzset();
sntp_stop();
esp_sntp_stop();
}
}