diff --git a/.github/workflows/compile_development.yml b/.github/workflows/compile_development.yml index 1d536b5e..b5e0e0e1 100644 --- a/.github/workflows/compile_development.yml +++ b/.github/workflows/compile_development.yml @@ -70,6 +70,11 @@ jobs: - name: Run PlatformIO run: pio run -d src -e ${{ matrix.variant }} + - name: Compress .elf + uses: edgarrc/action-7z@v1 + with: + args: 7z a -t7z -mx=9 src/.pio/build/${{ matrix.variant }}/firmware.elf.7z ./src/.pio/build/${{ matrix.variant }}/firmware.elf + - name: Rename Firmware run: python scripts/getVersion.py ${{ matrix.variant }} >> $GITHUB_OUTPUT @@ -132,6 +137,11 @@ jobs: - name: Run PlatformIO run: pio run -d src -e ${{ matrix.variant }} + - name: Compress .elf + uses: edgarrc/action-7z@v1 + with: + args: 7z a -t7z -mx=9 src/.pio/build/${{ matrix.variant }}/firmware.elf.7z ./src/.pio/build/${{ matrix.variant }}/firmware.elf + - name: Rename Firmware run: python scripts/getVersion.py ${{ matrix.variant }} >> $GITHUB_OUTPUT @@ -188,15 +198,6 @@ jobs: with: name: dev-* - - name: Create Artifact - uses: actions/upload-artifact@v4 - with: - name: dev-${{ steps.version_name.outputs.name }} - path: | - ${{ steps.version_name.outputs.name }}/* - manual/User_Manual.md - manual/Getting_Started.md - - name: Deploy uses: nogsantos/scp-deploy@master with: @@ -206,3 +207,17 @@ jobs: port: ${{ secrets.FW_SSH_PORT }} user: ${{ secrets.FW_SSH_USER }} key: ${{ secrets.FW_SSH_KEY }} + + - name: Clean elf files (7z compressed) for Artifact + run: | + rm -f \ + ${{ steps.version_name.outputs.name }}/*/*.elf.7z + + - name: Create Artifact + uses: actions/upload-artifact@v4 + with: + name: dev-${{ steps.version_name.outputs.name }} + path: | + ${{ steps.version_name.outputs.name }}/* + manual/User_Manual.md + manual/Getting_Started.md diff --git a/scripts/getVersion.py b/scripts/getVersion.py index a60a772d..d3f1e576 100644 --- a/scripts/getVersion.py +++ b/scripts/getVersion.py @@ -76,6 +76,7 @@ def renameFw(path_define, env): fname = version[:-1] + "_" + sha + "_" + env + ".bin" os.rename("src/.pio/build/" + env + "/firmware.bin", dst + fname) + os.rename("src/.pio/build/" + env + "/firmware.elf.7z", dst + fname[:-3] + "elf.7z") if env[:5] == "esp32": os.rename("src/.pio/build/" + env + "/bootloader.bin", dst + "bootloader.bin") diff --git a/src/CHANGES.md b/src/CHANGES.md index a1b23dbc..5efb1610 100644 --- a/src/CHANGES.md +++ b/src/CHANGES.md @@ -1,5 +1,8 @@ # Development Changes +## 0.8.122 - 2024-05-23 +* add button for donwloading coredump (ESP32 variants only) + ## 0.8.121 - 2024-05-20 * fix ESP32 factory image generation * fix plot of history graph #1635 diff --git a/src/defines.h b/src/defines.h index a83d4e89..c0664b7d 100644 --- a/src/defines.h +++ b/src/defines.h @@ -13,7 +13,7 @@ //------------------------------------- #define VERSION_MAJOR 0 #define VERSION_MINOR 8 -#define VERSION_PATCH 121 +#define VERSION_PATCH 122 //------------------------------------- typedef struct { uint8_t ch; diff --git a/src/web/RestApi.h b/src/web/RestApi.h index 1070f406..6dffe3bb 100644 --- a/src/web/RestApi.h +++ b/src/web/RestApi.h @@ -55,6 +55,9 @@ class RestApi { mSrv->on("/api", HTTP_GET, std::bind(&RestApi::onApi, this, std::placeholders::_1)); mSrv->on("/get_setup", HTTP_GET, std::bind(&RestApi::onDwnldSetup, this, std::placeholders::_1)); + #if defined(ESP32) + mSrv->on("/coredump", HTTP_GET, std::bind(&RestApi::getCoreDump, this, std::placeholders::_1)); + #endif } uint32_t getTimezoneOffset(void) { @@ -348,6 +351,35 @@ class RestApi { fp.close(); } + #if defined(ESP32) + void getCoreDump(AsyncWebServerRequest *request) { + const esp_partition_t *partition = esp_partition_find_first(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_DATA_COREDUMP, "coredump"); + if (partition != NULL) { + size_t size = partition->size; + + AsyncWebServerResponse *response = request->beginResponse("application/octet-stream", size, [size, partition](uint8_t *buffer, size_t maxLen, size_t index) -> size_t { + if((index + maxLen) > size) + maxLen = size - index; + + if (ESP_OK != esp_partition_read(partition, index, buffer, maxLen)) + DPRINTLN(DBG_ERROR, F("can't read partition")); + + return maxLen; + }); + + String filename = ah::getDateTimeStrFile(gTimezone.toLocal(mApp->getTimestamp())); + filename += "_v" + String(mApp->getVersion()); + + response->addHeader("Content-Description", "File Transfer"); + response->addHeader("Content-Disposition", "attachment; filename=" + filename + "_coredump.bin"); + request->send(response); + } else { + AsyncWebServerResponse *response = request->beginResponse(200, F("application/json; charset=utf-8"), "{}"); + request->send(response); + } + } + #endif + void getGeneric(AsyncWebServerRequest *request, JsonObject obj) { mApp->resetLockTimeout(); #if !defined(ETHERNET) @@ -435,8 +467,13 @@ class RestApi { void getHtmlSystem(AsyncWebServerRequest *request, JsonObject obj) { getSysInfo(request, obj.createNestedObject(F("system"))); getGeneric(request, obj.createNestedObject(F("generic"))); + #if defined(ESP32) + char tmp[300]; + snprintf(tmp, 300, "%s

%s

%s", FACTORY_RESET, BTN_REBOOT, BTN_COREDUMP); + #else char tmp[200]; snprintf(tmp, 200, "%s

%s", FACTORY_RESET, BTN_REBOOT); + #endif obj[F("html")] = String(tmp); } diff --git a/src/web/lang.h b/src/web/lang.h index 54ade94e..dd6640b2 100644 --- a/src/web/lang.h +++ b/src/web/lang.h @@ -90,4 +90,10 @@ #define BTN_NO "no" #endif +#ifdef LANG_DE + #define BTN_COREDUMP "CoreDump herunterladen" +#else /*LANG_EN*/ + #define BTN_COREDUMP "download CoreDump" +#endif + #endif /*__LANG_H__*/