Skip to content

Commit 7aedf77

Browse files
authored
Merge pull request #4984 from wled/copilot/fix-d4f5fc55-f916-458a-9155-deb9bbff6662
Add ESP32 bootloader upgrade capability to OTA update page with JSON API support and ESP-IDF validation
2 parents 25d5295 + 50d33c5 commit 7aedf77

File tree

6 files changed

+608
-3
lines changed

6 files changed

+608
-3
lines changed

wled00/data/update.htm

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@
2929
if (data.arch == "esp8266") {
3030
toggle('rev');
3131
}
32+
const isESP32 = data.arch && (data.arch.toLowerCase() === 'esp32' || data.arch.toLowerCase() === 'esp32-s2');
33+
if (isESP32) {
34+
gId('bootloader-section').style.display = 'block';
35+
if (data.bootloaderSHA256) {
36+
gId('bootloader-hash').innerText = 'Current bootloader SHA256: ' + data.bootloaderSHA256;
37+
}
38+
}
3239
})
3340
.catch(error => {
3441
console.log('Could not fetch device info:', error);
@@ -42,8 +49,7 @@
4249
@import url("style.css");
4350
</style>
4451
</head>
45-
46-
<body onload="GetV()">
52+
<body onload="GetV();">
4753
<h2>WLED Software Update</h2>
4854
<form method='POST' action='./update' id='upd' enctype='multipart/form-data' onsubmit="toggle('upd')">
4955
Installed version: <span class="sip installed-version">Loading...</span><br>
@@ -60,6 +66,16 @@ <h2>WLED Software Update</h2>
6066
<button id="rev" type="button" onclick="cR()">Revert update</button><br>
6167
<button type="button" onclick="B()">Back</button>
6268
</form>
69+
<div id="bootloader-section" style="display:none;">
70+
<hr class="sml">
71+
<h2>ESP32 Bootloader Update</h2>
72+
<div id="bootloader-hash" class="sip" style="margin-bottom:8px;"></div>
73+
<form method='POST' action='./updatebootloader' id='bootupd' enctype='multipart/form-data' onsubmit="toggle('bootupd')">
74+
<b>Warning:</b> Only upload verified ESP32 bootloader files!<br>
75+
<input type='file' name='update' required><br>
76+
<button type="submit">Update Bootloader</button>
77+
</form>
78+
</div>
6379
<div id="Noupd" class="hide"><b>Updating...</b><br>Please do not close or refresh the page :)</div>
6480
</body>
6581
</html>

wled00/json.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -820,6 +820,9 @@ void serializeInfo(JsonObject root)
820820
root[F("resetReason1")] = (int)rtc_get_reset_reason(1);
821821
#endif
822822
root[F("lwip")] = 0; //deprecated
823+
#ifndef WLED_DISABLE_OTA
824+
root[F("bootloaderSHA256")] = getBootloaderSHA256Hex();
825+
#endif
823826
#else
824827
root[F("arch")] = "esp8266";
825828
root[F("core")] = ESP.getCoreVersion();

0 commit comments

Comments
 (0)