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