Browse Source

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
pull/1738/merge
lumapu 6 months ago
parent
commit
d14d783929
  1. 7
      src/CHANGES.md
  2. 2
      src/defines.h
  3. 17
      src/hm/hmInverter.h
  4. 19
      src/platformio.ini
  5. 6
      src/web/RestApi.h
  6. 2
      src/web/html/index.html
  7. 4
      src/web/html/setup.html
  8. 1
      src/web/html/style.css
  9. 10
      src/web/html/system.html
  10. 12
      src/web/lang.json

7
src/CHANGES.md

@ -1,5 +1,12 @@
# Development Changes # 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 # RELEASE 0.8.140 - 2024-08-16
## 0.8.139 - 2024-08-15 ## 0.8.139 - 2024-08-15

2
src/defines.h

@ -13,7 +13,7 @@
//------------------------------------- //-------------------------------------
#define VERSION_MAJOR 0 #define VERSION_MAJOR 0
#define VERSION_MINOR 8 #define VERSION_MINOR 8
#define VERSION_PATCH 140 #define VERSION_PATCH 141
//------------------------------------- //-------------------------------------
typedef struct { typedef struct {
uint8_t ch; uint8_t ch;

17
src/hm/hmInverter.h

@ -116,6 +116,13 @@ const calcFunc_t<T> calcFunctions[] = {
template <class REC_TYP> template <class REC_TYP>
class Inverter { class Inverter {
public: /*types*/
#ifdef(ESP32)
constexpr static uint8_t MaxAlarmNum = 50;
#else
constexpr static uint8_t MaxAlarmNum = 10;
#endif
public: public:
uint8_t ivGen = IV_UNKNOWN; // generation of inverter (HM / MI) uint8_t ivGen = IV_UNKNOWN; // generation of inverter (HM / MI)
uint8_t ivRadioType = INV_RADIO_TYPE_UNKNOWN; // refers to used radio (nRF24 / CMT) uint8_t ivRadioType = INV_RADIO_TYPE_UNKNOWN; // refers to used radio (nRF24 / CMT)
@ -135,7 +142,7 @@ class Inverter {
record_t<REC_TYP> recordConfig; // structure for system config values record_t<REC_TYP> recordConfig; // structure for system config values
record_t<REC_TYP> recordAlarm; // structure for alarm values record_t<REC_TYP> recordAlarm; // structure for alarm values
InverterStatus status = InverterStatus::OFF; // indicates the current inverter status InverterStatus status = InverterStatus::OFF; // indicates the current inverter status
std::array<alarm_t, 10> lastAlarm; // holds last 10 alarms std::array<alarm_t, MaxAlarmNum> lastAlarm; // holds last x alarms
int8_t rssi = 0; // RSSI int8_t rssi = 0; // RSSI
uint16_t alarmCnt = 0; // counts the total number of occurred alarms uint16_t alarmCnt = 0; // counts the total number of occurred alarms
uint16_t alarmLastId = 0; // lastId which was received uint16_t alarmLastId = 0; // lastId which was received
@ -822,9 +829,9 @@ class Inverter {
if(start > end) if(start > end)
end = 0; end = 0;
for(; i < 10; i++) { for(; i < MaxAlarmNum; i++) {
++mAlarmNxtWrPos; ++mAlarmNxtWrPos;
mAlarmNxtWrPos = mAlarmNxtWrPos % 10; mAlarmNxtWrPos = mAlarmNxtWrPos % MaxAlarmNum;
if(lastAlarm[mAlarmNxtWrPos].code == code && lastAlarm[mAlarmNxtWrPos].start == start) { if(lastAlarm[mAlarmNxtWrPos].code == code && lastAlarm[mAlarmNxtWrPos].start == start) {
// replace with same or update end time // 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; alarmCnt = mAlarmNxtWrPos + 1;
lastAlarm[mAlarmNxtWrPos] = alarm_t(code, start, end); lastAlarm[mAlarmNxtWrPos] = alarm_t(code, start, end);
if(++mAlarmNxtWrPos >= 10) // rolling buffer if(++mAlarmNxtWrPos >= MaxAlarmNum) // rolling buffer
mAlarmNxtWrPos = 0; mAlarmNxtWrPos = 0;
} }

19
src/platformio.ini

@ -26,8 +26,6 @@ extra_scripts =
post:../scripts/add_littlefs_binary.py post:../scripts/add_littlefs_binary.py
lib_deps = 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 https://github.com/nRF24/RF24.git#v1.4.8
paulstoffregen/Time @ ^1.6.1 paulstoffregen/Time @ ^1.6.1
https://github.com/bertmelis/espMqttClient#v1.7.0 https://github.com/bertmelis/espMqttClient#v1.7.0
@ -49,6 +47,7 @@ board = esp12e
board_build.f_cpu = 80000000L board_build.f_cpu = 80000000L
lib_deps = lib_deps =
${env.lib_deps} ${env.lib_deps}
https://github.com/esphome/ESPAsyncWebServer @ ^3.2.2
https://github.com/me-no-dev/ESPAsyncUDP https://github.com/me-no-dev/ESPAsyncUDP
build_flags = ${env.build_flags} build_flags = ${env.build_flags}
-DEMC_MIN_FREE_MEMORY=4096 -DEMC_MIN_FREE_MEMORY=4096
@ -153,6 +152,9 @@ monitor_filters =
[env:esp32-wroom32-minimal] [env:esp32-wroom32-minimal]
platform = espressif32@6.7.0 platform = espressif32@6.7.0
board = lolin_d32 board = lolin_d32
lib_deps =
${env.lib_deps}
https://github.com/mathieucarbou/ESPAsyncWebServer @ ^3.1.5
build_flags = ${env.build_flags} build_flags = ${env.build_flags}
-DSPI_HAL -DSPI_HAL
monitor_filters = monitor_filters =
@ -161,6 +163,7 @@ monitor_filters =
[env:esp32-wroom32] [env:esp32-wroom32]
platform = espressif32@6.7.0 platform = espressif32@6.7.0
board = lolin_d32 board = lolin_d32
lib_deps = ${env:esp32-wroom32-minimal.lib_deps}
build_flags = ${env:esp32-wroom32-minimal.build_flags} build_flags = ${env:esp32-wroom32-minimal.build_flags}
-DUSE_HSPI_FOR_EPD -DUSE_HSPI_FOR_EPD
-DENABLE_MQTT -DENABLE_MQTT
@ -190,6 +193,7 @@ monitor_filters =
[env:esp32-wroom32-de] [env:esp32-wroom32-de]
platform = espressif32@6.7.0 platform = espressif32@6.7.0
board = lolin_d32 board = lolin_d32
lib_deps = ${env:esp32-wroom32-minimal.lib_deps}
build_flags = ${env:esp32-wroom32.build_flags} build_flags = ${env:esp32-wroom32.build_flags}
-DLANG_DE -DLANG_DE
monitor_filters = monitor_filters =
@ -198,6 +202,7 @@ monitor_filters =
[env:esp32-wroom32-prometheus] [env:esp32-wroom32-prometheus]
platform = espressif32@6.7.0 platform = espressif32@6.7.0
board = lolin_d32 board = lolin_d32
lib_deps = ${env:esp32-wroom32-minimal.lib_deps}
build_flags = ${env:esp32-wroom32.build_flags} build_flags = ${env:esp32-wroom32.build_flags}
-DENABLE_PROMETHEUS_EP -DENABLE_PROMETHEUS_EP
monitor_filters = monitor_filters =
@ -206,6 +211,7 @@ monitor_filters =
[env:esp32-wroom32-prometheus-de] [env:esp32-wroom32-prometheus-de]
platform = espressif32@6.7.0 platform = espressif32@6.7.0
board = lolin_d32 board = lolin_d32
lib_deps = ${env:esp32-wroom32-minimal.lib_deps}
build_flags = ${env:esp32-wroom32-prometheus.build_flags} build_flags = ${env:esp32-wroom32-prometheus.build_flags}
-DLANG_DE -DLANG_DE
monitor_filters = monitor_filters =
@ -214,6 +220,7 @@ monitor_filters =
[env:esp32-s2-mini] [env:esp32-s2-mini]
platform = espressif32@6.7.0 platform = espressif32@6.7.0
board = lolin_s2_mini board = lolin_s2_mini
lib_deps = ${env:esp32-wroom32-minimal.lib_deps}
build_flags = ${env.build_flags} build_flags = ${env.build_flags}
-DUSE_HSPI_FOR_EPD -DUSE_HSPI_FOR_EPD
-DSPI_HAL -DSPI_HAL
@ -237,6 +244,7 @@ monitor_filters =
[env:esp32-s2-mini-de] [env:esp32-s2-mini-de]
platform = espressif32@6.7.0 platform = espressif32@6.7.0
board = lolin_s2_mini board = lolin_s2_mini
lib_deps = ${env:esp32-wroom32-minimal.lib_deps}
build_flags = ${env:esp32-s2-mini.build_flags} build_flags = ${env:esp32-s2-mini.build_flags}
-DLANG_DE -DLANG_DE
monitor_filters = monitor_filters =
@ -245,6 +253,7 @@ monitor_filters =
[env:esp32-c3-mini] [env:esp32-c3-mini]
platform = espressif32@6.7.0 platform = espressif32@6.7.0
board = lolin_c3_mini board = lolin_c3_mini
lib_deps = ${env:esp32-wroom32-minimal.lib_deps}
build_flags = ${env.build_flags} build_flags = ${env.build_flags}
-DUSE_HSPI_FOR_EPD -DUSE_HSPI_FOR_EPD
-DSPI_HAL -DSPI_HAL
@ -268,6 +277,7 @@ monitor_filters =
[env:esp32-c3-mini-de] [env:esp32-c3-mini-de]
platform = espressif32@6.7.0 platform = espressif32@6.7.0
board = lolin_c3_mini board = lolin_c3_mini
lib_deps = ${env:esp32-wroom32-minimal.lib_deps}
build_flags = ${env:esp32-c3-mini.build_flags} build_flags = ${env:esp32-c3-mini.build_flags}
-DLANG_DE -DLANG_DE
monitor_filters = monitor_filters =
@ -277,6 +287,7 @@ monitor_filters =
platform = espressif32@6.7.0 platform = espressif32@6.7.0
board = esp32-s3-devkitc-1 board = esp32-s3-devkitc-1
upload_protocol = esp-builtin upload_protocol = esp-builtin
lib_deps = ${env:esp32-wroom32-minimal.lib_deps}
build_flags = ${env.build_flags} build_flags = ${env.build_flags}
-DSPI_HAL -DSPI_HAL
-DDEF_NRF_CS_PIN=37 -DDEF_NRF_CS_PIN=37
@ -302,6 +313,7 @@ monitor_filters =
platform = espressif32@6.7.0 platform = espressif32@6.7.0
board = esp32-s3-devkitc-1 board = esp32-s3-devkitc-1
upload_protocol = esp-builtin upload_protocol = esp-builtin
lib_deps = ${env:esp32-wroom32-minimal.lib_deps}
build_flags = ${env:opendtufusion-minimal.build_flags} build_flags = ${env:opendtufusion-minimal.build_flags}
-DETHERNET -DETHERNET
-DENABLE_MQTT -DENABLE_MQTT
@ -320,6 +332,7 @@ monitor_filters =
platform = espressif32@6.7.0 platform = espressif32@6.7.0
board = esp32-s3-devkitc-1 board = esp32-s3-devkitc-1
upload_protocol = esp-builtin upload_protocol = esp-builtin
lib_deps = ${env:esp32-wroom32-minimal.lib_deps}
build_flags = ${env:opendtufusion.build_flags} build_flags = ${env:opendtufusion.build_flags}
-DLANG_DE -DLANG_DE
monitor_filters = monitor_filters =
@ -331,6 +344,7 @@ board = esp32-s3-devkitc-1
board_upload.flash_size = 16MB board_upload.flash_size = 16MB
board_build.partitions = default_16MB.csv board_build.partitions = default_16MB.csv
upload_protocol = esp-builtin upload_protocol = esp-builtin
lib_deps = ${env:esp32-wroom32-minimal.lib_deps}
build_flags = ${env:opendtufusion.build_flags} build_flags = ${env:opendtufusion.build_flags}
monitor_filters = monitor_filters =
esp32_exception_decoder, colorize esp32_exception_decoder, colorize
@ -339,6 +353,7 @@ monitor_filters =
platform = espressif32@6.7.0 platform = espressif32@6.7.0
board = esp32-s3-devkitc-1 board = esp32-s3-devkitc-1
upload_protocol = esp-builtin upload_protocol = esp-builtin
lib_deps = ${env:esp32-wroom32-minimal.lib_deps}
build_flags = ${env:opendtufusion-16MB.build_flags} build_flags = ${env:opendtufusion-16MB.build_flags}
-DLANG_DE -DLANG_DE
monitor_filters = monitor_filters =

6
src/web/RestApi.h

@ -674,15 +674,15 @@ class RestApi {
// find oldest alarm // find oldest alarm
uint8_t offset = 0; uint8_t offset = 0;
uint32_t oldestStart = 0xffffffff; 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)) { if((iv->lastAlarm[i].start != 0) && (iv->lastAlarm[i].start < oldestStart)) {
offset = i; offset = i;
oldestStart = iv->lastAlarm[i].start; oldestStart = iv->lastAlarm[i].start;
} }
} }
for(uint8_t i = 0; i < 10; i++) { for(uint8_t i = 0; i < hmInverter::MaxAlarmNum; i++) {
uint8_t pos = (i + offset) % 10; uint8_t pos = (i + offset) % hmInverter::MaxAlarmNum;
alarm[pos][F("code")] = iv->lastAlarm[pos].code; alarm[pos][F("code")] = iv->lastAlarm[pos].code;
alarm[pos][F("str")] = iv->getAlarmStr(iv->lastAlarm[pos].code); alarm[pos][F("str")] = iv->getAlarmStr(iv->lastAlarm[pos].code);
alarm[pos][F("start")] = iv->lastAlarm[pos].start; alarm[pos][F("start")] = iv->lastAlarm[pos].start;

2
src/web/html/index.html

@ -152,7 +152,7 @@
text = "{#INVERTER} #"; text = "{#INVERTER} #";
p.append( p.append(
svg(icon, 30, 30, "icon " + cl), svg(icon, 30, 30, "icon " + cl),
span(text + i["id"] + ": " + i["name"] + " {#IS} " + avail), span(text + i["id"] + ": " + i["name"] + " " + avail),
br() br()
); );

4
src/web/html/setup.html

@ -736,7 +736,7 @@
lines.push(ml("tr", {}, [ lines.push(ml("tr", {}, [
ml("th", {style: "width: 10%; text-align: center;"}, ""), ml("th", {style: "width: 10%; text-align: center;"}, ""),
ml("th", {}, "Name"), 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_EDIT}"),
ml("th", {style: "width: 10%; text-align: center;"}, "{#INV_DELETE}") ml("th", {style: "width: 10%; text-align: center;"}, "{#INV_DELETE}")
])); ]));
@ -745,7 +745,7 @@
lines.push(ml("tr", {}, [ lines.push(ml("tr", {}, [
ml("td", {}, badge(obj.inverter[i].enabled, (obj.inverter[i].enabled) ? "{#ENABLED}" : "{#DISABLED}")), ml("td", {}, badge(obj.inverter[i].enabled, (obj.inverter[i].enabled) ? "{#ENABLED}" : "{#DISABLED}")),
ml("td", {}, obj.inverter[i].name), 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() {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")) ml("td", {style: "text-align: center; ", onclick: function() {ivDel(obj.inverter[i]);}}, svg(iconDel, 25, 25, "icon icon-fg pointer"))
])); ]));

1
src/web/html/style.css

@ -339,6 +339,7 @@ p {
.fs-sm-8 { font-size: 1rem; } .fs-sm-8 { font-size: 1rem; }
.d-sm-block { display: block !important;} .d-sm-block { display: block !important;}
.d-sm-cell { display: table-cell !important;}
.d-sm-none { display: none !important; } .d-sm-none { display: none !important; }
} }

10
src/web/html/system.html

@ -62,8 +62,8 @@
function irqBadge(state) { function irqBadge(state) {
switch(state) { switch(state) {
case 0: return badge(false, "unknown", "warning"); break; case 0: return badge(false, "unknown", "warning"); break;
case 1: return badge(true, "true"); break; case 1: return badge(true, "{#TRUE}"); break;
default: return badge(false, "false"); break; default: return badge(false, "{#FALSE}"); break;
} }
} }
@ -125,13 +125,13 @@
function parseMqtt(obj) { function parseMqtt(obj) {
if(obj.enabled) { if(obj.enabled) {
lines = [ 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("#TX", obj.tx_cnt),
tr("#RX", obj.rx_cnt) tr("#RX", obj.rx_cnt)
] ]
} else } else
lines = tr("enabled", badge(false, "false")); lines = tr("{#ENABLED}", badge(false, "{#FALSE}"));
document.getElementById("info").append( document.getElementById("info").append(
headline("MqTT"), headline("MqTT"),
@ -161,7 +161,7 @@
function parseIndex(obj) { function parseIndex(obj) {
if(obj.ts_sunrise > 0) { if(obj.ts_sunrise > 0) {
document.getElementById("info").append( document.getElementById("info").append(
headline("Sun"), headline("{#SUN}"),
ml("table", {class: "table"}, ml("table", {class: "table"},
ml("tbody", {}, [ ml("tbody", {}, [
tr("{#SUNRISE}", new Date(obj.ts_sunrise * 1000).toLocaleString('de-DE')), tr("{#SUNRISE}", new Date(obj.ts_sunrise * 1000).toLocaleString('de-DE')),

12
src/web/lang.json

@ -1052,6 +1052,11 @@
"token": "COMMUNICATING", "token": "COMMUNICATING",
"en": "communicating", "en": "communicating",
"de": "kommunizierend" "de": "kommunizierend"
},
{
"token": "SUN",
"en": "Sun",
"de": "Sonne"
} }
] ]
}, },
@ -1240,7 +1245,7 @@
}, },
{ {
"token": "PRODUCING", "token": "PRODUCING",
"en": "producing", "en": "is producing",
"de": "produziert" "de": "produziert"
}, },
{ {
@ -1248,11 +1253,6 @@
"en": "Inverter", "en": "Inverter",
"de": "Wechselrichter" "de": "Wechselrichter"
}, },
{
"token": "IS",
"en": "is",
"de": "ist"
},
{ {
"token": "LAST_SUCCESS", "token": "LAST_SUCCESS",
"en": "last successful transmission", "en": "last successful transmission",

Loading…
Cancel
Save