diff --git a/patches/AsyncWeb_Prometheus.patch b/patches/AsyncWeb_Prometheus.patch index 3c7deac4..f8e02c87 100644 --- a/patches/AsyncWeb_Prometheus.patch +++ b/patches/AsyncWeb_Prometheus.patch @@ -1,26 +1,26 @@ -diff --git a/src/AsyncWebSocket.cpp b/src/AsyncWebSocket.cpp -index 6e88da9..09359c3 100644 +diff --git a/src/AsyncWebSocket.cpp b/src/AsyncWebSocket.cpp +index 88d88ec..cb06fe0 100644 --- a/src/AsyncWebSocket.cpp +++ b/src/AsyncWebSocket.cpp -@@ -827,7 +827,7 @@ void AsyncWebSocketClient::binary(AsyncWebSocketMessageBuffer * buffer) +@@ -745,7 +745,7 @@ void AsyncWebSocketClient::binary(const __FlashStringHelper* data, size_t len) { - IPAddress AsyncWebSocketClient::remoteIP() { - if(!_client) { -- return IPAddress((uint32_t)0); -+ return IPAddress(); - } - return _client->remoteIP(); + IPAddress AsyncWebSocketClient::remoteIP() const { + if (!_client) +- return IPAddress((uint32_t)0U); ++ return IPAddress(); + + return _client->remoteIP(); } diff --git a/src/WebResponses.cpp b/src/WebResponses.cpp -index a22e991..babef18 100644 +index 86aa947..9d0ee00 100644 --- a/src/WebResponses.cpp +++ b/src/WebResponses.cpp -@@ -317,7 +317,7 @@ size_t AsyncAbstractResponse::_ack(AsyncWebServerRequest *request, size_t len, u - free(buf); - return 0; +@@ -447,7 +447,7 @@ size_t AsyncAbstractResponse::_ack(AsyncWebServerRequest* request, size_t len, u + free(buf); + return 0; } -- outLen = sprintf((char*)buf+headLen, "%x", readLen) + headLen; -+ outLen = sprintf((char*)buf+headLen, "%04x", readLen) + headLen; - while(outLen < headLen + 4) buf[outLen++] = ' '; +- outLen = sprintf_P((char*)buf + headLen, PSTR("%x"), readLen) + headLen; ++ outLen = sprintf_P((char*)buf + headLen, PSTR("%04x"), readLen) + headLen; + while (outLen < headLen + 4) + buf[outLen++] = ' '; buf[outLen++] = '\r'; - buf[outLen++] = '\n'; diff --git a/scripts/applyPatches.py b/scripts/applyPatches.py index 1672ab2f..b6d86be7 100644 --- a/scripts/applyPatches.py +++ b/scripts/applyPatches.py @@ -26,7 +26,7 @@ def applyPatch(libName, patchFile): # list of patches to apply (relative to /src) -applyPatch("ESPAsyncWebServer-esphome", "../patches/AsyncWeb_Prometheus.patch") +applyPatch("ESPAsyncWebServer", "../patches/AsyncWeb_Prometheus.patch") if (env['PIOENV'][:5] == "esp32") or (env['PIOENV'][:13] == "opendtufusion"): applyPatch("GxEPD2", "../patches/GxEPD2_HAL.patch") diff --git a/src/config/settings.h b/src/config/settings.h index 02beedce..41965998 100644 --- a/src/config/settings.h +++ b/src/config/settings.h @@ -412,8 +412,8 @@ class settings { memcpy(&mCfg.sys, &tmp, sizeof(cfgSys_t)); #if !defined(ETHERNET) else { - snprintf(mCfg.sys.stationSsid, SSID_LEN, FB_WIFI_SSID); - snprintf(mCfg.sys.stationPwd, PWD_LEN, FB_WIFI_PWD); + mCfg.sys.stationSsid[0] = '\0'; + mCfg.sys.stationPwd[0] = '\0'; mCfg.sys.isHidden = false; } #endif diff --git a/src/hm/hmInverter.h b/src/hm/hmInverter.h index ff3ff9c5..f09fbe1d 100644 --- a/src/hm/hmInverter.h +++ b/src/hm/hmInverter.h @@ -817,7 +817,6 @@ class Inverter { private: inline void addAlarm(uint16_t code, uint32_t start, uint32_t end) { - bool found = false; uint8_t i = 0; if(start > end) diff --git a/src/platformio.ini b/src/platformio.ini index ffdbd1f7..40bce86e 100644 --- a/src/platformio.ini +++ b/src/platformio.ini @@ -26,7 +26,8 @@ extra_scripts = post:../scripts/add_littlefs_binary.py lib_deps = - https://github.com/esphome/ESPAsyncWebServer @ ^3.2.2 + #https://github.com/esphome/ESPAsyncWebServer @ ^3.2.2 + https://github.com/mathieucarbou/ESPAsyncWebServer @ ^3.1.2 https://github.com/nRF24/RF24.git#v1.4.8 paulstoffregen/Time @ ^1.6.1 https://github.com/bertmelis/espMqttClient#v1.7.0 @@ -51,6 +52,7 @@ lib_deps = https://github.com/me-no-dev/ESPAsyncUDP build_flags = ${env.build_flags} -DEMC_MIN_FREE_MEMORY=4096 + -D CONFIG_ASYNC_TCP_STACK_SIZE=4096 ;-Wl,-Map,output.map monitor_filters = esp8266_exception_decoder diff --git a/src/web/web.h b/src/web/web.h index 2d017969..f44cc524 100644 --- a/src/web/web.h +++ b/src/web/web.h @@ -249,7 +249,7 @@ class Web { if (CHECK_MASK(mConfig->sys.protectionMask, mask)) checkProtection(request); - AsyncWebServerResponse *response = request->beginResponse_P(200, F("text/html; charset=UTF-8"), zippedHtml, len); + AsyncWebServerResponse *response = request->beginResponse(200, F("text/html; charset=UTF-8"), zippedHtml, len); response->addHeader(F("Content-Encoding"), "gzip"); response->addHeader(F("content-type"), "text/html; charset=UTF-8"); if(request->hasParam("v")) @@ -339,7 +339,7 @@ class Web { } } - AsyncWebServerResponse *response = request->beginResponse_P(200, F("text/html; charset=UTF-8"), login_html, login_html_len); + AsyncWebServerResponse *response = request->beginResponse(200, F("text/html; charset=UTF-8"), login_html, login_html_len); response->addHeader(F("Content-Encoding"), "gzip"); request->send(response); } @@ -350,7 +350,7 @@ class Web { checkProtection(request); mApp->lock(true); - AsyncWebServerResponse *response = request->beginResponse_P(200, F("text/html; charset=UTF-8"), system_html, system_html_len); + AsyncWebServerResponse *response = request->beginResponse(200, F("text/html; charset=UTF-8"), system_html, system_html_len); response->addHeader(F("Content-Encoding"), "gzip"); request->send(response); } @@ -359,9 +359,9 @@ class Web { DPRINTLN(DBG_VERBOSE, F("onColor")); AsyncWebServerResponse *response; if (mConfig->sys.darkMode) - response = request->beginResponse_P(200, F("text/css"), colorDark_css, colorDark_css_len); + response = request->beginResponse(200, F("text/css"), colorDark_css, colorDark_css_len); else - response = request->beginResponse_P(200, F("text/css"), colorBright_css, colorBright_css_len); + response = request->beginResponse(200, F("text/css"), colorBright_css, colorBright_css_len); response->addHeader(F("Content-Encoding"), "gzip"); if(request->hasParam("v")) { response->addHeader(F("Cache-Control"), F("max-age=604800")); @@ -371,7 +371,7 @@ class Web { void onCss(AsyncWebServerRequest *request) { DPRINTLN(DBG_VERBOSE, F("onCss")); - AsyncWebServerResponse *response = request->beginResponse_P(200, F("text/css"), style_css, style_css_len); + AsyncWebServerResponse *response = request->beginResponse(200, F("text/css"), style_css, style_css_len); response->addHeader(F("Content-Encoding"), "gzip"); if(request->hasParam("v")) { response->addHeader(F("Cache-Control"), F("max-age=604800")); @@ -382,7 +382,7 @@ class Web { void onApiJs(AsyncWebServerRequest *request) { DPRINTLN(DBG_VERBOSE, F("onApiJs")); - AsyncWebServerResponse *response = request->beginResponse_P(200, F("text/javascript"), api_js, api_js_len); + AsyncWebServerResponse *response = request->beginResponse(200, F("text/javascript"), api_js, api_js_len); response->addHeader(F("Content-Encoding"), "gzip"); if(request->hasParam("v")) response->addHeader(F("Cache-Control"), F("max-age=604800")); @@ -392,7 +392,7 @@ class Web { void onGridInfoJson(AsyncWebServerRequest *request) { DPRINTLN(DBG_VERBOSE, F("onGridInfoJson")); - AsyncWebServerResponse *response = request->beginResponse_P(200, F("application/json; charset=utf-8"), grid_info_json, grid_info_json_len); + AsyncWebServerResponse *response = request->beginResponse(200, F("application/json; charset=utf-8"), grid_info_json, grid_info_json_len); response->addHeader(F("Content-Encoding"), "gzip"); if(request->hasParam("v")) response->addHeader(F("Cache-Control"), F("max-age=604800")); @@ -401,7 +401,7 @@ class Web { void onFavicon(AsyncWebServerRequest *request) { static const char favicon_type[] PROGMEM = "image/x-icon"; - AsyncWebServerResponse *response = request->beginResponse_P(200, favicon_type, favicon_ico, favicon_ico_len); + AsyncWebServerResponse *response = request->beginResponse(200, favicon_type, favicon_ico, favicon_ico_len); response->addHeader(F("Content-Encoding"), "gzip"); request->send(response); } @@ -414,7 +414,7 @@ class Web { void onReboot(AsyncWebServerRequest *request) { mApp->setRebootFlag(); - AsyncWebServerResponse *response = request->beginResponse_P(200, F("text/html; charset=UTF-8"), system_html, system_html_len); + AsyncWebServerResponse *response = request->beginResponse(200, F("text/html; charset=UTF-8"), system_html, system_html_len); response->addHeader(F("Content-Encoding"), "gzip"); request->send(response); } @@ -422,7 +422,7 @@ class Web { void showHtml(AsyncWebServerRequest *request) { checkProtection(request); - AsyncWebServerResponse *response = request->beginResponse_P(200, F("text/html; charset=UTF-8"), system_html, system_html_len); + AsyncWebServerResponse *response = request->beginResponse(200, F("text/html; charset=UTF-8"), system_html, system_html_len); response->addHeader(F("Content-Encoding"), "gzip"); request->send(response); } @@ -432,7 +432,7 @@ class Web { } void onWizard(AsyncWebServerRequest *request) { - AsyncWebServerResponse *response = request->beginResponse_P(200, F("text/html; charset=UTF-8"), wizard_html, wizard_html_len); + AsyncWebServerResponse *response = request->beginResponse(200, F("text/html; charset=UTF-8"), wizard_html, wizard_html_len); response->addHeader(F("Content-Encoding"), "gzip"); response->addHeader(F("content-type"), "text/html; charset=UTF-8"); request->send(response); @@ -625,7 +625,7 @@ class Web { mApp->saveSettings((request->arg("reboot") == "on")); - AsyncWebServerResponse *response = request->beginResponse_P(200, F("text/html; charset=UTF-8"), save_html, save_html_len); + AsyncWebServerResponse *response = request->beginResponse(200, F("text/html; charset=UTF-8"), save_html, save_html_len); response->addHeader(F("Content-Encoding"), "gzip"); request->send(response); } @@ -639,7 +639,7 @@ class Web { } void onAbout(AsyncWebServerRequest *request) { - AsyncWebServerResponse *response = request->beginResponse_P(200, F("text/html; charset=UTF-8"), about_html, about_html_len); + AsyncWebServerResponse *response = request->beginResponse(200, F("text/html; charset=UTF-8"), about_html, about_html_len); response->addHeader(F("Content-Encoding"), "gzip"); response->addHeader(F("content-type"), "text/html; charset=UTF-8"); if(request->hasParam("v")) {