feat: firmware update via Web UI (OTA upload, URL download, UF2, rollback)#3
Open
feat: firmware update via Web UI (OTA upload, URL download, UF2, rollback)#3
Conversation
…rollback, UF2 Implements 6 HTTP handlers in api_firmware.c: - GET /api/firmware/status: version, partition, OTA state, progress - POST /api/firmware/upload: chunked binary OTA via httpd_req_recv - POST /api/firmware/url: async OTA download via esp_http_client task - POST /api/firmware/rollback: mark app invalid and reboot - POST /api/firmware/uf2: enter USB UF2 bootloader mode - POST /api/firmware/confirm: mark running app as valid
After WiFi and VPN initialization, check if the running firmware is pending OTA verification. If so, poll for network connectivity (STA connected or AP mode) up to a configurable timeout. On success, mark the firmware valid; on timeout, reboot to trigger automatic rollback to the previous firmware.
- Remove racy ota_init_once(); add api_firmware_init() called from webui_init() - Add Content-Length check at start of upload handler - Add URL length and scheme validation in URL download handler - Add 10s stall protection in download task (zero_count > 100) - Move OTA rollback check after webui_start() for web-based confirmation - Bump max_uri_handlers from 32 to 40 - Disable upload/download buttons in frontend when OTA is busy
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.
Summary
Firmware.sveltepage with drag-and-drop upload, URL input, progress bar, rollback and confirm buttonsChanges
api_firmware.c(new) — 6 HTTP handlers: status, upload, URL download, rollback, UF2 reboot, confirmFirmware.svelte(new) — Full firmware management UI page with CRT terminal thememain.c— OTA rollback confirmation based on network activity (STA connected or AP started)parameters.yaml— Newota_confirm_timeout_sparameter (default 60s, range 10-300s)types.ts/api.ts— FirmwareStatus type and 6 API client methodsCMakeLists.txt— Added esp_http_client, app_update, keyer_usb dependenciessdkconfig.defaults— Allow HTTP for OTA (CONFIG_ESP_HTTPS_OTA_ALLOW_HTTP=y)Design docs
docs/plans/2026-03-03-firmware-update-design.mddocs/plans/2026-03-03-firmware-update-plan.mdTest plan
/api/firmware/confirm🤖 Generated with Claude Code