feat(ota): firmware update via web (/update page)#358
Open
wendells01 wants to merge 2 commits into
Open
Conversation
- New /update upload form at <device-ip>/update - Binary validation (extension + min size) - OTA progress bar on TFT display during update - Uses existing A/B partition scheme (safe rollback) - Nav links added to Status, Config and Memory pages
…Length request->contentLength() returns the full multipart form body size (including boundaries/headers), not the actual firmware binary. Update.begin() rejected the mismatch with 'Bad Size Given'. Now uses UPDATE_SIZE_UNKNOWN + tracks total bytes written to validate minimum size at the end.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR: Over-the-Air (OTA) firmware update via WebUI
Summary
Adds a
/updateweb page that accepts a.binfirmware binary via HTTP POST and applies it using the existing A/B OTA partition scheme. A progress bar is shown on the TFT display during the update.What was changed
3 files changed, +167 lines, 0 OBD code.
ats-mini/Common.h(+2 lines)extern volatile int otaProgress— shared state between Network.cpp (update handler) and Draw.cpp (rendering), tracks progress from -1 (idle) to 100 (complete).ats-mini/Draw.cpp(+27 lines)drawScreen(), checksotaProgress >= 0— if an update is active, the entire screen is replaced with a dedicated OTA screen showing:otaProgress, anddrawScreen()renders it on the next frame.ats-mini/Network.cpp(+138 lines)#include <Update.h>— ESP32's OTA librarywebUpdatePage()— HTML page with a file upload form (accepts.binonly), "Update" nav link on Status/Config/Memory pages/updateGET handler — serves the upload form/updatePOST handler (multi-part body handler):.binfiles and binaries smaller than 100KB (safety guard)Update.write(data, len)for each chunk; tracks progress as percentage viaUpdate.size()Update.end(true)to apply; reboots on successotaProgressglobal, whichdrawScreen()reads on every frameHow to use
.binwill be in the build output)http://<device-ip>/http://<device-ip>/update.binfirmware file (e.g.,firmware.ino.esp32s3.bin)Compatibility
Update.begin(UPDATE_SIZE_UNKNOWN, U_FLASH)— compatible with all ESP32-S3 board profiles (ospi, qspi, lilygo-t-embed)Files NOT modified (for reviewer confidence)