-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Add ESP32 bootloader upgrade capability to OTA update page with JSON API support #4984
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the Note Free review on us!CodeRabbit is offering free reviews until Wed Oct 08 2025 to showcase some of the refinements we've made. Comment |
Co-authored-by: netmindz <[email protected]>
Co-authored-by: netmindz <[email protected]>
…perations Co-authored-by: netmindz <[email protected]>
@copilot you failed to actually run |
…laration Co-authored-by: netmindz <[email protected]>
Fixed in commit c3e1890. Both ESP32 ( |
@copilot esp32c3dev environment fails to compile |
Co-authored-by: netmindz <[email protected]>
@copilot - it appears the injection of |
…V() injection removal Co-authored-by: netmindz <[email protected]>
Fixed in commit f5f3fc3. The bootloader JavaScript code is now in a separate |
This is going to conflict terribly with #4960, which rewrote the state management of |
Arg, it's worse than that - the AI has splattered a bunch of OTA-related code in |
yeah that's fine, we can just use a PoC of if we can do an ota style upgrade @willmmiles |
Thanks :) If you don't mind, I won't bother with line-by-line review comments until we're closer to real integration. No point in polishing now if we're going to re-do it later. |
|
||
// Erase bootloader region (32KB) | ||
DEBUG_PRINTLN(F("Erasing bootloader region...")); | ||
esp_err_t err = esp_flash_erase_region(NULL, bootloaderOffset, maxBootloaderSize); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's unsafe to erase anything while the upload is incomplete. The bootloader should fit in a buffer in RAM; ensure the data is fully is ready before making any irreversible changes to the flash.
I'm unable to perform git rebase operations directly. A rebase would need to be done manually by fetching PR #4960's branch and rebasing this branch on top of it. Once #4960 is merged, I can help refactor the code to move OTA logic to |
ESP32 Bootloader Update Feature ✨
This PR implements the ability to upgrade ESP32 bootloader directly from the WLED OTA update page, with JSON API support for querying the current bootloader SHA256 digest.
📋 Requirements Implemented
✅ Manual OTA Update Page Enhancement
/update
page✅ Bootloader Verification & Validation
✅ Bootloader Flash Implementation
esp_flash_write()
andesp_flash_erase_region()
✅ JSON API Enhancement
bootloaderSHA256
field to/json/info
endpoint📁 Files Modified (4 files, +199 lines)
wled00/wled_server.cpp
/updatebootloader
endpoint)wled00/data/update.htm
wled00/json.cpp
bootloaderSHA256
field)wled00/fcn_declare.h
🧪 Build Verification
✅ ESP32 Build (esp32dev):
✅ ESP32-C3 Build (esp32c3dev):
✅ ESP8266 Build (nodemcuv2):
✅ Tests:
🎨 UI Screenshots
Update Page - Initial State (ESP8266 or before ESP32 detection):

Update Page - ESP32 with Bootloader Section:

🔧 Technical Implementation
Bootloader Flash Layout
Security Measures
Flash Operations
Performance
JavaScript Injection Handling
<script>
blockGetV()
function injection during build📖 API Usage
Get Bootloader SHA256:
Upload New Bootloader:
curl -F "[email protected]" http://wled.local/updatebootloader
JSON Response Format:
Safety Features
Known Limitations
Recommendations for Users
Original prompt
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.