mirror of
https://github.com/esphome/esphome.git
synced 2024-11-28 01:34:18 +01:00
Merge branch 'dev' into dev
This commit is contained in:
commit
c54269cadb
1 changed files with 9 additions and 14 deletions
|
@ -1,16 +1,11 @@
|
||||||
#include "sntp_component.h"
|
#include "sntp_component.h"
|
||||||
#include "esphome/core/log.h"
|
#include "esphome/core/log.h"
|
||||||
|
|
||||||
#if defined(USE_ESP32) || defined(USE_LIBRETINY)
|
|
||||||
#include "lwip/apps/sntp.h"
|
|
||||||
#ifdef USE_ESP_IDF
|
#ifdef USE_ESP_IDF
|
||||||
#include "esp_sntp.h"
|
#include "esp_sntp.h"
|
||||||
#endif
|
#elif USE_ESP8266
|
||||||
#endif
|
|
||||||
#ifdef USE_ESP8266
|
|
||||||
#include "sntp.h"
|
#include "sntp.h"
|
||||||
#endif
|
#else
|
||||||
#ifdef USE_RP2040
|
|
||||||
#include "lwip/apps/sntp.h"
|
#include "lwip/apps/sntp.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -27,14 +22,14 @@ static const char *const TAG = "sntp";
|
||||||
void SNTPComponent::setup() {
|
void SNTPComponent::setup() {
|
||||||
#ifndef USE_HOST
|
#ifndef USE_HOST
|
||||||
ESP_LOGCONFIG(TAG, "Setting up SNTP...");
|
ESP_LOGCONFIG(TAG, "Setting up SNTP...");
|
||||||
#if defined(USE_ESP32) || defined(USE_LIBRETINY)
|
#if defined(USE_ESP_IDF)
|
||||||
if (sntp_enabled()) {
|
if (esp_sntp_enabled()) {
|
||||||
sntp_stop();
|
esp_sntp_stop();
|
||||||
}
|
}
|
||||||
sntp_setoperatingmode(SNTP_OPMODE_POLL);
|
esp_sntp_setoperatingmode(ESP_SNTP_OPMODE_POLL);
|
||||||
#endif
|
#else
|
||||||
#ifdef USE_ESP8266
|
|
||||||
sntp_stop();
|
sntp_stop();
|
||||||
|
sntp_setoperatingmode(SNTP_OPMODE_POLL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
sntp_setservername(0, strdup(this->server_1_.c_str()));
|
sntp_setservername(0, strdup(this->server_1_.c_str()));
|
||||||
|
@ -45,7 +40,7 @@ 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());
|
esp_sntp_set_sync_interval(this->get_update_interval());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
sntp_init();
|
sntp_init();
|
||||||
|
|
Loading…
Reference in a new issue