Fix ESP32 upgrade by file upload response based on file size (#22500)

This commit is contained in:
Theo Arends 2024-11-18 17:09:23 +01:00
parent 3114c75a1d
commit 320ad0e1d3
3 changed files with 17 additions and 6 deletions

View File

@ -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

View File

@ -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)

View File

@ -368,23 +368,32 @@ const char HTTP_FORM_UPG[] PROGMEM =
"<br><button type='submit'>" D_START_UPGRADE "</button></form>"
"</fieldset><br><br>"
"<fieldset><legend><b>&nbsp;" D_UPGRADE_BY_FILE_UPLOAD "&nbsp;</b></legend>";
const char HTTP_FORM_RST_UPG[] PROGMEM =
const char HTTP_FORM_RST_UPG[] PROGMEM = // ESP8266 or ESP32 dual partition
"<form method='post' action='u2?fsz=' enctype='multipart/form-data'>"
"<br><input type='file' name='u2'><br>"
"<br><button type='submit' "
"onclick='eb(\"f1\").style.display=\"none\";eb(\"f2\").style.display=\"block\";this.form.action+=this.form[\"u2\"].files[0].size;this.form.submit();'"
">%s</button></form>"
"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</button></form>"
"</fieldset>"
"</div>"
"<div id='f2' style='display:none;text-align:center;'><b>" D_UPLOAD_STARTED "...</b></div>";
// upload via factory partition
const char HTTP_FORM_RST_UPG_FCT[] PROGMEM =
const char HTTP_FORM_RST_UPG_FCT[] PROGMEM = // ESP32 safeboot partition
"<form method='post' action='u2?fsz=' enctype='multipart/form-data'>"
"<br><input type='file' name='u2'><br>"
"<br><button type='submit' "
"onclick='eb(\"f1\").style.display=\"none\";eb(\"f3\").style.display=\"block\";this.form.action+=this.form[\"u2\"].files[0].size;return upl(this);'"
">%s</button></form>"
"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</button></form>"
"</fieldset>"
"</div>"
"<div id='f3' style='display:none;text-align:center;'><b>" D_UPLOAD_FACTORY "...</b></div>"