From a7702437f1e3031b52d5ac50cb6ea2312cbdbbf4 Mon Sep 17 00:00:00 2001 From: lumapu Date: Sun, 11 Aug 2024 00:01:19 +0200 Subject: [PATCH] 0.8.134 * combined Ethernet and WiFi variants - Ethernet is now always included, but needs to be enabled if needed * improved statistic data in `/system` --- .github/workflows/compile_development.yml | 6 -- src/CHANGES.md | 4 + src/config/settings.h | 12 --- src/defines.h | 2 +- src/platformio.ini | 89 +++++------------------ src/web/RestApi.h | 77 +++++++++++++++++--- 6 files changed, 92 insertions(+), 98 deletions(-) diff --git a/.github/workflows/compile_development.yml b/.github/workflows/compile_development.yml index 223a7a39..9b3b68b3 100644 --- a/.github/workflows/compile_development.yml +++ b/.github/workflows/compile_development.yml @@ -24,9 +24,7 @@ jobs: matrix: variant: - opendtufusion - - opendtufusion-ethernet - opendtufusion-16MB - - opendtufusion-ethernet-16MB - esp8266 - esp8266-all - esp8266-minimal @@ -35,7 +33,6 @@ jobs: - esp32-wroom32 - esp32-wroom32-minimal - esp32-wroom32-prometheus - - esp32-wroom32-ethernet - esp32-s2-mini - esp32-c3-mini steps: @@ -95,16 +92,13 @@ jobs: matrix: variant: - opendtufusion-de - - opendtufusion-ethernet-de - opendtufusion-16MB-de - - opendtufusion-ethernet-16MB-de - esp8266-de - esp8266-all-de - esp8266-prometheus-de - esp8285-de - esp32-wroom32-de - esp32-wroom32-prometheus-de - - esp32-wroom32-ethernet-de - esp32-s2-mini-de - esp32-c3-mini-de steps: diff --git a/src/CHANGES.md b/src/CHANGES.md index b582fc99..c03de595 100644 --- a/src/CHANGES.md +++ b/src/CHANGES.md @@ -1,5 +1,9 @@ # Development Changes +## 0.8.134 - 2024-08-10 +* combined Ethernet and WiFi variants - Ethernet is now always included, but needs to be enabled if needed +* improved statistic data in `/system` + ## 0.8.133 - 2024-08-10 * Ethernet variants now support WiFi as fall back / configuration diff --git a/src/config/settings.h b/src/config/settings.h index bbbf2507..0d8970d5 100644 --- a/src/config/settings.h +++ b/src/config/settings.h @@ -282,19 +282,7 @@ class settings { return mLastSaveSucceed; } - void getInfo(uint32_t *used, uint32_t *size) { - #if !defined(ESP32) - FSInfo info; - LittleFS.info(info); - *used = info.usedBytes; - *size = info.totalBytes; - DPRINTLN(DBG_INFO, F("-- FILESYSTEM INFO --")); - DPRINTLN(DBG_INFO, String(info.usedBytes) + F(" of ") + String(info.totalBytes) + F(" used")); - #else - DPRINTLN(DBG_WARN, F("not supported by ESP32")); - #endif - } bool readSettings(const char* path) { loadDefaults(); diff --git a/src/defines.h b/src/defines.h index 73385086..6e043ecb 100644 --- a/src/defines.h +++ b/src/defines.h @@ -13,7 +13,7 @@ //------------------------------------- #define VERSION_MAJOR 0 #define VERSION_MINOR 8 -#define VERSION_PATCH 133 +#define VERSION_PATCH 134 //------------------------------------- typedef struct { uint8_t ch; diff --git a/src/platformio.ini b/src/platformio.ini index ffdbd1f7..d539f89c 100644 --- a/src/platformio.ini +++ b/src/platformio.ini @@ -164,6 +164,24 @@ build_flags = ${env:esp32-wroom32-minimal.build_flags} -DENABLE_MQTT -DPLUGIN_DISPLAY -DENABLE_HISTORY + -DETHERNET + -DDEF_ETH_CS_PIN=15 + -DDEF_ETH_SCK_PIN=14 + -DDEF_ETH_MISO_PIN=12 + -DDEF_ETH_MOSI_PIN=13 + -DDEF_ETH_IRQ_PIN=4 + -DDEF_ETH_RST_PIN=255 + -DDEF_NRF_CS_PIN=5 + -DDEF_NRF_CE_PIN=17 + -DDEF_NRF_IRQ_PIN=16 + -DDEF_NRF_MISO_PIN=19 + -DDEF_NRF_MOSI_PIN=23 + -DDEF_NRF_SCLK_PIN=18 + -DDEF_CMT_CSB=27 + -DDEF_CMT_FCSB=26 + -DDEF_CMT_IRQ=34 + -DDEF_CMT_SDIO=14 + -DDEF_CMT_SCLK=12 monitor_filters = esp32_exception_decoder @@ -191,34 +209,6 @@ build_flags = ${env:esp32-wroom32-prometheus.build_flags} monitor_filters = esp32_exception_decoder -[env:esp32-wroom32-ethernet] -platform = espressif32 -board = lolin_d32 -build_flags = ${env:esp32-wroom32.build_flags} - -DETHERNET - -DDEF_ETH_CS_PIN=15 - -DDEF_ETH_SCK_PIN=14 - -DDEF_ETH_MISO_PIN=12 - -DDEF_ETH_MOSI_PIN=13 - -DDEF_ETH_IRQ_PIN=4 - -DDEF_ETH_RST_PIN=255 - -DDEF_NRF_CS_PIN=5 - -DDEF_NRF_CE_PIN=17 - -DDEF_NRF_IRQ_PIN=16 - -DDEF_NRF_MISO_PIN=19 - -DDEF_NRF_MOSI_PIN=23 - -DDEF_NRF_SCLK_PIN=18 -monitor_filters = - esp32_exception_decoder - -[env:esp32-wroom32-ethernet-de] -platform = espressif32 -board = lolin_d32 -build_flags = ${env:esp32-wroom32-ethernet.build_flags} - -DLANG_DE -monitor_filters = - esp32_exception_decoder - [env:esp32-s2-mini] platform = espressif32@6.7.0 board = lolin_s2_mini @@ -310,26 +300,6 @@ monitor_filters = platform = espressif32@6.7.0 board = esp32-s3-devkitc-1 upload_protocol = esp-builtin -build_flags = ${env:opendtufusion-minimal.build_flags} - -DENABLE_MQTT - -DPLUGIN_DISPLAY - -DENABLE_HISTORY -monitor_filters = - esp32_exception_decoder, colorize - -[env:opendtufusion-de] -platform = espressif32@6.7.0 -board = esp32-s3-devkitc-1 -upload_protocol = esp-builtin -build_flags = ${env:opendtufusion.build_flags} - -DLANG_DE -monitor_filters = - esp32_exception_decoder, colorize - -[env:opendtufusion-ethernet] -platform = espressif32@6.7.0 -board = esp32-s3-devkitc-1 -upload_protocol = esp-builtin build_flags = ${env:opendtufusion-minimal.build_flags} -DETHERNET -DENABLE_MQTT @@ -341,15 +311,14 @@ build_flags = ${env:opendtufusion-minimal.build_flags} -DDEF_ETH_MOSI_PIN=40 -DDEF_ETH_IRQ_PIN=44 -DDEF_ETH_RST_PIN=43 - -DDEF_ETH_ENABLED monitor_filters = esp32_exception_decoder, colorize -[env:opendtufusion-ethernet-de] +[env:opendtufusion-de] platform = espressif32@6.7.0 board = esp32-s3-devkitc-1 upload_protocol = esp-builtin -build_flags = ${env:opendtufusion-ethernet.build_flags} +build_flags = ${env:opendtufusion.build_flags} -DLANG_DE monitor_filters = esp32_exception_decoder, colorize @@ -371,21 +340,3 @@ build_flags = ${env:opendtufusion-16MB.build_flags} -DLANG_DE monitor_filters = esp32_exception_decoder, colorize - -[env:opendtufusion-ethernet-16MB] -platform = espressif32@6.7.0 -board = esp32-s3-devkitc-1 -board_upload.flash_size = 16MB -upload_protocol = esp-builtin -build_flags = ${env:opendtufusion-ethernet.build_flags} -monitor_filters = - esp32_exception_decoder, colorize - -[env:opendtufusion-ethernet-16MB-de] -platform = espressif32@6.7.0 -board = esp32-s3-devkitc-1 -upload_protocol = esp-builtin -build_flags = ${env:opendtufusion-ethernet-16MB.build_flags} - -DLANG_DE -monitor_filters = - esp32_exception_decoder, colorize diff --git a/src/web/RestApi.h b/src/web/RestApi.h index 902aa671..8f48d395 100644 --- a/src/web/RestApi.h +++ b/src/web/RestApi.h @@ -81,6 +81,12 @@ class RestApi { #ifndef ESP32 mHeapFreeBlk = ESP.getMaxFreeBlockSize(); mHeapFrag = ESP.getHeapFragmentation(); + #else + mHeapFreeBlk = heap_caps_get_largest_free_block(MALLOC_CAP_DEFAULT); + if(mHeapFree > 0) + mHeapFrag = 100 - ((mHeapFreeBlk * 100) / mHeapFree); + else + mHeapFrag = 0; #endif #if defined(ESP32) @@ -422,8 +428,6 @@ class RestApi { obj[F("sdk")] = ESP.getSdkVersion(); obj[F("cpu_freq")] = ESP.getCpuFreqMHz(); obj[F("heap_free")] = mHeapFree; - obj[F("sketch_total")] = ESP.getFreeSketchSpace(); - obj[F("sketch_used")] = ESP.getSketchSize() / 1024; // in kb getGeneric(request, obj); getRadioNrf(obj.createNestedObject(F("radioNrf"))); @@ -436,29 +440,82 @@ class RestApi { getEthernetInfo(obj.createNestedObject(F("eth"))); #endif + obj[F("heap_frag")] = mHeapFrag; + obj[F("max_free_blk")] = mHeapFreeBlk; + #if defined(ESP32) obj[F("chip_revision")] = ESP.getChipRevision(); obj[F("chip_model")] = ESP.getChipModel(); obj[F("chip_cores")] = ESP.getChipCores(); obj[F("heap_total")] = ESP.getHeapSize(); //obj[F("core_version")] = F("n/a"); - //obj[F("flash_size")] = F("n/a"); - //obj[F("heap_frag")] = F("n/a"); - //obj[F("max_free_blk")] = F("n/a"); - //obj[F("reboot_reason")] = F("n/a"); + + esp_reset_reason_t reason = esp_reset_reason(); + + // Reboot-Grund ausgeben + switch (reason) { + default: + [[fallthrough]]; + case ESP_RST_UNKNOWN: + obj[F("reboot_reason")] = F("Unknown"); + break; + case ESP_RST_POWERON: + obj[F("reboot_reason")] = F("Power on"); + break; + case ESP_RST_EXT: + obj[F("reboot_reason")] = F("External"); + break; + case ESP_RST_SW: + obj[F("reboot_reason")] = F("Software"); + break; + case ESP_RST_PANIC: + obj[F("reboot_reason")] = F("Panic"); + break; + case ESP_RST_INT_WDT: + obj[F("reboot_reason")] = F("Interrupt Watchdog"); + break; + case ESP_RST_TASK_WDT: + obj[F("reboot_reason")] = F("Task Watchdog"); + break; + case ESP_RST_WDT: + obj[F("reboot_reason")] = F("Watchdog"); + break; + case ESP_RST_DEEPSLEEP: + obj[F("reboot_reason")] = F("Deepsleep"); + break; + case ESP_RST_BROWNOUT: + obj[F("reboot_reason")] = F("Brownout"); + break; + case ESP_RST_SDIO: + obj[F("reboot_reason")] = F("SDIO"); + break; + } + + const esp_partition_t *partition = esp_partition_find_first(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_DATA_COREDUMP, "coredump"); + if (partition != NULL) + obj[F("flash_size")] = partition->address + partition->size; #else //obj[F("heap_total")] = F("n/a"); //obj[F("chip_revision")] = F("n/a"); //obj[F("chip_model")] = F("n/a"); //obj[F("chip_cores")] = F("n/a"); - obj[F("heap_frag")] = mHeapFrag; - obj[F("max_free_blk")] = mHeapFreeBlk; obj[F("core_version")] = ESP.getCoreVersion(); obj[F("flash_size")] = ESP.getFlashChipRealSize() / 1024; // in kb obj[F("reboot_reason")] = ESP.getResetReason(); #endif - //obj[F("littlefs_total")] = LittleFS.totalBytes(); - //obj[F("littlefs_used")] = LittleFS.usedBytes(); + + #if !defined(ESP32) + FSInfo info; + LittleFS.info(info); + obj[F("par_used_spiffs")] = info.usedBytes; + obj[F("par_size_spiffs")] = info.totalBytes; + #else + obj[F("par_size_spiffs")] = LittleFS.totalBytes(); + obj[F("par_used_spiffs")] = LittleFS.usedBytes(); + #endif + + obj[F("par_size_app0")] = ESP.getFreeSketchSpace(); + obj[F("par_used_app0")] = ESP.getSketchSize(); /*uint8_t max; mApp->getSchedulerInfo(&max);