From 962e9d283180a892f0fee7dfe6a164f253024934 Mon Sep 17 00:00:00 2001 From: lumapu Date: Fri, 23 Feb 2024 00:00:25 +0100 Subject: [PATCH] 0.8.85 - zero * disabled display and history for all ESPs expect ESP32S3 --- .github/workflows/compile_zero-export.yml | 8 +------- src/config/config_override.h | 16 ++++++++++++++++ src/config/settings.h | 10 ++++++++++ src/plugins/zeroExport/zeroExport.cpp | 0 src/web/RestApi.h | 4 ++++ src/web/web.h | 12 +++++++++--- 6 files changed, 40 insertions(+), 10 deletions(-) create mode 100644 src/config/config_override.h delete mode 100644 src/plugins/zeroExport/zeroExport.cpp diff --git a/.github/workflows/compile_zero-export.yml b/.github/workflows/compile_zero-export.yml index a609ff09..06eab1aa 100644 --- a/.github/workflows/compile_zero-export.yml +++ b/.github/workflows/compile_zero-export.yml @@ -161,12 +161,6 @@ jobs: - name: Rename firmware directory run: mv firmware ${{ steps.version_name.outputs.name }} - - name: Zip Artifacts - uses: vimtor/action-zip@v1.2 - with: - files: ${{ steps.version_name.outputs.name }} manual/User_Manual.md manual/Getting_Started.md - dest: '${{ steps.version_name.outputs.name }}.zip' - - name: delete environment Artifacts uses: geekyeggo/delete-artifact@v4 with: @@ -176,4 +170,4 @@ jobs: uses: actions/upload-artifact@v4 with: name: zero-${{ steps.version_name.outputs.name }} - path: '${{ steps.version_name.outputs.name }}.zip' + path: ${{ steps.version_name.outputs.name }} manual/User_Manual.md manual/Getting_Started.md diff --git a/src/config/config_override.h b/src/config/config_override.h new file mode 100644 index 00000000..97dc7e9f --- /dev/null +++ b/src/config/config_override.h @@ -0,0 +1,16 @@ +#ifndef __CONFIG_OVERRIDE_H__ +#define __CONFIG_OVERRIDE_H__ + +// save space in the ESP32 by disabling modules + +#if !defined(CONFIG_IDF_TARGET_ESP32S3) + #ifdef PLUGIN_DISPLAY + #undef PLUGIN_DISPLAY + #endif + + #ifdef ENABLE_HISTORY + #undef ENABLE_HISTORY + #endif +#endif + +#endif /*__CONFIG_OVERRIDE_H__*/ diff --git a/src/config/settings.h b/src/config/settings.h index 0a462e06..f4618603 100644 --- a/src/config/settings.h +++ b/src/config/settings.h @@ -183,6 +183,7 @@ typedef struct { bool readGrid; } cfgInst_t; +#if defined(PLUGIN_DISPLAY) typedef struct { uint8_t type; bool pwrSaveAtIvOffline; @@ -201,9 +202,12 @@ typedef struct { uint8_t disp_dc; uint8_t pirPin; } display_t; +#endif typedef struct { + #if defined(PLUGIN_DISPLAY) display_t display; + #endif char customLink[MAX_CUSTOM_LINK_LEN]; char customLinkText[MAX_CUSTOM_LINK_TEXT_LEN]; #if defined(ESP32) @@ -506,6 +510,7 @@ class settings { mCfg.led.high_active = LED_HIGH_ACTIVE; mCfg.led.luminance = 255; + #if defined(PLUGIN_DISPLAY) mCfg.plugin.display.pwrSaveAtIvOffline = false; mCfg.plugin.display.contrast = 140; mCfg.plugin.display.screenSaver = 1; // default: 1 .. pixelshift for OLED for downward compatibility @@ -519,6 +524,7 @@ class settings { mCfg.plugin.display.disp_busy = DEF_PIN_OFF; mCfg.plugin.display.disp_dc = DEF_PIN_OFF; mCfg.plugin.display.pirPin = DEF_PIN_OFF; + #endif } void loadAddedDefaults() { @@ -785,6 +791,7 @@ class settings { void jsonPlugin(JsonObject obj, bool set = false) { if(set) { + #if defined(PLUGIN_DISPLAY) JsonObject disp = obj.createNestedObject("disp"); disp[F("type")] = mCfg.plugin.display.type; disp[F("pwrSafe")] = (bool)mCfg.plugin.display.pwrSaveAtIvOffline; @@ -802,9 +809,11 @@ class settings { disp[F("busy")] = mCfg.plugin.display.disp_busy; disp[F("dc")] = mCfg.plugin.display.disp_dc; disp[F("pirPin")] = mCfg.plugin.display.pirPin; + #endif obj[F("cst_lnk")] = mCfg.plugin.customLink; obj[F("cst_lnk_txt")] = mCfg.plugin.customLinkText; } else { + #if defined(PLUGIN_DISPLAY) JsonObject disp = obj["disp"]; getVal(disp, F("type"), &mCfg.plugin.display.type); getVal(disp, F("pwrSafe"), &mCfg.plugin.display.pwrSaveAtIvOffline); @@ -822,6 +831,7 @@ class settings { getVal(disp, F("busy"), &mCfg.plugin.display.disp_busy); getVal(disp, F("dc"), &mCfg.plugin.display.disp_dc); getVal(disp, F("pirPin"), &mCfg.plugin.display.pirPin); + #endif getChar(obj, F("cst_lnk"), mCfg.plugin.customLink, MAX_CUSTOM_LINK_LEN); getChar(obj, F("cst_lnk_txt"), mCfg.plugin.customLinkText, MAX_CUSTOM_LINK_TEXT_LEN); } diff --git a/src/plugins/zeroExport/zeroExport.cpp b/src/plugins/zeroExport/zeroExport.cpp deleted file mode 100644 index e69de29b..00000000 diff --git a/src/web/RestApi.h b/src/web/RestApi.h index 9886d15f..12fe6d70 100644 --- a/src/web/RestApi.h +++ b/src/web/RestApi.h @@ -708,6 +708,7 @@ class RestApi { ah::ip2Char(mConfig->sys.ip.gateway, buf); obj[F("gateway")] = String(buf); } + #if defined(PLUGIN_DISPLAY) void getDisplay(JsonObject obj) { obj[F("disp_typ")] = (uint8_t)mConfig->plugin.display.type; obj[F("disp_pwr")] = (bool)mConfig->plugin.display.pwrSaveAtIvOffline; @@ -724,6 +725,7 @@ class RestApi { obj[F("disp_bsy")] = mConfig->plugin.display.disp_busy; obj[F("pir_pin")] = mConfig->plugin.display.pirPin; } + #endif void getMqttInfo(JsonObject obj) { obj[F("enabled")] = (mConfig->mqtt.broker[0] != '\0'); @@ -790,7 +792,9 @@ class RestApi { getRadioNrf(obj.createNestedObject(F("radioNrf"))); getSerial(obj.createNestedObject(F("serial"))); getStaticIp(obj.createNestedObject(F("static_ip"))); + #if defined(PLUGIN_DISPLAY) getDisplay(obj.createNestedObject(F("display"))); + #endif #if defined(ESP32) getzeroExport(obj.createNestedObject(F("zeroExport"))); diff --git a/src/web/web.h b/src/web/web.h index 2e21ec58..2764e219 100644 --- a/src/web/web.h +++ b/src/web/web.h @@ -37,7 +37,9 @@ #include "html/h/visualization_html.h" #include "html/h/about_html.h" #include "html/h/wizard_html.h" -#include "html/h/history_html.h" +#if defined(ENABLE_HISTORY) + #include "html/h/history_html.h" +#endif #define WEB_SERIAL_BUF_SIZE 2048 @@ -77,8 +79,9 @@ class Web { mWeb.on("/save", HTTP_POST, std::bind(&Web::showSave, this, std::placeholders::_1)); mWeb.on("/live", HTTP_ANY, std::bind(&Web::onLive, this, std::placeholders::_1)); + #if defined(ENABLE_HISTORY) mWeb.on("/history", HTTP_ANY, std::bind(&Web::onHistory, this, std::placeholders::_1)); - + #endif #ifdef ENABLE_PROMETHEUS_EP mWeb.on("/metrics", HTTP_ANY, std::bind(&Web::showMetrics, this, std::placeholders::_1)); #endif @@ -588,6 +591,7 @@ class Web { mConfig->serial.log2mqtt = (request->arg("log2mqtt") == "on"); // display + #if defined(PLUGIN_DISPLAY) mConfig->plugin.display.pwrSaveAtIvOffline = (request->arg("disp_pwr") == "on"); mConfig->plugin.display.graph_size = request->arg("disp_graph_size").toInt(); mConfig->plugin.display.rot = request->arg("disp_rot").toInt(); @@ -614,7 +618,7 @@ class Web { mConfig->plugin.display.disp_reset = (mConfig->plugin.display.type != DISP_TYPE_T10_EPAPER) ? DEF_PIN_OFF : request->arg("disp_rst").toInt(); mConfig->plugin.display.disp_busy = (mConfig->plugin.display.type != DISP_TYPE_T10_EPAPER) ? DEF_PIN_OFF : request->arg("disp_bsy").toInt(); mConfig->plugin.display.pirPin = (mConfig->plugin.display.screenSaver != DISP_TYPE_T2_SH1106_128X64) ? DEF_PIN_OFF : request->arg("pir_pin").toInt(); // pir pin only for motion screensaver - // otherweise default value + #endif // otherweise default value mApp->saveSettings((request->arg("reboot") == "on")); @@ -627,9 +631,11 @@ class Web { getPage(request, PROT_MASK_LIVE, visualization_html, visualization_html_len); } + #if defined(ENABLE_HISTORY) void onHistory(AsyncWebServerRequest *request) { getPage(request, PROT_MASK_HISTORY, history_html, history_html_len); } + #endif void onAbout(AsyncWebServerRequest *request) { AsyncWebServerResponse *response = request->beginResponse_P(200, F("text/html; charset=UTF-8"), about_html, about_html_len);