libretiny

This commit is contained in:
Mit4el
2024-09-20 12:45:17 +03:00
parent b32abb5a28
commit 596eb9cad4
78 changed files with 8577 additions and 63 deletions

View File

@@ -1,9 +1,23 @@
#include "NTP.h"
#if defined(LIBRETINY)
#include "lwip/apps/sntp.h"
#endif
#include "Global.h"
#include "utils/SerialPrint.h"
void ntpInit() {
#if defined(USE_LIBRETINY)
if (sntp_enabled()) {
sntp_stop();
}
sntp_setoperatingmode(SNTP_OPMODE_POLL);
sntp_setservername(0, jsonReadStr(settingsFlashJson, F("ntp")).c_str());
sntp_setservername(1, "pool.ntp.org");
sntp_setservername(2, "ru.pool.ntp.org");
sntp_init();
#endif
synchTime();
ts.add(
@@ -44,7 +58,15 @@ void ntpInit() {
}
void synchTime() {
#if defined LIBRETINY
// force resync
if (sntp_enabled()) {
sntp_stop();
sntp_init();
}
#else
configTime(0, 0, "pool.ntp.org", "ru.pool.ntp.org", jsonReadStr(settingsFlashJson, F("ntp")).c_str());
#endif
}
//событие смены даты