diff --git a/firmware/webtools/manifest.json b/firmware/webtools/manifest.json index 1519cd0..bb7c5e7 100644 --- a/firmware/webtools/manifest.json +++ b/firmware/webtools/manifest.json @@ -1,6 +1,6 @@ { "name": "SOTACAT for Elecraft KX2 and KX3", - "version": "2024-11-23_21:13-Release", + "version": "2024-11-25_18:51-Release", "builds": [ { "chipFamily": "ESP32-C3", diff --git a/include/build_info.h b/include/build_info.h index f772c2a..64ac226 100644 --- a/include/build_info.h +++ b/include/build_info.h @@ -1 +1 @@ -#define BUILD_DATE_TIME "241123:2113" +#define BUILD_DATE_TIME "241125:1851" diff --git a/src/web/settings.js b/src/web/settings.js index da84cb6..bf8949b 100644 --- a/src/web/settings.js +++ b/src/web/settings.js @@ -129,6 +129,7 @@ function updateButtonText() { function uploadFirmware() { const otaFileInput = document.getElementById('ota-file'); const otaStatus = document.getElementById('ota-status'); + const uploadButton = document.getElementById('upload-button'); const file = otaFileInput.files[0]; if (!file) { @@ -136,6 +137,11 @@ function uploadFirmware() { return; } + // Disable the button and update status to show upload is in progress + uploadButton.disabled = true; + uploadButton.textContent = 'Uploading firmware...'; + otaStatus.innerHTML = 'Uploading firmware... Please wait and do not refresh the page.'; + const blob = new Blob([file], { type: 'application/octet-stream' }); fetch('/api/v1/ota', { @@ -145,13 +151,23 @@ function uploadFirmware() { }) .then(response => { if (response.ok) { - // Successful OTA upload, no content returned - otaStatus.innerHTML = 'Firmware upload successful. SOTAcat will now reboot.'; - alert("Firmware upload successful.\nYour SOTAcat is rebooting with the new firmware.\nPlease restart your browser."); - return null; // No further processing needed + // Update status to show firmware is being applied + otaStatus.innerHTML = 'Firmware upload successful. Applying firmware update...'; + uploadButton.textContent = 'Applying firmware...'; + + // Show final message and alert + setTimeout(() => { + otaStatus.innerHTML = 'Firmware upload successful. SOTAcat will now reboot.'; + uploadButton.textContent = 'Upload Complete'; + alert("Firmware upload successful.\nYour SOTAcat is rebooting with the new firmware.\nPlease restart your browser."); + }, 2000); + return null; } else { - // Error occurred, expecting a JSON error message in a "text/plain" content type + // Reset button state on error + uploadButton.disabled = false; + uploadButton.textContent = 'Upload Firmware'; + return response.text().then(text => { let errorData; try { @@ -167,7 +183,11 @@ function uploadFirmware() { .catch(error => { console.error('Firmware upload error:', error); otaStatus.innerHTML = `Firmware upload failed: ${error.message}`; - alert(`Firmware upload failed: ${message.error}`); + alert(`Firmware upload failed: ${error.message}`); + + // Reset button state + uploadButton.disabled = false; + uploadButton.textContent = 'Upload Firmware'; }); }