Call sntp_restart if interval changed

This commit is contained in:
Anton Sergunov 2024-06-03 12:45:03 +00:00
parent 15264bce82
commit 39c93ada36

View file

@ -57,7 +57,10 @@ void SNTPComponent::setup() {
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()); if (sntp_get_sync_interval() != this->get_update_interval()) {
sntp_set_sync_interval(this->get_update_interval());
sntp_restart();
}
// Stop pooler but ler the user update by the hands // Stop pooler but ler the user update by the hands
this->stop_poller(); this->stop_poller();