Skip to content

Commit

Permalink
0.8.141
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
lumapu committed Aug 16, 2024
1 parent 16869b4 commit d14d783
Show file tree
Hide file tree
Showing 10 changed files with 55 additions and 25 deletions.
7 changes: 7 additions & 0 deletions src/CHANGES.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
17 changes: 12 additions & 5 deletions src/hm/hmInverter.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,13 @@ const calcFunc_t<T> calcFunctions[] = {

template <class REC_TYP>
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)
Expand All @@ -135,7 +142,7 @@ class Inverter {
record_t<REC_TYP> recordConfig; // structure for system config values
record_t<REC_TYP> recordAlarm; // structure for alarm values
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
uint16_t alarmCnt = 0; // counts the total number of occurred alarms
uint16_t alarmLastId = 0; // lastId which was received
Expand Down Expand Up @@ -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
Expand All @@ -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;
}

Expand Down
19 changes: 17 additions & 2 deletions src/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -153,6 +152,9 @@ monitor_filters =
[env:esp32-wroom32-minimal]
platform = [email protected]
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 =
Expand All @@ -161,6 +163,7 @@ monitor_filters =
[env:esp32-wroom32]
platform = [email protected]
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
Expand Down Expand Up @@ -190,6 +193,7 @@ monitor_filters =
[env:esp32-wroom32-de]
platform = [email protected]
board = lolin_d32
lib_deps = ${env:esp32-wroom32-minimal.lib_deps}
build_flags = ${env:esp32-wroom32.build_flags}
-DLANG_DE
monitor_filters =
Expand All @@ -198,6 +202,7 @@ monitor_filters =
[env:esp32-wroom32-prometheus]
platform = [email protected]
board = lolin_d32
lib_deps = ${env:esp32-wroom32-minimal.lib_deps}
build_flags = ${env:esp32-wroom32.build_flags}
-DENABLE_PROMETHEUS_EP
monitor_filters =
Expand All @@ -206,6 +211,7 @@ monitor_filters =
[env:esp32-wroom32-prometheus-de]
platform = [email protected]
board = lolin_d32
lib_deps = ${env:esp32-wroom32-minimal.lib_deps}
build_flags = ${env:esp32-wroom32-prometheus.build_flags}
-DLANG_DE
monitor_filters =
Expand All @@ -214,6 +220,7 @@ monitor_filters =
[env:esp32-s2-mini]
platform = [email protected]
board = lolin_s2_mini
lib_deps = ${env:esp32-wroom32-minimal.lib_deps}
build_flags = ${env.build_flags}
-DUSE_HSPI_FOR_EPD
-DSPI_HAL
Expand All @@ -237,6 +244,7 @@ monitor_filters =
[env:esp32-s2-mini-de]
platform = [email protected]
board = lolin_s2_mini
lib_deps = ${env:esp32-wroom32-minimal.lib_deps}
build_flags = ${env:esp32-s2-mini.build_flags}
-DLANG_DE
monitor_filters =
Expand All @@ -245,6 +253,7 @@ monitor_filters =
[env:esp32-c3-mini]
platform = [email protected]
board = lolin_c3_mini
lib_deps = ${env:esp32-wroom32-minimal.lib_deps}
build_flags = ${env.build_flags}
-DUSE_HSPI_FOR_EPD
-DSPI_HAL
Expand All @@ -268,6 +277,7 @@ monitor_filters =
[env:esp32-c3-mini-de]
platform = [email protected]
board = lolin_c3_mini
lib_deps = ${env:esp32-wroom32-minimal.lib_deps}
build_flags = ${env:esp32-c3-mini.build_flags}
-DLANG_DE
monitor_filters =
Expand All @@ -277,6 +287,7 @@ monitor_filters =
platform = [email protected]
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
Expand All @@ -302,6 +313,7 @@ monitor_filters =
platform = [email protected]
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
Expand All @@ -320,6 +332,7 @@ monitor_filters =
platform = [email protected]
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 =
Expand All @@ -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
Expand All @@ -339,6 +353,7 @@ monitor_filters =
platform = [email protected]
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 =
Expand Down
6 changes: 3 additions & 3 deletions src/web/RestApi.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/web/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ <h3>{#SUPPORT}:</h3>
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()
);

Expand Down
4 changes: 2 additions & 2 deletions src/web/html/setup.html
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
]));
Expand All @@ -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"))
]));
Expand Down
1 change: 1 addition & 0 deletions src/web/html/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
}

Expand Down
10 changes: 5 additions & 5 deletions src/web/html/system.html
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down Expand Up @@ -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"),
Expand Down Expand Up @@ -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')),
Expand Down
12 changes: 6 additions & 6 deletions src/web/lang.json
Original file line number Diff line number Diff line change
Expand Up @@ -1052,6 +1052,11 @@
"token": "COMMUNICATING",
"en": "communicating",
"de": "kommunizierend"
},
{
"token": "SUN",
"en": "Sun",
"de": "Sonne"
}
]
},
Expand Down Expand Up @@ -1240,19 +1245,14 @@
},
{
"token": "PRODUCING",
"en": "producing",
"en": "is producing",
"de": "produziert"
},
{
"token": "INVERTER",
"en": "Inverter",
"de": "Wechselrichter"
},
{
"token": "IS",
"en": "is",
"de": "ist"
},
{
"token": "LAST_SUCCESS",
"en": "last successful transmission",
Expand Down

0 comments on commit d14d783

Please sign in to comment.