From 6f3b8fb8e13ab3443007bcc9aa5517c54356f47d Mon Sep 17 00:00:00 2001 From: Thomas Basler Date: Sun, 31 Mar 2024 12:27:27 +0200 Subject: [PATCH] Fix: Change default NTP server Fixes #1877 --- include/Configuration.h | 2 +- include/defaults.h | 3 ++- src/Configuration.cpp | 6 ++++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/include/Configuration.h b/include/Configuration.h index 8ae3826a3..bb0e478f2 100644 --- a/include/Configuration.h +++ b/include/Configuration.h @@ -5,7 +5,7 @@ #include #define CONFIG_FILENAME "/config.json" -#define CONFIG_VERSION 0x00011b00 // 0.1.27 // make sure to clean all after change +#define CONFIG_VERSION 0x00011c00 // 0.1.28 // make sure to clean all after change #define WIFI_MAX_SSID_STRLEN 32 #define WIFI_MAX_PASSWORD_STRLEN 64 diff --git a/include/defaults.h b/include/defaults.h index ac871fc99..fd41a3d0b 100644 --- a/include/defaults.h +++ b/include/defaults.h @@ -22,7 +22,8 @@ #define MDNS_ENABLED false -#define NTP_SERVER "pool.ntp.org" +#define NTP_SERVER_OLD "pool.ntp.org" +#define NTP_SERVER "opendtu.pool.ntp.org" #define NTP_TIMEZONE "CET-1CEST,M3.5.0,M10.5.0/3" #define NTP_TIMEZONEDESCR "Europe/Berlin" #define NTP_LONGITUDE 10.4515f diff --git a/src/Configuration.cpp b/src/Configuration.cpp index de4efa34b..3b189187c 100644 --- a/src/Configuration.cpp +++ b/src/Configuration.cpp @@ -372,6 +372,12 @@ void ConfigurationClass::migrate() config.Dtu.Cmt.Frequency *= 1000; } + if (config.Cfg.Version < 0x00011c00) { + if (!strcmp(config.Ntp.Server, NTP_SERVER_OLD)) { + strlcpy(config.Ntp.Server, NTP_SERVER, sizeof(config.Ntp.Server)); + } + } + f.close(); config.Cfg.Version = CONFIG_VERSION;