From 9971ed7f8aa5d497ba9ccf119f38456be8598b67 Mon Sep 17 00:00:00 2001 From: lumapu Date: Fri, 22 Mar 2024 22:40:35 +0100 Subject: [PATCH] 0.8.97 * add support for newest generation of inverters with A-F in their serial number * fix NTP and sunrise / sunset * set default coordinates to the mid of Germany #1516 --- src/CHANGES.md | 5 +++++ src/app.cpp | 11 +++++++---- src/config/settings.h | 4 ++-- src/defines.h | 2 +- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/CHANGES.md b/src/CHANGES.md index 1b1bccab5..af1ecd86f 100644 --- a/src/CHANGES.md +++ b/src/CHANGES.md @@ -1,5 +1,10 @@ # Development Changes +## 0.8.97 - 2024-03-22 +* add support for newest generation of inverters with A-F in their serial number +* fix NTP and sunrise / sunset +* set default coordinates to the mid of Germany #1516 + ## 0.8.96 - 2024-03-21 * fix precision of power limit in `/live` #1517 * fix translation of `Werte ausgeben` in `settings` #1507 diff --git a/src/app.cpp b/src/app.cpp index 37b0a37a4..119894f16 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -204,8 +204,13 @@ void app::regularTickers(void) { #endif /*ENABLE_SIMULATOR*/ } +//----------------------------------------------------------------------------- void app::onNtpUpdate(bool gotTime) { mNtpReceived = true; + if ((0 == mSunrise) && (0.0 != mConfig->sun.lat) && (0.0 != mConfig->sun.lon)) { + mCalculatedTimezoneOffset = (int8_t)((mConfig->sun.lon >= 0 ? mConfig->sun.lon + 7.5 : mConfig->sun.lon - 7.5) / 15) * 3600; + tickCalcSunrise(); + } } //----------------------------------------------------------------------------- @@ -236,10 +241,8 @@ void app::updateNtp(void) { } } - if ((0 == mSunrise) && (0.0 != mConfig->sun.lat) && (0.0 != mConfig->sun.lon)) { - mCalculatedTimezoneOffset = (int8_t)((mConfig->sun.lon >= 0 ? mConfig->sun.lon + 7.5 : mConfig->sun.lon - 7.5) / 15) * 3600; - tickCalcSunrise(); - } + if(mNtpReceived) + onNtpUpdate(true); mMqttReconnect = false; } diff --git a/src/config/settings.h b/src/config/settings.h index fe0053a99..e115160be 100644 --- a/src/config/settings.h +++ b/src/config/settings.h @@ -427,8 +427,8 @@ class settings { mCfg.ntp.port = DEF_NTP_PORT; mCfg.ntp.interval = 720; - mCfg.sun.lat = 0.0; - mCfg.sun.lon = 0.0; + mCfg.sun.lat = 51.1; // mid of Germany + mCfg.sun.lon = 10.5; // mid of Germany mCfg.sun.offsetSecMorning = 0; mCfg.sun.offsetSecEvening = 0; diff --git a/src/defines.h b/src/defines.h index 9078730f6..16a1adf91 100644 --- a/src/defines.h +++ b/src/defines.h @@ -13,7 +13,7 @@ //------------------------------------- #define VERSION_MAJOR 0 #define VERSION_MINOR 8 -#define VERSION_PATCH 96 +#define VERSION_PATCH 97 //------------------------------------- typedef struct {