This commit is contained in:
Anton Sergunov 2024-06-03 11:13:34 +00:00
parent 82fe2086e0
commit 8824324d1f

View file

@ -54,13 +54,12 @@ void SNTPComponent::setup() {
sntp_setservername(2, strdup(this->server_3_.c_str())); sntp_setservername(2, strdup(this->server_3_.c_str()));
} }
#ifdef USE_ESP_IDF #ifdef USE_ESP_IDF
sntp_set_sync_interval(this->get_update_interval());
this->stop_poller();
#endif
ESP_LOGD(TAG, "Set notification callback"); ESP_LOGD(TAG, "Set notification callback");
sntp_set_time_sync_notification_cb(sntp_sync_time_cb); sntp_set_time_sync_notification_cb(sntp_sync_time_cb);
sntp_set_sync_interval(this->get_update_interval());
this->stop_poller();
#endif
sntp_init(); sntp_init();
#endif #endif
} }
@ -80,10 +79,6 @@ void SNTPComponent::update() {
sntp_init(); sntp_init();
} }
#endif #endif
#if defined(USE_ESP_IDF)
this->has_time_ = false;
sntp_restart();
#endif
} }
void SNTPComponent::loop() { void SNTPComponent::loop() {
#if defined(USE_ESP_IDF) #if defined(USE_ESP_IDF)