diff --git a/.github/workflows/compile_development.yml b/.github/workflows/compile_development.yml index ec435880..59460d5c 100644 --- a/.github/workflows/compile_development.yml +++ b/.github/workflows/compile_development.yml @@ -47,7 +47,7 @@ jobs: run: python convert.py - name: Run PlatformIO - run: pio run -d src --environment esp8266-release --environment esp8285-release --environment esp32-wroom32-release + run: pio run -d src --environment esp8266-release --environment esp8266-release-prometheus --environment esp8285-release --environment esp32-wroom32-release --environment esp32-wroom32-release-prometheus - name: Rename Binary files id: rename-binary-files diff --git a/.github/workflows/compile_release.yml b/.github/workflows/compile_release.yml index 91ae35bf..bd7cef5a 100644 --- a/.github/workflows/compile_release.yml +++ b/.github/workflows/compile_release.yml @@ -51,7 +51,7 @@ jobs: run: python convert.py - name: Run PlatformIO - run: pio run -d src --environment esp8266-release --environment esp8285-release --environment esp32-wroom32-release + run: pio run -d src --environment esp8266-release --environment esp8266-release-prometheus --environment esp8285-release --environment esp32-wroom32-release --environment esp32-wroom32-release-prometheus - name: Rename Binary files id: rename-binary-files diff --git a/scripts/getVersion.py b/scripts/getVersion.py index 4ecb714e..77c5816b 100644 --- a/scripts/getVersion.py +++ b/scripts/getVersion.py @@ -56,6 +56,11 @@ def readVersion(path, infile): src = path + ".pio/build/esp8266-release/firmware.bin" dst = path + "firmware/" + versionout os.rename(src, dst) + + versionout = version[:-1] + "_" + sha + "_esp8266_prometheus.bin" + src = path + ".pio/build/esp8266-release-prometheus/firmware.bin" + dst = path + "firmware/" + versionout + os.rename(src, dst) versionout = version[:-1] + "_" + sha + "_esp8285.bin" src = path + ".pio/build/esp8285-release/firmware.bin" @@ -68,6 +73,11 @@ def readVersion(path, infile): dst = path + "firmware/" + versionout os.rename(src, dst) + versionout = version[:-1] + "_" + sha + "_esp32_prometheus.bin" + src = path + ".pio/build/esp32-wroom32-release-prometheus/firmware.bin" + dst = path + "firmware/" + versionout + os.rename(src, dst) + # other ESP32 bin files src = path + ".pio/build/esp32-wroom32-release/" dst = path + "firmware/" diff --git a/src/CHANGES.md b/src/CHANGES.md index 27d64cd7..27937299 100644 --- a/src/CHANGES.md +++ b/src/CHANGES.md @@ -2,6 +2,16 @@ (starting from release version `0.5.66`) +## 0.5.97 +* Attention: re-ordered display types, check your settings! #746 +* improved saving settings of display #747, #746 +* disabled contrast for Nokia display #746 +* added Prometheus as compile option #719, #615 +* update MQTT lib to v1.4.1 +* limit decimal places to 2 in `live` +* added `-DPIO_FRAMEWORK_ARDUINO_MMU_CACHE16_IRAM48` to esp8266 debug build #657 +* a `max-module-power` of `0` disables channel in live view `setup` + ## 0.5.96 * added Nokia display again for ESP8266 #764 * changed `var` / `VAr` to SI unit `var` #732 diff --git a/src/config/settings.h b/src/config/settings.h index 0e118bde..9dcca1c4 100644 --- a/src/config/settings.h +++ b/src/config/settings.h @@ -347,12 +347,12 @@ class settings { mCfg.plugin.display.contrast = 60; mCfg.plugin.display.pxShift = true; mCfg.plugin.display.rot = 0; - mCfg.plugin.display.disp_data = DEF_PIN_OFF; // SDA - mCfg.plugin.display.disp_clk = DEF_PIN_OFF; // SCL - mCfg.plugin.display.disp_cs = DEF_PIN_OFF; + mCfg.plugin.display.disp_data = DEF_PIN_OFF; // SDA + mCfg.plugin.display.disp_clk = DEF_PIN_OFF; // SCL + mCfg.plugin.display.disp_cs = DEF_PIN_OFF; mCfg.plugin.display.disp_reset = DEF_PIN_OFF; - mCfg.plugin.display.disp_busy = DEF_PIN_OFF; - mCfg.plugin.display.disp_dc = DEF_PIN_OFF; + mCfg.plugin.display.disp_busy = DEF_PIN_OFF; + mCfg.plugin.display.disp_dc = DEF_PIN_OFF; } void jsonWifi(JsonObject obj, bool set = false) { diff --git a/src/defines.h b/src/defines.h index f36c147f..13e525bc 100644 --- a/src/defines.h +++ b/src/defines.h @@ -13,7 +13,7 @@ //------------------------------------- #define VERSION_MAJOR 0 #define VERSION_MINOR 5 -#define VERSION_PATCH 96 +#define VERSION_PATCH 97 //------------------------------------- typedef struct { diff --git a/src/platformio.ini b/src/platformio.ini index e52cf3fb..6d3f8d23 100644 --- a/src/platformio.ini +++ b/src/platformio.ini @@ -20,12 +20,12 @@ upload_speed = 921600 ;build_flags = ; ;;;;; Possible Debug options ;;;;;; ; https://docs.platformio.org/en/latest/platforms/espressif8266.html#debug-level - ;-DDEBUG_ESP_PORT=Serial + ;-DDEBUG_ESP_PORT=Serial ;-DDEBUG_ESP_CORE - ;-DDEBUG_ESP_WIFI - ;-DDEBUG_ESP_HTTP_CLIENT - ;-DDEBUG_ESP_HTTP_SERVER - ;-DDEBUG_ESP_OOM + ;-DDEBUG_ESP_WIFI + ;-DDEBUG_ESP_HTTP_CLIENT + ;-DDEBUG_ESP_HTTP_SERVER + ;-DDEBUG_ESP_OOM monitor_speed = 115200 @@ -35,18 +35,18 @@ extra_scripts = lib_deps = https://github.com/yubox-node-org/ESPAsyncWebServer - nrf24/RF24 - paulstoffregen/Time - https://github.com/bertmelis/espMqttClient#v1.3.3 - bblanchon/ArduinoJson + nrf24/RF24 + paulstoffregen/Time + https://github.com/bertmelis/espMqttClient#v1.4.1 + bblanchon/ArduinoJson https://github.com/JChristensen/Timezone olikraus/U8g2 zinggjm/GxEPD2@^1.5.0 - ;esp8266/DNSServer - ;esp8266/EEPROM - ;esp8266/ESP8266WiFi - ;esp8266/SPI - ;esp8266/Ticker + ;esp8266/DNSServer + ;esp8266/EEPROM + ;esp8266/ESP8266WiFi + ;esp8266/SPI + ;esp8266/Ticker [env:esp8266-release] @@ -55,8 +55,20 @@ board = esp12e board_build.f_cpu = 80000000L build_flags = -D RELEASE monitor_filters = - ;default ; Remove typical terminal control codes from input - ;time ; Add timestamp with milliseconds for each new line + ;default ; Remove typical terminal control codes from input + ;time ; Add timestamp with milliseconds for each new line + ;log2file ; Log data to a file “platformio-device-monitor-*.log” located in the current working directory + esp8266_exception_decoder + + +[env:esp8266-release-prometheus] +platform = espressif8266 +board = esp12e +board_build.f_cpu = 80000000L +build_flags = -D RELEASE -DENABLE_PROMETHEUS_EP +monitor_filters = + ;default ; Remove typical terminal control codes from input + ;time ; Add timestamp with milliseconds for each new line ;log2file ; Log data to a file “platformio-device-monitor-*.log” located in the current working directory esp8266_exception_decoder @@ -64,11 +76,11 @@ monitor_filters = platform = espressif8266 board = esp12e board_build.f_cpu = 80000000L -build_flags = -DDEBUG_LEVEL=DBG_DEBUG -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -DDEBUG_ESP_OOM -DDEBUG_ESP_PORT=Serial +build_flags = -DDEBUG_LEVEL=DBG_DEBUG -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -DDEBUG_ESP_OOM -DDEBUG_ESP_PORT=Serial -DPIO_FRAMEWORK_ARDUINO_MMU_CACHE16_IRAM48 build_type = debug monitor_filters = - ;default ; Remove typical terminal control codes from input - time ; Add timestamp with milliseconds for each new line + ;default ; Remove typical terminal control codes from input + time ; Add timestamp with milliseconds for each new line log2file ; Log data to a file “platformio-device-monitor-*.log” located in the current working directory [env:esp8285-release] @@ -78,8 +90,8 @@ board_build.ldscript = eagle.flash.1m64.ld board_build.f_cpu = 80000000L build_flags = -D RELEASE monitor_filters = - ;default ; Remove typical terminal control codes from input - time ; Add timestamp with milliseconds for each new line + ;default ; Remove typical terminal control codes from input + time ; Add timestamp with milliseconds for each new line ;log2file ; Log data to a file “platformio-device-monitor-*.log” located in the current working directory [env:esp8285-debug] @@ -90,8 +102,8 @@ board_build.f_cpu = 80000000L build_flags = -DDEBUG_LEVEL=DBG_DEBUG -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -DDEBUG_ESP_OOM -DDEBUG_ESP_PORT=Serial build_type = debug monitor_filters = - ;default ; Remove typical terminal control codes from input - time ; Add timestamp with milliseconds for each new line + ;default ; Remove typical terminal control codes from input + time ; Add timestamp with milliseconds for each new line log2file ; Log data to a file “platformio-device-monitor-*.log” located in the current working directory [env:esp32-wroom32-release] @@ -100,8 +112,19 @@ board = lolin_d32 build_flags = -D RELEASE -std=gnu++14 build_unflags = -std=gnu++11 monitor_filters = - ;default ; Remove typical terminal control codes from input - ;time ; Add timestamp with milliseconds for each new line + ;default ; Remove typical terminal control codes from input + ;time ; Add timestamp with milliseconds for each new line + ;log2file ; Log data to a file “platformio-device-monitor-*.log” located in the current working directory + esp32_exception_decoder + +[env:esp32-wroom32-release-prometheus] +platform = espressif32 +board = lolin_d32 +build_flags = -D RELEASE -std=gnu++14 -DENABLE_PROMETHEUS_EP +build_unflags = -std=gnu++11 +monitor_filters = + ;default ; Remove typical terminal control codes from input + ;time ; Add timestamp with milliseconds for each new line ;log2file ; Log data to a file “platformio-device-monitor-*.log” located in the current working directory esp32_exception_decoder @@ -112,6 +135,6 @@ build_flags = -DDEBUG_LEVEL=DBG_DEBUG -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ build_unflags = -std=gnu++11 build_type = debug monitor_filters = - ;default ; Remove typical terminal control codes from input - time ; Add timestamp with milliseconds for each new line + ;default ; Remove typical terminal control codes from input + time ; Add timestamp with milliseconds for each new line log2file ; Log data to a file “platformio-device-monitor-*.log” located in the current working directory diff --git a/src/plugins/Display/Display_Mono.cpp b/src/plugins/Display/Display_Mono.cpp index 57d3cf6b..ad27ebcc 100644 --- a/src/plugins/Display/Display_Mono.cpp +++ b/src/plugins/Display/Display_Mono.cpp @@ -22,6 +22,7 @@ DisplayMono::DisplayMono() { _dispY = 0; mTimeout = DISP_DEFAULT_TIMEOUT; // interval at which to power save (milliseconds) mUtcTs = NULL; + mType = 0; } @@ -29,17 +30,18 @@ DisplayMono::DisplayMono() { void DisplayMono::init(uint8_t type, uint8_t rot, uint8_t cs, uint8_t dc, uint8_t reset, uint8_t clock, uint8_t data, uint32_t *utcTs, const char* version) { if ((0 < type) && (type < 4)) { u8g2_cb_t *rot = (u8g2_cb_t *)((rot != 0x00) ? U8G2_R2 : U8G2_R0); + mType = type; switch(type) { case 1: - mDisplay = new U8G2_PCD8544_84X48_F_4W_SW_SPI(rot, clock, data, cs, dc, reset); - break; - case 2: mDisplay = new U8G2_SSD1306_128X64_NONAME_F_HW_I2C(rot, reset, clock, data); break; default: - case 3: + case 2: mDisplay = new U8G2_SH1106_128X64_NONAME_F_HW_I2C(rot, reset, clock, data); break; + case 3: + mDisplay = new U8G2_PCD8544_84X48_F_4W_SW_SPI(rot, clock, data, cs, dc, reset); + break; } mUtcTs = utcTs; @@ -50,7 +52,8 @@ void DisplayMono::init(uint8_t type, uint8_t rot, uint8_t cs, uint8_t dc, uint8_ calcLineHeights(); mDisplay->clearBuffer(); - mDisplay->setContrast(mLuminance); + if (3 != mType) + mDisplay->setContrast(mLuminance); printText("AHOY!", 0, 35); printText("ahoydtu.de", 2, 20); printText(version, 3, 46); @@ -76,7 +79,8 @@ void DisplayMono::disp(float totalPower, float totalYieldDay, float totalYieldTo mDisplay->clearBuffer(); // set Contrast of the Display to raise the lifetime - mDisplay->setContrast(mLuminance); + if (3 != mType) + mDisplay->setContrast(mLuminance); if ((totalPower > 0) && (isprod > 0)) { mTimeout = DISP_DEFAULT_TIMEOUT; diff --git a/src/plugins/Display/Display_Mono.h b/src/plugins/Display/Display_Mono.h index 1b62328f..ad04c9f4 100644 --- a/src/plugins/Display/Display_Mono.h +++ b/src/plugins/Display/Display_Mono.h @@ -21,6 +21,7 @@ class DisplayMono { U8G2* mDisplay; + uint8_t mType; bool mEnPowerSafe, mEnScreenSaver; uint8_t mLuminance; diff --git a/src/web/RestApi.h b/src/web/RestApi.h index e9479a0b..9b14e439 100644 --- a/src/web/RestApi.h +++ b/src/web/RestApi.h @@ -305,8 +305,8 @@ class RestApi { for(uint8_t j = 0; j < iv->channels; j ++) { obj2[F("ch_yield_cor")][j] = iv->config->yieldCor[j]; - obj2[F("ch_max_power")][j] = iv->config->chMaxPwr[j]; obj2[F("ch_name")][j] = iv->config->chName[j]; + obj2[F("ch_max_pwr")][j] = iv->config->chMaxPwr[j]; } } } @@ -344,6 +344,7 @@ class RestApi { // DC for(uint8_t j = 0; j < iv->channels; j ++) { obj[F("ch_name")][j+1] = iv->config->chName[j]; + obj[F("ch_max_pwr")][j+1] = iv->config->chMaxPwr[j]; JsonArray cur = ch.createNestedArray(); for (uint8_t fld = 0; fld < sizeof(dcList); fld++) { pos = (iv->getPosByChFld((j+1), dcList[fld], rec)); @@ -410,12 +411,12 @@ class RestApi { obj[F("disp_pxshift")] = (bool)mConfig->plugin.display.pxShift; obj[F("disp_rot")] = (uint8_t)mConfig->plugin.display.rot; obj[F("disp_cont")] = (uint8_t)mConfig->plugin.display.contrast; - obj[F("disp_clk")] = mConfig->plugin.display.disp_clk; - obj[F("disp_data")] = mConfig->plugin.display.disp_data; - obj[F("disp_cs")] = mConfig->plugin.display.disp_cs; - obj[F("disp_dc")] = mConfig->plugin.display.disp_dc; - obj[F("disp_rst")] = mConfig->plugin.display.disp_reset; - obj[F("disp_bsy")] = mConfig->plugin.display.disp_busy; + obj[F("disp_clk")] = (mConfig->plugin.display.type == 0) ? DEF_PIN_OFF : mConfig->plugin.display.disp_clk; + obj[F("disp_data")] = (mConfig->plugin.display.type == 0) ? DEF_PIN_OFF : mConfig->plugin.display.disp_data; + obj[F("disp_cs")] = (mConfig->plugin.display.type == 0) ? DEF_PIN_OFF : mConfig->plugin.display.disp_cs; + obj[F("disp_dc")] = (mConfig->plugin.display.type == 0) ? DEF_PIN_OFF : mConfig->plugin.display.disp_dc; + obj[F("disp_rst")] = (mConfig->plugin.display.type == 0) ? DEF_PIN_OFF : mConfig->plugin.display.disp_reset; + obj[F("disp_bsy")] = (mConfig->plugin.display.type == 0) ? DEF_PIN_OFF : mConfig->plugin.display.disp_busy; } void getIndex(JsonObject obj) { diff --git a/src/web/html/setup.html b/src/web/html/setup.html index 53ad13fd..e3188f05 100644 --- a/src/web/html/setup.html +++ b/src/web/html/setup.html @@ -136,6 +136,10 @@
+
+

Note

+

A 'max module power' value of '0' disables the channel in 'live' view

+

General

@@ -499,7 +503,7 @@ iv.append(mlE("Name*", inp(id + "Name", obj["name"], 16, ["text"], null, "text", "[A-Za-z0-9./#$%&=+_-]+", "Invalid input"))); for(var j of [ - ["ModPwr", "ch_max_power", "Max Module Power (Wp)", 4, "[0-9]+"], + ["ModPwr", "ch_max_pwr", "Max Module Power (Wp)", 4, "[0-9]+"], ["ModName", "ch_name", "Module Name", 15, null], ["YieldCor", "ch_yield_cor", "Yield Total Correction [kWh]", 8, "[0-9-]+"]]) { @@ -648,7 +652,7 @@ ); } - var opts = [[0, "None"], [1, "Nokia5110"], [2, "SSD1306 0.96\""], [3, "SH1106 1.3\""]]; + var opts = [[0, "None"], [1, "SSD1306 0.96\""], [2, "SH1106 1.3\""], [3, "Nokia5110"]]; if("ESP32" == type) opts.push([10, "ePaper"]); document.getElementById("dispType").append( diff --git a/src/web/html/visualization.html b/src/web/html/visualization.html index 44764a49..de5b0069 100644 --- a/src/web/html/visualization.html +++ b/src/web/html/visualization.html @@ -34,7 +34,7 @@ return ml("div", {class: "col-6 col-sm-4 a-c"}, [ ml("div", {class: "row"}, ml("div", {class: "col"}, [ - ml("span", {class: "fs-5 fs-md-4"}, String(val)), + ml("span", {class: "fs-5 fs-md-4"}, String(Math.round(val * 100) / 100)), ml("span", {class: "fs-6 fs-md-7 mx-1"}, unit) ])), ml("div", {class: "row"}, @@ -49,7 +49,7 @@ return ml("div", {class: "col-6 col-sm-4 col-md-3 mb-2"}, [ ml("div", {class: "row"}, ml("div", {class: "col"}, [ - ml("span", {class: "fs-6"}, String(val)), + ml("span", {class: "fs-6"}, String(Math.round(val * 100) / 100)), ml("span", {class: "fs-8 mx-1"}, unit) ])), ml("div", {class: "row"}, @@ -94,7 +94,7 @@ total[3] += obj.ch[0][8]; // P_DC total[4] += obj.ch[0][10]; // Q_AC var t = span(" ° C"); - return ml("div", {class: "row"}, + return ml("div", {class: "row mt-2"}, ml("div", {class: "col"}, [ ml("div", {class: "p-2 iv-h"}, ml("div", {class: "row"}, [ @@ -128,7 +128,7 @@ return ml("div", {class: "col-12 col-sm-6 col-md-12 mb-2"}, [ ml("div", {class: "row"}, ml("div", {class: "col"}, [ - ml("span", {class: "fs-6 fs-md-7"}, String(val)), + ml("span", {class: "fs-6 fs-md-7"}, String(Math.round(val * 100) / 100)), ml("span", {class: "fs-8 mx-2"}, unit) ])), ml("div", {class: "row"}, @@ -182,7 +182,8 @@ var name = obj.ch_name[i]; if(name.length == 0) name = "CHANNEL " + i; - chn.push(ch(name, obj.ch[i])); + if(obj.ch_max_pwr[i] > 0) // show channel only if max mod pwr + chn.push(ch(name, obj.ch[i])); } mIvHtml.push( ml("div", {}, [ diff --git a/src/web/web.h b/src/web/web.h index 15b22eb0..fe4a53e6 100644 --- a/src/web/web.h +++ b/src/web/web.h @@ -582,13 +582,13 @@ class Web { mConfig->plugin.display.pxShift = (request->arg("disp_pxshift") == "on"); mConfig->plugin.display.rot = request->arg("disp_rot").toInt(); mConfig->plugin.display.type = request->arg("disp_typ").toInt(); - mConfig->plugin.display.contrast = request->arg("disp_cont").toInt(); - mConfig->plugin.display.disp_data = request->arg("disp_data").toInt(); - mConfig->plugin.display.disp_clk = request->arg("disp_clk").toInt(); - mConfig->plugin.display.disp_cs = request->arg("disp_cs").toInt(); - mConfig->plugin.display.disp_reset = request->arg("disp_rst").toInt(); - mConfig->plugin.display.disp_busy = request->arg("disp_bsy").toInt(); - mConfig->plugin.display.disp_dc = request->arg("disp_dc").toInt(); + mConfig->plugin.display.contrast = (mConfig->plugin.display.type == 0) ? 60 : request->arg("disp_cont").toInt(); + mConfig->plugin.display.disp_data = (mConfig->plugin.display.type == 0) ? DEF_PIN_OFF : request->arg("disp_data").toInt(); + mConfig->plugin.display.disp_clk = (mConfig->plugin.display.type == 0) ? DEF_PIN_OFF : request->arg("disp_clk").toInt(); + mConfig->plugin.display.disp_cs = (mConfig->plugin.display.type < 3) ? DEF_PIN_OFF : request->arg("disp_cs").toInt(); + mConfig->plugin.display.disp_reset = (mConfig->plugin.display.type < 3) ? DEF_PIN_OFF : request->arg("disp_rst").toInt(); + mConfig->plugin.display.disp_dc = (mConfig->plugin.display.type < 3) ? DEF_PIN_OFF : request->arg("disp_dc").toInt(); + mConfig->plugin.display.disp_busy = (mConfig->plugin.display.type < 10) ? DEF_PIN_OFF : request->arg("disp_bsy").toInt(); mApp->saveSettings();