From 76fa30503d4a3a5096a01b42ee6fa5d26173a396 Mon Sep 17 00:00:00 2001 From: lumapu Date: Wed, 10 Jan 2024 23:53:24 +0100 Subject: [PATCH] 0.8.51 * fix translation #1346 * further improve sending active power control command faster #1332 * added history protection mask --- ahoy.code-workspace | 45 -------------------------------- scripts/auto_firmware_version.py | 3 ++- src/CHANGES.md | 5 ++++ src/app.cpp | 2 +- src/app.h | 4 +++ src/appInterface.h | 5 ++-- src/config/settings.h | 8 +++--- src/defines.h | 2 +- src/hm/hmInverter.h | 7 +++-- src/hm/hmSystem.h | 10 ++++--- src/utils/scheduler.h | 2 +- src/web/RestApi.h | 3 ++- src/web/html/index.html | 2 +- src/web/html/setup.html | 6 ++--- src/web/lang.json | 6 ++--- 15 files changed, 41 insertions(+), 69 deletions(-) delete mode 100644 ahoy.code-workspace diff --git a/ahoy.code-workspace b/ahoy.code-workspace deleted file mode 100644 index 20d5909e..00000000 --- a/ahoy.code-workspace +++ /dev/null @@ -1,45 +0,0 @@ -{ - "folders": [ - { - "path": "." - }, - { - "path": "src" - } - ], - "settings": { - "files.associations": { - "algorithm": "cpp", - "array": "cpp", - "chrono": "cpp", - "deque": "cpp", - "format": "cpp", - "forward_list": "cpp", - "functional": "cpp", - "initializer_list": "cpp", - "iterator": "cpp", - "list": "cpp", - "memory": "cpp", - "queue": "cpp", - "random": "cpp", - "regex": "cpp", - "vector": "cpp", - "xhash": "cpp", - "xlocmon": "cpp", - "xlocnum": "cpp", - "xmemory": "cpp", - "xstring": "cpp", - "xtree": "cpp", - "xutility": "cpp", - "*.tcc": "cpp", - "string": "cpp", - "unordered_map": "cpp", - "unordered_set": "cpp", - "string_view": "cpp", - "sstream": "cpp", - "istream": "cpp", - "ostream": "cpp" - }, - "editor.formatOnSave": false - } -} \ No newline at end of file diff --git a/scripts/auto_firmware_version.py b/scripts/auto_firmware_version.py index c4ab270d..75bf7379 100644 --- a/scripts/auto_firmware_version.py +++ b/scripts/auto_firmware_version.py @@ -21,7 +21,8 @@ def get_firmware_specifier_build_flag(): except: build_version = "g0000000" - build_flag = "-D AUTO_GIT_HASH=\\\"" + build_version[1:] + "\\\"" + build_flag = "-D AUTO_GIT_HASH=\\\"" + build_version[1:] + "\\\" " + build_flag += "-DENV_NAME=\\\"" + env["PIOENV"] + "\\\" "; print ("Firmware Revision: " + build_version) return (build_flag) diff --git a/src/CHANGES.md b/src/CHANGES.md index fd8b2ec7..89442499 100644 --- a/src/CHANGES.md +++ b/src/CHANGES.md @@ -1,5 +1,10 @@ # Development Changes +## 0.8.51 - 2024-01-10 +* fix translation #1346 +* further improve sending active power control command faster #1332 +* added history protection mask + ## 0.8.50 - 2024-01-09 * merge PR: added history charts to web #1336 * merge PR: small display changes #1339 diff --git a/src/app.cpp b/src/app.cpp index cae48149..88135099 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -53,7 +53,7 @@ void app::setup() { mCommunication.setup(&mTimestamp, &mConfig->serial.debug, &mConfig->serial.privacyLog, &mConfig->serial.printWholeTrace, &mConfig->inst.gapMs); mCommunication.addPayloadListener(std::bind(&app::payloadEventListener, this, std::placeholders::_1, std::placeholders::_2)); mCommunication.addPowerLimitAckListener([this] (Inverter<> *iv) { mMqtt.setPowerLimitAck(iv); }); - mSys.setup(&mTimestamp, &mConfig->inst); + mSys.setup(&mTimestamp, &mConfig->inst, this); for (uint8_t i = 0; i < MAX_NUM_INVERTERS; i++) { initInverter(i); } diff --git a/src/app.h b/src/app.h index a7a88609..a4e51113 100644 --- a/src/app.h +++ b/src/app.h @@ -307,6 +307,10 @@ class app : public IApp, public ah::Scheduler { #endif /* defined(ETHERNET) */ void updateNtp(void); + void triggerTickSend() { + once(std::bind(&app::tickSend, this), 0, "tSend"); + } + void tickCalcSunrise(void); void tickIVCommunication(void); void tickSun(void); diff --git a/src/appInterface.h b/src/appInterface.h index b812f5fc..5feccd3c 100644 --- a/src/appInterface.h +++ b/src/appInterface.h @@ -1,5 +1,5 @@ //----------------------------------------------------------------------------- -// 2022 Ahoy, https://ahoydtu.de +// 2024 Ahoy, https://ahoydtu.de // Creative Commons - https://creativecommons.org/licenses/by-nc-sa/4.0/deed //----------------------------------------------------------------------------- @@ -7,7 +7,6 @@ #define __IAPP_H__ #include "defines.h" -#include "hm/hmSystem.h" #if defined(ETHERNET) #include "AsyncWebServer_ESP32_W5500.h" #else @@ -47,6 +46,8 @@ class IApp { virtual void getSchedulerInfo(uint8_t *max) = 0; virtual void getSchedulerNames() = 0; + virtual void triggerTickSend() = 0; + virtual bool getRebootRequestState() = 0; virtual bool getSettingsValid() = 0; virtual void setMqttDiscoveryFlag() = 0; diff --git a/src/config/settings.h b/src/config/settings.h index b8d0d1e9..0e690ede 100644 --- a/src/config/settings.h +++ b/src/config/settings.h @@ -39,9 +39,9 @@ #define PROT_MASK_SETUP 0x0008 #define PROT_MASK_UPDATE 0x0010 #define PROT_MASK_SYSTEM 0x0020 -#define PROT_MASK_API 0x0040 -#define PROT_MASK_MQTT 0x0080 -#define PROT_MASK_HISTORY 0x0100 +#define PROT_MASK_HISTORY 0x0040 +#define PROT_MASK_API 0x0080 +#define PROT_MASK_MQTT 0x0100 #define DEF_PROT_INDEX 0x0001 #define DEF_PROT_LIVE 0x0000 @@ -49,9 +49,9 @@ #define DEF_PROT_SETUP 0x0008 #define DEF_PROT_UPDATE 0x0010 #define DEF_PROT_SYSTEM 0x0020 +#define DEF_PROT_HISTORY 0x0000 #define DEF_PROT_API 0x0000 #define DEF_PROT_MQTT 0x0000 -#define DEF_PROT_HISTORY 0x0000 typedef struct { diff --git a/src/defines.h b/src/defines.h index 9d0e97c9..91fee041 100644 --- a/src/defines.h +++ b/src/defines.h @@ -13,7 +13,7 @@ //------------------------------------- #define VERSION_MAJOR 0 #define VERSION_MINOR 8 -#define VERSION_PATCH 50 +#define VERSION_PATCH 51 //------------------------------------- typedef struct { diff --git a/src/hm/hmInverter.h b/src/hm/hmInverter.h index aeb40c19..4b2cc40d 100644 --- a/src/hm/hmInverter.h +++ b/src/hm/hmInverter.h @@ -1,5 +1,5 @@ //----------------------------------------------------------------------------- -// 2024 Ahoy, https://www.mikrocontroller.net/topic/525778 +// 2024 Ahoy, https://ahoydtu.de // Creative Commons - http://creativecommons.org/licenses/by-nc-sa/4.0/deed //----------------------------------------------------------------------------- @@ -14,6 +14,7 @@ #define MAX_GRID_LENGTH 150 #include "hmDefines.h" +#include "../appInterface.h" #include "HeuristicInv.h" #include "../hms/hmsDefines.h" #include @@ -148,8 +149,9 @@ class Inverter { bool commEnabled; // 'pause night communication' sets this field to false uint32_t tsMaxAcPower; // holds the timestamp when the MaxAC power was seen - static uint32_t *timestamp; // system timestamp + static uint32_t *timestamp; // system timestamp static cfgInst_t *generalConfig; // general inverter configuration from setup + static IApp *app; // pointer to app interface public: @@ -286,6 +288,7 @@ class Inverter { if(isConnected) { mDevControlRequest = true; devControlCmd = cmd; + app->triggerTickSend(); } return isConnected; } diff --git a/src/hm/hmSystem.h b/src/hm/hmSystem.h index b86f8d08..6ff741bf 100644 --- a/src/hm/hmSystem.h +++ b/src/hm/hmSystem.h @@ -1,11 +1,12 @@ //----------------------------------------------------------------------------- -// 2023 Ahoy, https://github.com/lumpapu/ahoy -// Creative Commons - http://creativecommons.org/licenses/by-nc-sa/3.0/de/ +// 2024 Ahoy, https://ahoydtu.de +// Creative Commons - http://creativecommons.org/licenses/by-nc-sa/4.0/deed //----------------------------------------------------------------------------- #ifndef __HM_SYSTEM_H__ #define __HM_SYSTEM_H__ +#include "../appInterface.h" #include "hmInverter.h" #include @@ -14,9 +15,10 @@ class HmSystem { public: HmSystem() {} - void setup(uint32_t *timestamp, cfgInst_t *config) { - mInverter[0].timestamp = timestamp; + void setup(uint32_t *timestamp, cfgInst_t *config, IApp *app) { + mInverter[0].timestamp = timestamp; mInverter[0].generalConfig = config; + mInverter[0].app = app; } void addInverter(uint8_t id, std::function *iv)> cb) { diff --git a/src/utils/scheduler.h b/src/utils/scheduler.h index 23af29f8..9a01cda8 100644 --- a/src/utils/scheduler.h +++ b/src/utils/scheduler.h @@ -121,7 +121,7 @@ namespace ah { uint16_t mTsMillis; private: - inline uint8_t addTicker(scdCb c, uint32_t timeout, uint32_t reload, bool isTimestamp, const char *name) { + uint8_t addTicker(scdCb c, uint32_t timeout, uint32_t reload, bool isTimestamp, const char *name) { for (uint8_t i = 0; i < MAX_NUM_TICKER; i++) { if (!mTickerInUse[i]) { mTickerInUse[i] = true; diff --git a/src/web/RestApi.h b/src/web/RestApi.h index 1ed55a93..73216ed5 100644 --- a/src/web/RestApi.h +++ b/src/web/RestApi.h @@ -1,6 +1,6 @@ //----------------------------------------------------------------------------- // 2024 Ahoy, https://ahoydtu.de -// Creative Commons - http://creativecommons.org/licenses/by-nc-sa/3.0/de/ +// Creative Commons - https://creativecommons.org/licenses/by-nc-sa/4.0/deed //----------------------------------------------------------------------------- #ifndef __WEB_API_H__ @@ -255,6 +255,7 @@ class RestApi { obj[F("ts_now")] = mApp->getTimestamp(); obj[F("version")] = String(mApp->getVersion()); obj[F("build")] = String(AUTO_GIT_HASH); + obj[F("env")] = String(ENV_NAME); obj[F("menu_prot")] = mApp->getProtection(request); obj[F("menu_mask")] = (uint16_t)(mConfig->sys.protectionMask ); obj[F("menu_protEn")] = (bool) (strlen(mConfig->sys.adminPwd) > 0); diff --git a/src/web/html/index.html b/src/web/html/index.html index 6ad2c787..99a42089 100644 --- a/src/web/html/index.html +++ b/src/web/html/index.html @@ -26,7 +26,7 @@
  • {#DISCUSS} Discord
  • {#REPORT} {#ISSUES}
  • {#CONTRIBUTE} {#DOCUMENTATION}
  • -
  • Download & Test {#DEV_FIRMWARE}, {#DEV_CHANGELOG}
  • +
  • Download & Test {#DEV_FIRMWARE}, {#DEV_CHANGELOG}
  • {#DON_MAKE} {#DONATION}
  • diff --git a/src/web/html/setup.html b/src/web/html/setup.html index 00b0477c..62c52b3a 100644 --- a/src/web/html/setup.html +++ b/src/web/html/setup.html @@ -254,7 +254,7 @@
    -
    {MQTT_PASSWORD}
    +
    {#MQTT_PASSWORD}
    @@ -630,9 +630,9 @@ if(!obj["pwd_set"]) e.value = ""; var d = document.getElementById("prot_mask"); - var a = ["Index", "{#NAV_LIVE}", "{#NAV_WEBSERIAL}", "{#NAV_SETTINGS}", "Update", "System"]; + var a = ["Index", "{#NAV_LIVE}", "{#NAV_WEBSERIAL}", "{#NAV_SETTINGS}", "Update", "System", "{#NAV_HISTORY}"]; var el = []; - for(var i = 0; i < 6; i++) { + for(var i = 0; i < 7; i++) { var chk = ((obj["prot_mask"] & (1 << i)) == (1 << i)); el.push(mlCb("protMask" + i, a[i], chk)) } diff --git a/src/web/lang.json b/src/web/lang.json index 35e99b43..42c5e98a 100644 --- a/src/web/lang.json +++ b/src/web/lang.json @@ -136,7 +136,7 @@ { "token": "REBOOT_AT_MIDNIGHT", "en": "Reboot Ahoy at midnight", - "de": "um Mitternacht neu starten" + "de": "mitternachts neu starten" }, { "token": "DARK_MODE", @@ -291,7 +291,7 @@ { "token": "INV_RESET_MAX_MIDNIGHT", "en": "Reset 'max' values at midnight", - "de": "Maximalwerte bei Sonnenuntergang zurücksetzen" + "de": "Maximalwerte mitternachts zurücksetzen" }, { "token": "INV_START_WITHOUT_TIME", @@ -1096,7 +1096,7 @@ { "token": "APC", "en": "APC", - "de": "Begr." + "de": "Limit" }, { "token": "ALARMS",