OTA update tweaks

This commit is contained in:
Nic Limper
2025-03-28 10:47:48 +01:00
parent e102f8e4e9
commit 87ce6d949d
7 changed files with 85 additions and 72 deletions

View File

@@ -10,6 +10,7 @@
"/www/painter.js",
"/www/setup.html",
"/www/setup.js",
"/www/flash.js",
"/www/upload-demo.html"
]
}

Binary file not shown.

Binary file not shown.

View File

@@ -530,6 +530,9 @@ options:
<button id="confirmSelectRepo">Confirm</button><button id="cancelSelectRepo">Cancel</button>
</div>
<h4>Releases</h4>
To update to the latest version, use the big 'update now' button if it is shown on top of this screen.<br>
To up/downgrade to other versions: for the smoothest experience, first update the ESP32 part and<br>
without rebooting, update the filesystem, then reboot the AP and reload the webpage.<br>
<div id="releasetable" class="releasetable"></div>
<h4 id="radio_release_title"></h4>
<div id="radio_releasetable" class="releasetable"></div>

View File

@@ -494,6 +494,12 @@ function updatecards() {
} else {
// $('#tag' + tagmac + ' .nextcheckin').innerHTML = "";
}
if (item.dataset.nextupdate < (Date.now() / 1000) - servertimediff) {
$('#tag' + tagmac + ' .waitingicon').style.display = 'inline-block';
} else {
$('#tag' + tagmac + ' .waitingicon').style.display = 'none';
}
})
$('#dashboardTagCount').innerHTML = tagcount;

View File

@@ -71,13 +71,15 @@ export async function initUpdate() {
print(`current env: ${sdata.env}`);
print(`build date: ${formatEpoch(sdata.buildtime)}`);
print(`esp32 version: ${sdata.buildversion}`);
if(gModuleType != '') {
var hex_ver = '0000' + sdata.ap_version.toString(16);
print(`${gModuleType} version: ${hex_ver.slice(-4)}`);
}
print(`filesystem version: ${filesystemversion}`);
print(`psram size: ${sdata.psramsize}`);
print(`flash size: ${sdata.flashsize}`);
if (gModuleType !== '') {
let hex_ver = sdata.ap_version && !isNaN(sdata.ap_version)
? ('0000' + sdata.ap_version.toString(16)).slice(-4)
: 'unknown';
print(`${gModuleType} version: ${hex_ver}`);
}
print("--------------------------", "gray");
env = apConfig.env || sdata.env;
if (sdata.env != env) {
@@ -137,7 +139,7 @@ export async function initUpdate() {
releaseDetails.forEach(release => {
if (rowCounter < 4 && release?.html_url) {
const tableRow = document.createElement('tr');
let tablerow = `<td><a href="${release.html_url}" target="_new">${release.tag_name}</a></td><td>${release.date}</td><td>${release.name}</td><td><button type="button" onclick="otamodule.updateWebpage('${release.file_url}','${release.tag_name}', true)">Filesystem</button></td><td><button type="button" onclick="otamodule.updateESP('${release.bin_url}', true)">ESP32</button></td>`;
let tablerow = `<td><a href="${release.html_url}" target="_new">${release.tag_name}</a></td><td>${release.date}</td><td>${release.name}</td><td><button type="button" onclick="otamodule.updateESP('${release.bin_url}', true)">ESP32</button></td><td><button type="button" onclick="otamodule.updateWebpage('${release.file_url}','${release.tag_name}', true)">Filesystem</button></td>`;
if (release.tag_name == currentVer) {
tablerow += "<td>current version</td>";
} else if (release.date < formatEpoch(currentBuildtime)) {
@@ -177,7 +179,8 @@ export async function initUpdate() {
firmwareVer = await fetch(firmwareUrl, { method: 'GET' })
.then(function (response) { return response.json(); })
.then(function (response) {
return response[2]['version']; })
return response[2]['version'];
})
.catch(error => {
print('Error fetching releases:' + error, "red");
});