From 3647c6aead443843d036118e238e3dfd91768aad Mon Sep 17 00:00:00 2001 From: xyzroe Date: Sat, 28 Sep 2024 17:02:00 +0200 Subject: [PATCH] 20240928 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### BETA RELEASE, USE ON YOUR OWN RISK #### Don't support ESP32-­SOLO-­1 boards. (ESP32-S0WD) Because of switching to original Espressif Arduino framework #### Updates and Improvements - Updated PlatformIO to 6.1.15 - Switched to espressif32@6.8.1 - Switched to mathieucarbou/AsyncTCP@3.2.5 - Switched to robtillaart/DS18B20@^0.2.3 - Removed sstaub/Ticker, now using built-in from arduino-esp32 - Reworked code to run on Arduino ESP32 3.0.5 based on the ESP-IDF v5.1.4 #### New Features - Added update notification to HA for ESP and Radio firmwares - Support for WPA3 - Support for local IPv6 (only on ETH) - Added firewall mask (now supports more than one allowed IP) - Added DNS resolving check before trying to update Zigbee or ESP32 #### Optimizations - Reworked FS size calculation - Optimized memory usage by MQTT - Shortened booting time - Reworked OTA updating files structure and xzg.json file - Moved hardware config to NV storage (auto import from file and remove after) - Moved all web files to FS #### Fixes - Fixed very long load if no Zigbee firmware answer - Removed loading of old config files (used before XZG firmware) - Removed check and restore DNS, showing real current DNS on the main page #### Scripts and Build - Reworked gulp and build scripts to build XZG_*.fs.bin file - Reworked build_html.py - gulp to data folder, build fs file - Reworked build.py - creates 3 release files (full, ota, fs) #### Miscellaneous - Automatic WiFi and MQTT disabling while RCP (Zigbee) is flashing, but sometimes you still need to totally disable MQTT in settings. xyzroe xyzroe committed 1 hour ago · --- .github/workflows/build_fw.yml | 4 ++-- src/main.cpp | 26 +++++++++++++++++++++++--- src/main.h | 5 +++++ src/version.h | 2 +- src/web.cpp | 6 +++--- 5 files changed, 34 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build_fw.yml b/.github/workflows/build_fw.yml index 1c3f9f6..681bfee 100644 --- a/.github/workflows/build_fw.yml +++ b/.github/workflows/build_fw.yml @@ -155,8 +155,8 @@ jobs: - name: Copy file to latest release directory run: | cp xzg.json releases/latest/ - cp ./bin/XZG_${{ steps.get_tag.outputs.tag }}.ota.bin releases/latest/XZG.ota.bin - cp ./bin/XZG_${{ steps.get_tag.outputs.tag }}.fs.bin releases/latest/XZG.fs.bin + # cp ./bin/XZG_${{ steps.get_tag.outputs.tag }}.ota.bin releases/latest/XZG.ota.bin + # cp ./bin/XZG_${{ steps.get_tag.outputs.tag }}.fs.bin releases/latest/XZG.fs.bin echo "File copied to latest release directory." - name: Commit and push files to releases branch diff --git a/src/main.cpp b/src/main.cpp index 42799fb..f2325b3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -57,7 +57,6 @@ bool updWeb = false; int networkOverseerCounter = 0; - // Ticker tmrNetworkOverseer(handleTmrNetworkOverseer, overseerInterval, 0, MILLIS); Ticker tmrNetworkOverseer; @@ -644,6 +643,19 @@ void setupCoordinatorMode() } } +void getEspUpdateTask(void *pvParameters) +{ + TaskParams *params = static_cast(pvParameters); + getEspUpdate(params->url); + vTaskDelete(NULL); +} + +void timerCallback(TimerHandle_t xTimer) +{ + TaskParams *params = static_cast(pvTimerGetTimerID(xTimer)); + xTaskCreate(getEspUpdateTask, "getEspUpdateTask", 8192, params, 1, NULL); +} + void checkFileSys() { FirmwareInfo fwInfo = fetchLatestEspFw("fs"); @@ -668,10 +680,18 @@ void checkFileSys() commitFile.close(); } - if (vars.needFsDownload) + if (vars.needFsDownload && 1 > 2) { LOGI("Downloading FS"); - getEspUpdate(fwInfo.url); + + static String urlString = fwInfo.url; + static TaskParams params = {urlString.c_str()}; + + TimerHandle_t timer = xTimerCreate("StartTaskTimer", pdMS_TO_TICKS(5000), pdFALSE, ¶ms, timerCallback); + if (timer != NULL) + { + xTimerStart(timer, 0); + } } } diff --git a/src/main.h b/src/main.h index c95453d..847ff61 100644 --- a/src/main.h +++ b/src/main.h @@ -15,5 +15,10 @@ void startAP(const bool start); void stopWifi(); void checkFileSys(); +struct TaskParams +{ + const char *url; +}; + #endif // MAIN_H \ No newline at end of file diff --git a/src/version.h b/src/version.h index 427acb3..d7dd27e 100644 --- a/src/version.h +++ b/src/version.h @@ -1,4 +1,4 @@ // AUTO GENERATED FILE #ifndef VERSION - #define VERSION "20240928.1" + #define VERSION "20240928" #endif diff --git a/src/web.cpp b/src/web.cpp index 6b0e15a..3884656 100644 --- a/src/web.cpp +++ b/src/web.cpp @@ -630,7 +630,7 @@ static void apiCmdUpdateUrl(String &result) if (serverWeb.hasArg(argType)) { // String link = fetchLatestEspFw(); - FirmwareInfo fwInfo = fetchLatestEspFw(); + FirmwareInfo fwInfo = fetchLatestEspFw(serverWeb.arg(argType)); if (fwInfo.url) { getEspUpdate(fwInfo.url); @@ -2227,8 +2227,8 @@ FirmwareInfo fetchLatestEspFw(String type) if (release.containsKey("version")) { info.version = release["version"].as(); - //info.url = "https://github.com/xyzroe/XZG/releases/download/" + info.version + "/XZG_" + info.version + "." + type + ".bin"; - info.url = "https://raw.githubusercontent.com/xyzroe/XZG/refs/heads/releases/latest/XZG." + type + ".bin"; + info.url = "https://github.com/xyzroe/XZG/releases/download/" + info.version + "/XZG_" + info.version + "." + type + ".bin"; + //info.url = "https://raw.githubusercontent.com/xyzroe/XZG/refs/heads/releases/latest/XZG." + type + ".bin"; LOGD("Latest version: %s | url %s", info.version.c_str(), info.url.c_str()); } else