diff --git a/src/CHANGES.md b/src/CHANGES.md index 8a41bd80..135fe0fc 100644 --- a/src/CHANGES.md +++ b/src/CHANGES.md @@ -1,5 +1,11 @@ # Development Changes +## 0.8.111 - 2024-04-17 +* fix MqTT discovery field `ALARM_MES_ID` #1591 +* fix Wifi reconnect for ESP32 #1589 #1575 +* open link from `index.html` in new tab #1588 #1587 +* merge PR: Disable upload and import buttons when no file is selected #1586 #1519 + ## 0.8.110 - 2024-04-11 * revert CMT2300A changes #1553 * merged PR: fix closing tag #1584 diff --git a/src/defines.h b/src/defines.h index e7eecc00..cab8676d 100644 --- a/src/defines.h +++ b/src/defines.h @@ -13,7 +13,7 @@ //------------------------------------- #define VERSION_MAJOR 0 #define VERSION_MINOR 8 -#define VERSION_PATCH 110 +#define VERSION_PATCH 111 //------------------------------------- typedef struct { uint8_t ch; diff --git a/src/hm/hmInverter.h b/src/hm/hmInverter.h index 90c3875d..72226154 100644 --- a/src/hm/hmInverter.h +++ b/src/hm/hmInverter.h @@ -33,31 +33,31 @@ // prototypes template -static T calcYieldTotalCh0(Inverter<> *iv, uint8_t arg0); +T calcYieldTotalCh0(Inverter<> *iv, uint8_t arg0); template -static T calcYieldDayCh0(Inverter<> *iv, uint8_t arg0); +T calcYieldDayCh0(Inverter<> *iv, uint8_t arg0); template -static T calcUdcCh(Inverter<> *iv, uint8_t arg0); +T calcUdcCh(Inverter<> *iv, uint8_t arg0); template -static T calcPowerDcCh0(Inverter<> *iv, uint8_t arg0); +T calcPowerDcCh0(Inverter<> *iv, uint8_t arg0); template -static T calcEffiencyCh0(Inverter<> *iv, uint8_t arg0); +T calcEffiencyCh0(Inverter<> *iv, uint8_t arg0); template -static T calcIrradiation(Inverter<> *iv, uint8_t arg0); +T calcIrradiation(Inverter<> *iv, uint8_t arg0); template -static T calcMaxPowerAcCh0(Inverter<> *iv, uint8_t arg0); +T calcMaxPowerAcCh0(Inverter<> *iv, uint8_t arg0); template -static T calcMaxTempCh0(Inverter<> *iv, uint8_t arg0); +T calcMaxTempCh0(Inverter<> *iv, uint8_t arg0); template -static T calcMaxPowerDc(Inverter<> *iv, uint8_t arg0); +T calcMaxPowerDc(Inverter<> *iv, uint8_t arg0); template using func_t = T (Inverter<> *, uint8_t); @@ -275,7 +275,8 @@ class Inverter { if(InverterStatus::OFF != status) { mDevControlRequest = true; devControlCmd = cmd; - //app->triggerTickSend(); // done in RestApi.h, because of "chicken-and-egg problem ;-)" + //assert(App); + //App->triggerTickSend(0); } return (InverterStatus::OFF != status); } @@ -823,6 +824,7 @@ class Inverter { public: static uint32_t *timestamp; // system timestamp static cfgInst_t *generalConfig; // general inverter configuration from setup + static IApp *App; uint16_t mDtuRxCnt = 0; uint16_t mDtuTxCnt = 0; @@ -843,6 +845,8 @@ template uint32_t *Inverter::timestamp {0}; template cfgInst_t *Inverter::generalConfig {0}; +template +IApp *Inverter::App {nullptr}; /** @@ -852,7 +856,7 @@ cfgInst_t *Inverter::generalConfig {0}; */ template -static T calcYieldTotalCh0(Inverter<> *iv, uint8_t arg0) { +T calcYieldTotalCh0(Inverter<> *iv, uint8_t arg0) { DPRINTLN(DBG_VERBOSE, F("hmInverter.h:calcYieldTotalCh0")); if(NULL != iv) { record_t<> *rec = iv->getRecordStruct(RealTimeRunData_Debug); @@ -866,7 +870,7 @@ static T calcYieldTotalCh0(Inverter<> *iv, uint8_t arg0) { } template -static T calcYieldDayCh0(Inverter<> *iv, uint8_t arg0) { +T calcYieldDayCh0(Inverter<> *iv, uint8_t arg0) { DPRINTLN(DBG_VERBOSE, F("hmInverter.h:calcYieldDayCh0")); if(NULL != iv) { record_t<> *rec = iv->getRecordStruct(RealTimeRunData_Debug); @@ -880,7 +884,7 @@ static T calcYieldDayCh0(Inverter<> *iv, uint8_t arg0) { } template -static T calcUdcCh(Inverter<> *iv, uint8_t arg0) { +T calcUdcCh(Inverter<> *iv, uint8_t arg0) { DPRINTLN(DBG_VERBOSE, F("hmInverter.h:calcUdcCh")); // arg0 = channel of source record_t<> *rec = iv->getRecordStruct(RealTimeRunData_Debug); @@ -894,7 +898,7 @@ static T calcUdcCh(Inverter<> *iv, uint8_t arg0) { } template -static T calcPowerDcCh0(Inverter<> *iv, uint8_t arg0) { +T calcPowerDcCh0(Inverter<> *iv, uint8_t arg0) { DPRINTLN(DBG_VERBOSE, F("hmInverter.h:calcPowerDcCh0")); if(NULL != iv) { record_t<> *rec = iv->getRecordStruct(RealTimeRunData_Debug); @@ -908,7 +912,7 @@ static T calcPowerDcCh0(Inverter<> *iv, uint8_t arg0) { } template -static T calcEffiencyCh0(Inverter<> *iv, uint8_t arg0) { +T calcEffiencyCh0(Inverter<> *iv, uint8_t arg0) { DPRINTLN(DBG_VERBOSE, F("hmInverter.h:calcEfficiencyCh0")); if(NULL != iv) { record_t<> *rec = iv->getRecordStruct(RealTimeRunData_Debug); @@ -924,7 +928,7 @@ static T calcEffiencyCh0(Inverter<> *iv, uint8_t arg0) { } template -static T calcIrradiation(Inverter<> *iv, uint8_t arg0) { +T calcIrradiation(Inverter<> *iv, uint8_t arg0) { DPRINTLN(DBG_VERBOSE, F("hmInverter.h:calcIrradiation")); // arg0 = channel if(NULL != iv) { @@ -936,7 +940,7 @@ static T calcIrradiation(Inverter<> *iv, uint8_t arg0) { } template -static T calcMaxPowerAcCh0(Inverter<> *iv, uint8_t arg0) { +T calcMaxPowerAcCh0(Inverter<> *iv, uint8_t arg0) { DPRINTLN(DBG_VERBOSE, F("hmInverter.h:calcMaxPowerAcCh0")); T acMaxPower = 0.0; if(NULL != iv) { @@ -957,7 +961,7 @@ static T calcMaxPowerAcCh0(Inverter<> *iv, uint8_t arg0) { } template -static T calcMaxTempCh0(Inverter<> *iv, uint8_t arg0) { +T calcMaxTempCh0(Inverter<> *iv, uint8_t arg0) { DPRINTLN(DBG_VERBOSE, F("hmInverter.h:calcMaxTempCh0")); T maxTemp = 0.0; if(NULL != iv) { @@ -979,7 +983,7 @@ static T calcMaxTempCh0(Inverter<> *iv, uint8_t arg0) { template -static T calcMaxPowerDc(Inverter<> *iv, uint8_t arg0) { +T calcMaxPowerDc(Inverter<> *iv, uint8_t arg0) { DPRINTLN(DBG_VERBOSE, F("hmInverter.h:calcMaxPowerDc")); // arg0 = channel T dcMaxPower = 0.0; diff --git a/src/hm/hmSystem.h b/src/hm/hmSystem.h index 3b43b9f0..28c7905a 100644 --- a/src/hm/hmSystem.h +++ b/src/hm/hmSystem.h @@ -18,6 +18,7 @@ class HmSystem { void setup(uint32_t *timestamp, cfgInst_t *config, IApp *app) { INVERTERTYPE::timestamp = timestamp; INVERTERTYPE::generalConfig = config; + INVERTERTYPE::App = app; //mInverter[0].app = app; } diff --git a/src/network/AhoyWifiEsp32.h b/src/network/AhoyWifiEsp32.h index 98b7053c..b3e12b3a 100644 --- a/src/network/AhoyWifiEsp32.h +++ b/src/network/AhoyWifiEsp32.h @@ -43,8 +43,8 @@ class AhoyWifi : public AhoyNetwork { if(mConnected) { mConnected = false; mOnNetworkCB(false); - mAp.enable(); MDNS.end(); + begin(); } break; @@ -59,7 +59,6 @@ class AhoyWifi : public AhoyNetwork { mConnected = true; ah::welcome(WiFi.localIP().toString(), F("Station")); MDNS.begin(mConfig->sys.deviceName); - //MDNS.addServiceTxt("http", "tcp", "path", "/"); mOnNetworkCB(true); } break; diff --git a/src/publisher/pubMqtt.h b/src/publisher/pubMqtt.h index ce3f9b19..1650560e 100644 --- a/src/publisher/pubMqtt.h +++ b/src/publisher/pubMqtt.h @@ -443,7 +443,8 @@ class PubMqtt { snprintf(topic.data(), topic.size(), "%s/sensor/%s/total_%s/config", MQTT_DISCOVERY_PREFIX, node_id.c_str(), fields[fldTotal[mDiscovery.sub]]); size_t size = measureJson(doc2) + 1; serializeJson(doc2, buf.data(), size); - publish(topic.data(), buf.data(), true, false); + if(FLD_EVT != rec->assign[mDiscovery.sub].fieldId) + publish(topic.data(), buf.data(), true, false); if(++mDiscovery.sub == ((!total) ? (rec->length) : 4)) { mDiscovery.sub = 0; diff --git a/src/web/Protection.h b/src/web/Protection.h index 74f04b52..e41249ac 100644 --- a/src/web/Protection.h +++ b/src/web/Protection.h @@ -24,7 +24,7 @@ class Protection { } public: - Protection(Protection &other) = delete; + Protection(const Protection &other) = delete; void operator=(const Protection &) = delete; static Protection* getInstance(const char *pwd) { diff --git a/src/web/html/colorBright.css b/src/web/html/colorBright.css index aedd05d4..ebf4f12a 100644 --- a/src/web/html/colorBright.css +++ b/src/web/html/colorBright.css @@ -12,6 +12,7 @@ --nav-bg: #333; --primary: #006ec0; + --primary-disabled: #ccc; --primary-hover: #044e86; --secondary: #0072c8; --nav-active: #555; diff --git a/src/web/html/colorDark.css b/src/web/html/colorDark.css index b5b1a72b..23e7a2cf 100644 --- a/src/web/html/colorDark.css +++ b/src/web/html/colorDark.css @@ -12,6 +12,7 @@ --nav-bg: #333; --primary: #004d87; + --primary-disabled: #ccc; --primary-hover: #023155; --secondary: #0072c8; --nav-active: #555; diff --git a/src/web/html/index.html b/src/web/html/index.html index a811dd2a..82bf36d4 100644 --- a/src/web/html/index.html +++ b/src/web/html/index.html @@ -24,9 +24,9 @@

{#SUPPORT}:

diff --git a/src/web/html/setup.html b/src/web/html/setup.html index bba90f0a..d3976c4e 100644 --- a/src/web/html/setup.html +++ b/src/web/html/setup.html @@ -325,8 +325,8 @@
-
-
+
+
@@ -617,6 +617,22 @@ getAjax("/api/setup", apiCbMqtt, "POST", JSON.stringify(obj)); } + document.addEventListener('DOMContentLoaded', () => { + const fileInput = document.querySelector('#importFileInput'); + const button = document.querySelector('#importButton'); + button.disabled = true; + button.title = "Please select a file first"; + fileInput.addEventListener('change', () => { + if (fileInput.value) { + button.disabled = false; + button.title = ""; + } else { + button.disabled = true; + button.title = "Please select a file first"; + } + }); + }); + function hide() { document.getElementById("form").submit(); var e = document.getElementById("content"); diff --git a/src/web/html/style.css b/src/web/html/style.css index 60805e19..2866dda1 100644 --- a/src/web/html/style.css +++ b/src/web/html/style.css @@ -563,7 +563,13 @@ input.btn { cursor: pointer; } -input.btn:hover { +input.btn:disabled { + background-color: var(--primary-disabled); + color: #888; + cursor: not-allowed; +} + +input.btn:not(:disabled):hover { background-color: #044e86; } diff --git a/src/web/html/update.html b/src/web/html/update.html index ebdbb7ab..d73be7e0 100644 --- a/src/web/html/update.html +++ b/src/web/html/update.html @@ -12,8 +12,8 @@ {#SELECT_FILE} (*.bin)

{#INSTALLED_VERSION}:

- - + +
@@ -23,6 +23,22 @@
{#HTML_FOOTER}