From 320ad0e1d3182b9a8079cdd2a3c1914e84ffcef8 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Mon, 18 Nov 2024 17:09:23 +0100 Subject: [PATCH] Fix ESP32 upgrade by file upload response based on file size (#22500) --- CHANGELOG.md | 1 + RELEASENOTES.md | 1 + .../xdrv_01_9_webserver.ino | 21 +++++++++++++------ 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 01c64b5b7..50a0f8fef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ All notable changes to this project will be documented in this file. - ESP32 Platform from 2024.11.30 to 2024.11.31, Framework (Arduino Core) from v3.1.0.241030 to v3.1.0.241117 and IDF to 5.3.1.241024 (#22504) ### Fixed +- ESP32 upgrade by file upload response based on file size (#22500) ### Removed diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 297e99b85..ee2aaedf1 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -169,6 +169,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm - Mitsubishi Electric HVAC Standby Stage for MiElHVAC [#22430](https://github.com/arendst/Tasmota/issues/22430) - EQ3 TRV firmware version 1.46 fails if the default true is used in subscribe on the notify characteristic [#22328](https://github.com/arendst/Tasmota/issues/22328) - Ethernet on -DFRAMEWORK_ARDUINO_ITEAD framework regression from v14.3.0 [#22367](https://github.com/arendst/Tasmota/issues/22367) +- ESP32 Upgrade by file upload response based on file size [#22500](https://github.com/arendst/Tasmota/issues/22500) - ESP32 Arduino Core IPv6 zones used by Matter [#22378](https://github.com/arendst/Tasmota/issues/22378) - ESP32, ESP32-S2 and ESP32-S3 re-enable touch buttons [#22446](https://github.com/arendst/Tasmota/issues/22446) - ESP32-S3 UART output mode for Tx [#22426](https://github.com/arendst/Tasmota/issues/22426) diff --git a/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino b/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino index a7ad95d34..856c9a46d 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino @@ -368,23 +368,32 @@ const char HTTP_FORM_UPG[] PROGMEM = "
" "

" "
 " D_UPGRADE_BY_FILE_UPLOAD " "; -const char HTTP_FORM_RST_UPG[] PROGMEM = +const char HTTP_FORM_RST_UPG[] PROGMEM = // ESP8266 or ESP32 dual partition "
" "

" "
" + "onclick='" + "eb(\"f1\").style.display=\"none\";" // Disable display of form f1 + "eb(\"f2\").style.display=\"block\";" // Enable display of D_UPLOAD_STARTED + "this.form.action+=this.form[\"u2\"].files[0].size;" // Set return file size + "this.form.submit();" // Form response + "'>%s" "
" "" ""; // upload via factory partition -const char HTTP_FORM_RST_UPG_FCT[] PROGMEM = +const char HTTP_FORM_RST_UPG_FCT[] PROGMEM = // ESP32 safeboot partition "
" "

" "
" + "onclick='" + "eb(\"f1\").style.display=\"none\";" // Disable display of form f1 + "var fs=this.form[\"u2\"].files[0].size;" // Retreive file size of requested file + "eb((fs>900000)?\"f3\":\"f2\").style.display=\"block\";" // Enable display of either D_UPLOAD_FACTORY or D_UPLOAD_STARTED based on arbitrary file size of 900k + "this.form.action+=fs;" // Set return file size + "return upl(this);" // Form response + "'>%s" "" "" ""