From d14d78392903fb8aa1c6ffacb13fd2f5c8dddbf1 Mon Sep 17 00:00:00 2001 From: lumapu Date: Sat, 17 Aug 2024 00:04:02 +0200 Subject: [PATCH] 0.8.141 * switch AsyncWebserver to https://github.com/mathieucarbou/ESPAsyncWebServer * fix missing translations to German #1717 * increased maximum number of alarms to 50 for ESP32 #1470 * fix German translation #1688 * fix display of delete and edit buttons in `/setup` #1372 --- src/CHANGES.md | 7 +++++++ src/defines.h | 2 +- src/hm/hmInverter.h | 17 ++++++++++++----- src/platformio.ini | 19 +++++++++++++++++-- src/web/RestApi.h | 6 +++--- src/web/html/index.html | 2 +- src/web/html/setup.html | 4 ++-- src/web/html/style.css | 1 + src/web/html/system.html | 10 +++++----- src/web/lang.json | 12 ++++++------ 10 files changed, 55 insertions(+), 25 deletions(-) diff --git a/src/CHANGES.md b/src/CHANGES.md index a48295d1..0f1db603 100644 --- a/src/CHANGES.md +++ b/src/CHANGES.md @@ -1,5 +1,12 @@ # Development Changes +## 0.8.141 - 2024-08-16 +* switch AsyncWebserver to https://github.com/mathieucarbou/ESPAsyncWebServer +* fix missing translations to German #1717 +* increased maximum number of alarms to 50 for ESP32 #1470 +* fix German translation #1688 +* fix display of delete and edit buttons in `/setup` #1372 + # RELEASE 0.8.140 - 2024-08-16 ## 0.8.139 - 2024-08-15 diff --git a/src/defines.h b/src/defines.h index 94674315..341ed04f 100644 --- a/src/defines.h +++ b/src/defines.h @@ -13,7 +13,7 @@ //------------------------------------- #define VERSION_MAJOR 0 #define VERSION_MINOR 8 -#define VERSION_PATCH 140 +#define VERSION_PATCH 141 //------------------------------------- typedef struct { uint8_t ch; diff --git a/src/hm/hmInverter.h b/src/hm/hmInverter.h index 026bf6d8..ecf7bbfb 100644 --- a/src/hm/hmInverter.h +++ b/src/hm/hmInverter.h @@ -116,6 +116,13 @@ const calcFunc_t calcFunctions[] = { template class Inverter { + public: /*types*/ + #ifdef(ESP32) + constexpr static uint8_t MaxAlarmNum = 50; + #else + constexpr static uint8_t MaxAlarmNum = 10; + #endif + public: uint8_t ivGen = IV_UNKNOWN; // generation of inverter (HM / MI) uint8_t ivRadioType = INV_RADIO_TYPE_UNKNOWN; // refers to used radio (nRF24 / CMT) @@ -135,7 +142,7 @@ class Inverter { record_t recordConfig; // structure for system config values record_t recordAlarm; // structure for alarm values InverterStatus status = InverterStatus::OFF; // indicates the current inverter status - std::array lastAlarm; // holds last 10 alarms + std::array lastAlarm; // holds last x alarms int8_t rssi = 0; // RSSI uint16_t alarmCnt = 0; // counts the total number of occurred alarms uint16_t alarmLastId = 0; // lastId which was received @@ -822,9 +829,9 @@ class Inverter { if(start > end) end = 0; - for(; i < 10; i++) { + for(; i < MaxAlarmNum; i++) { ++mAlarmNxtWrPos; - mAlarmNxtWrPos = mAlarmNxtWrPos % 10; + mAlarmNxtWrPos = mAlarmNxtWrPos % MaxAlarmNum; if(lastAlarm[mAlarmNxtWrPos].code == code && lastAlarm[mAlarmNxtWrPos].start == start) { // replace with same or update end time @@ -834,11 +841,11 @@ class Inverter { } } - if(alarmCnt < 10 && alarmCnt <= mAlarmNxtWrPos) + if(alarmCnt < MaxAlarmNum && alarmCnt <= mAlarmNxtWrPos) alarmCnt = mAlarmNxtWrPos + 1; lastAlarm[mAlarmNxtWrPos] = alarm_t(code, start, end); - if(++mAlarmNxtWrPos >= 10) // rolling buffer + if(++mAlarmNxtWrPos >= MaxAlarmNum) // rolling buffer mAlarmNxtWrPos = 0; } diff --git a/src/platformio.ini b/src/platformio.ini index 860699e5..17031213 100644 --- a/src/platformio.ini +++ b/src/platformio.ini @@ -26,8 +26,6 @@ extra_scripts = post:../scripts/add_littlefs_binary.py lib_deps = - #https://github.com/esphome/ESPAsyncWebServer @ ^3.2.2 - https://github.com/mathieucarbou/ESPAsyncWebServer @ ^3.1.3 https://github.com/nRF24/RF24.git#v1.4.8 paulstoffregen/Time @ ^1.6.1 https://github.com/bertmelis/espMqttClient#v1.7.0 @@ -49,6 +47,7 @@ board = esp12e board_build.f_cpu = 80000000L lib_deps = ${env.lib_deps} + https://github.com/esphome/ESPAsyncWebServer @ ^3.2.2 https://github.com/me-no-dev/ESPAsyncUDP build_flags = ${env.build_flags} -DEMC_MIN_FREE_MEMORY=4096 @@ -153,6 +152,9 @@ monitor_filters = [env:esp32-wroom32-minimal] platform = espressif32@6.7.0 board = lolin_d32 +lib_deps = + ${env.lib_deps} + https://github.com/mathieucarbou/ESPAsyncWebServer @ ^3.1.5 build_flags = ${env.build_flags} -DSPI_HAL monitor_filters = @@ -161,6 +163,7 @@ monitor_filters = [env:esp32-wroom32] platform = espressif32@6.7.0 board = lolin_d32 +lib_deps = ${env:esp32-wroom32-minimal.lib_deps} build_flags = ${env:esp32-wroom32-minimal.build_flags} -DUSE_HSPI_FOR_EPD -DENABLE_MQTT @@ -190,6 +193,7 @@ monitor_filters = [env:esp32-wroom32-de] platform = espressif32@6.7.0 board = lolin_d32 +lib_deps = ${env:esp32-wroom32-minimal.lib_deps} build_flags = ${env:esp32-wroom32.build_flags} -DLANG_DE monitor_filters = @@ -198,6 +202,7 @@ monitor_filters = [env:esp32-wroom32-prometheus] platform = espressif32@6.7.0 board = lolin_d32 +lib_deps = ${env:esp32-wroom32-minimal.lib_deps} build_flags = ${env:esp32-wroom32.build_flags} -DENABLE_PROMETHEUS_EP monitor_filters = @@ -206,6 +211,7 @@ monitor_filters = [env:esp32-wroom32-prometheus-de] platform = espressif32@6.7.0 board = lolin_d32 +lib_deps = ${env:esp32-wroom32-minimal.lib_deps} build_flags = ${env:esp32-wroom32-prometheus.build_flags} -DLANG_DE monitor_filters = @@ -214,6 +220,7 @@ monitor_filters = [env:esp32-s2-mini] platform = espressif32@6.7.0 board = lolin_s2_mini +lib_deps = ${env:esp32-wroom32-minimal.lib_deps} build_flags = ${env.build_flags} -DUSE_HSPI_FOR_EPD -DSPI_HAL @@ -237,6 +244,7 @@ monitor_filters = [env:esp32-s2-mini-de] platform = espressif32@6.7.0 board = lolin_s2_mini +lib_deps = ${env:esp32-wroom32-minimal.lib_deps} build_flags = ${env:esp32-s2-mini.build_flags} -DLANG_DE monitor_filters = @@ -245,6 +253,7 @@ monitor_filters = [env:esp32-c3-mini] platform = espressif32@6.7.0 board = lolin_c3_mini +lib_deps = ${env:esp32-wroom32-minimal.lib_deps} build_flags = ${env.build_flags} -DUSE_HSPI_FOR_EPD -DSPI_HAL @@ -268,6 +277,7 @@ monitor_filters = [env:esp32-c3-mini-de] platform = espressif32@6.7.0 board = lolin_c3_mini +lib_deps = ${env:esp32-wroom32-minimal.lib_deps} build_flags = ${env:esp32-c3-mini.build_flags} -DLANG_DE monitor_filters = @@ -277,6 +287,7 @@ monitor_filters = platform = espressif32@6.7.0 board = esp32-s3-devkitc-1 upload_protocol = esp-builtin +lib_deps = ${env:esp32-wroom32-minimal.lib_deps} build_flags = ${env.build_flags} -DSPI_HAL -DDEF_NRF_CS_PIN=37 @@ -302,6 +313,7 @@ monitor_filters = platform = espressif32@6.7.0 board = esp32-s3-devkitc-1 upload_protocol = esp-builtin +lib_deps = ${env:esp32-wroom32-minimal.lib_deps} build_flags = ${env:opendtufusion-minimal.build_flags} -DETHERNET -DENABLE_MQTT @@ -320,6 +332,7 @@ monitor_filters = platform = espressif32@6.7.0 board = esp32-s3-devkitc-1 upload_protocol = esp-builtin +lib_deps = ${env:esp32-wroom32-minimal.lib_deps} build_flags = ${env:opendtufusion.build_flags} -DLANG_DE monitor_filters = @@ -331,6 +344,7 @@ board = esp32-s3-devkitc-1 board_upload.flash_size = 16MB board_build.partitions = default_16MB.csv upload_protocol = esp-builtin +lib_deps = ${env:esp32-wroom32-minimal.lib_deps} build_flags = ${env:opendtufusion.build_flags} monitor_filters = esp32_exception_decoder, colorize @@ -339,6 +353,7 @@ monitor_filters = platform = espressif32@6.7.0 board = esp32-s3-devkitc-1 upload_protocol = esp-builtin +lib_deps = ${env:esp32-wroom32-minimal.lib_deps} build_flags = ${env:opendtufusion-16MB.build_flags} -DLANG_DE monitor_filters = diff --git a/src/web/RestApi.h b/src/web/RestApi.h index eac91cb9..b378b1da 100644 --- a/src/web/RestApi.h +++ b/src/web/RestApi.h @@ -674,15 +674,15 @@ class RestApi { // find oldest alarm uint8_t offset = 0; uint32_t oldestStart = 0xffffffff; - for(uint8_t i = 0; i < 10; i++) { + for(uint8_t i = 0; i < hmInverter::MaxAlarmNum; i++) { if((iv->lastAlarm[i].start != 0) && (iv->lastAlarm[i].start < oldestStart)) { offset = i; oldestStart = iv->lastAlarm[i].start; } } - for(uint8_t i = 0; i < 10; i++) { - uint8_t pos = (i + offset) % 10; + for(uint8_t i = 0; i < hmInverter::MaxAlarmNum; i++) { + uint8_t pos = (i + offset) % hmInverter::MaxAlarmNum; alarm[pos][F("code")] = iv->lastAlarm[pos].code; alarm[pos][F("str")] = iv->getAlarmStr(iv->lastAlarm[pos].code); alarm[pos][F("start")] = iv->lastAlarm[pos].start; diff --git a/src/web/html/index.html b/src/web/html/index.html index ee78ac8e..33887e86 100644 --- a/src/web/html/index.html +++ b/src/web/html/index.html @@ -152,7 +152,7 @@

{#SUPPORT}:

text = "{#INVERTER} #"; p.append( svg(icon, 30, 30, "icon " + cl), - span(text + i["id"] + ": " + i["name"] + " {#IS} " + avail), + span(text + i["id"] + ": " + i["name"] + " " + avail), br() ); diff --git a/src/web/html/setup.html b/src/web/html/setup.html index 2b59146c..4d99331e 100644 --- a/src/web/html/setup.html +++ b/src/web/html/setup.html @@ -736,7 +736,7 @@ lines.push(ml("tr", {}, [ ml("th", {style: "width: 10%; text-align: center;"}, ""), ml("th", {}, "Name"), - ml("th", {}, "Serial"), + ml("th", {class: "d-none d-sm-cell"}, "Serial"), ml("th", {style: "width: 10%; text-align: center;"}, "{#INV_EDIT}"), ml("th", {style: "width: 10%; text-align: center;"}, "{#INV_DELETE}") ])); @@ -745,7 +745,7 @@ lines.push(ml("tr", {}, [ ml("td", {}, badge(obj.inverter[i].enabled, (obj.inverter[i].enabled) ? "{#ENABLED}" : "{#DISABLED}")), ml("td", {}, obj.inverter[i].name), - ml("td", {}, String(obj.inverter[i].serial)), + ml("td", {class: "d-none d-sm-cell"}, String(obj.inverter[i].serial)), ml("td", {style: "text-align: center;", onclick: function() {ivModal(obj.inverter[i]);}}, svg(iconGear, 25, 25, "icon icon-fg pointer")), ml("td", {style: "text-align: center; ", onclick: function() {ivDel(obj.inverter[i]);}}, svg(iconDel, 25, 25, "icon icon-fg pointer")) ])); diff --git a/src/web/html/style.css b/src/web/html/style.css index 6f05ea77..05c58168 100644 --- a/src/web/html/style.css +++ b/src/web/html/style.css @@ -339,6 +339,7 @@ p { .fs-sm-8 { font-size: 1rem; } .d-sm-block { display: block !important;} + .d-sm-cell { display: table-cell !important;} .d-sm-none { display: none !important; } } diff --git a/src/web/html/system.html b/src/web/html/system.html index 477b3a7e..c7e74ef3 100644 --- a/src/web/html/system.html +++ b/src/web/html/system.html @@ -62,8 +62,8 @@ function irqBadge(state) { switch(state) { case 0: return badge(false, "unknown", "warning"); break; - case 1: return badge(true, "true"); break; - default: return badge(false, "false"); break; + case 1: return badge(true, "{#TRUE}"); break; + default: return badge(false, "{#FALSE}"); break; } } @@ -125,13 +125,13 @@ function parseMqtt(obj) { if(obj.enabled) { lines = [ - tr("{#CONNECTED}", badge(obj.connected, ((obj.connected) ? "true" : "false"))), + tr("{#CONNECTED}", badge(obj.connected, ((obj.connected) ? "{#TRUE}" : "{#FALSE}"))), tr("#TX", obj.tx_cnt), tr("#RX", obj.rx_cnt) ] } else - lines = tr("enabled", badge(false, "false")); + lines = tr("{#ENABLED}", badge(false, "{#FALSE}")); document.getElementById("info").append( headline("MqTT"), @@ -161,7 +161,7 @@ function parseIndex(obj) { if(obj.ts_sunrise > 0) { document.getElementById("info").append( - headline("Sun"), + headline("{#SUN}"), ml("table", {class: "table"}, ml("tbody", {}, [ tr("{#SUNRISE}", new Date(obj.ts_sunrise * 1000).toLocaleString('de-DE')), diff --git a/src/web/lang.json b/src/web/lang.json index 179c3e4e..ee8835c2 100644 --- a/src/web/lang.json +++ b/src/web/lang.json @@ -1052,6 +1052,11 @@ "token": "COMMUNICATING", "en": "communicating", "de": "kommunizierend" + }, + { + "token": "SUN", + "en": "Sun", + "de": "Sonne" } ] }, @@ -1240,7 +1245,7 @@ }, { "token": "PRODUCING", - "en": "producing", + "en": "is producing", "de": "produziert" }, { @@ -1248,11 +1253,6 @@ "en": "Inverter", "de": "Wechselrichter" }, - { - "token": "IS", - "en": "is", - "de": "ist" - }, { "token": "LAST_SUCCESS", "en": "last successful transmission",