mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2026-10-31 13:52:15 +01:00
fix: review fixes for the OTA slot
- The field is hasOtaSlot, like hasEthernet and the other "has" bools. - The web UI shows the device's reason for any failed upload, not only for /restore, so it shows "no OTA slot" from a page that missed the header. The update routes' 500 replies give Update.errorString() instead of an empty reason. - Native: the writer leaves hasOtaSlot out when true and writes "os":0. - e2e: header() next to uptime(); the test skips on firmware without the field instead of failing, and matches the reason loosely. The README says what the test sends. - PROTOCOL.md and the comments name only the builds that exist. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
5721d34a34
commit
657b345eaf
13 changed files with 41 additions and 38 deletions
|
|
@ -4171,7 +4171,7 @@ class Firmware {
|
|||
updateFirmware() {
|
||||
let chip = document.getElementById('divContainer').getAttribute('data-chipmodel') || '';
|
||||
// Firmware from before the field leaves it out: undefined, not false.
|
||||
if (proto.model.header.otaSlot === false) {
|
||||
if (proto.model.header.hasOtaSlot === false) {
|
||||
ui.infoMessage(`This device has no OTA slot, so its firmware is flashed over USB with SomfyController.onboard.esp32${chip}.bin. That image holds the web UI and an empty configuration too, so take a backup first and restore it afterwards.`);
|
||||
return;
|
||||
}
|
||||
|
|
@ -4307,18 +4307,15 @@ class Firmware {
|
|||
security.tokenRefused();
|
||||
return;
|
||||
}
|
||||
if (service !== '/restore' && (xhr.status < 200 || xhr.status >= 300)) {
|
||||
ui.errorMessage(el, `The upload failed (${xhr.status}).`);
|
||||
if (xhr.status < 200 || xhr.status >= 300) {
|
||||
// The device's reason, when it sent one.
|
||||
let desc = `The upload failed (${xhr.status}).`;
|
||||
try { desc = JSON.parse(xhr.responseText).desc || desc; } catch (e) { }
|
||||
ui.errorMessage(el, desc);
|
||||
return;
|
||||
}
|
||||
switch (service) {
|
||||
case '/restore':
|
||||
if (xhr.status < 200 || xhr.status >= 300) {
|
||||
let desc = 'The restore failed.';
|
||||
try { desc = JSON.parse(xhr.responseText).desc || desc; } catch (e) { }
|
||||
ui.errorMessage(el, desc);
|
||||
break;
|
||||
}
|
||||
(async () => {
|
||||
await somfy.init();
|
||||
if (document.getElementById('divUploadFile')) document.getElementById('divUploadFile').remove();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue