Skip to content

fix(esp32): reset asks first, and again for another box's backup - #360

Open
Oaradla wants to merge 3 commits into
toniebox-reverse-engineering:developfrom
Oaradla:fix/esp32-flasher-reset
Open

Oaradla wants to merge 3 commits into
toniebox-reverse-engineering:developfrom
Oaradla:fix/esp32-flasher-reset

Conversation

@Oaradla

@Oaradla Oaradla commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Choosing a file for "Reset Box" wrote all 8 MB at once, without the confirmation of the normal write and without looking at the box.

  • "Reset Box" now goes to the write step and asks first (own dialog text).
  • Before writing, the MAC in the file name (ESP32_<mac>, patched_<mac>, as teddyCloud names backups) is compared with the connected chip; on a mismatch the user is asked again whether to write it anyway (it can rescue a box whose own image is lost). Files with other names are written without the extra question.
  • A file loaded with "Load flash file" has to pass the patch step before it can be written.
  • A cancelled file dialog ends the action, so the page is no longer left busy.

Tested: npm run test, npm run build, Prettier, check:translations.

Fixes #359

@Oaradla
Oaradla changed the base branch from master to develop November 1, 2026 12:40
@henryk86

henryk86 commented Nov 1, 2026

Copy link
Copy Markdown
Collaborator

You must allow to write the wrong backup to a box. As this is a working way to get a box working if their original flash image is lost.
Instead of cancelling / stopping the flash process you should ask the user if he is sure that he will flash another image to the box.

@Oaradla

Oaradla commented Nov 1, 2026

Copy link
Copy Markdown
Contributor Author

Good point, thanks.
Writing another box's backup is possible again: if the MAC in the file name differs from the connected box, the reset now asks whether to write it anyway, and only a "Cancel" stops it (64e633b).

@Oaradla Oaradla changed the title fix(esp32): reset asks first and refuses another box's backup fix(esp32): reset asks first, and again for another box's backup Nov 1, 2026
fileMac &&
chipMac &&
fileMac !== chipMac &&
!window.confirm(

This comment was marked as resolved.

} catch (err: any) {
console.error("[ESP32][Revvox] resetFlash: failed", err);
alert(err);
if (!err?.refused) alert(err);

This comment was marked as off-topic.

Comment thread CHANGELOG.md Outdated
- gui: Fixed web login edge cases: the login page now appears when login gets enabled while the UI is open, and logging out while TeddyCloud is unreachable no longer leaves the logged-in view on screen
- gui: Failed file downloads in the library and the Tonie information dialog now show an error notification instead of failing silently
- gui: A failed upload in the browser-side (WASM) audio encoder no longer additionally raises an uncaught promise rejection after showing the error notification
- gui: ESP32 box setup: "Reset Box" now asks before writing and asks again for a backup of another box (MAC in the file name); a loaded file has to pass the patch step, a cancelled file dialog no longer leaves the page busy, and the chosen baud rate is used [https://github.com/toniebox-reverse-engineering/teddycloud_web/issues/359](https://github.com/toniebox-reverse-engineering/teddycloud_web/issues/359)

This comment was marked as resolved.

Choosing a file for "Reset Box" wrote all 8 MB at once, without the
confirmation of the normal write and without looking at the box. It
now goes to the flash step, asks, and refuses a backup whose file name
(ESP32_<mac>, patched_<mac>) carries another box's MAC. A loaded file
has to pass the patch step before it can be flashed, a cancelled file
dialog no longer leaves the page busy, and the chosen baud rate is
used.
Writing another box's backup can bring back a box whose own image is
lost, so it stays possible: the reset now asks whether to write it
anyway and writes nothing only when the user declines.
The question for another box's backup now uses ConfirmationDialog like
the other questions on the page. As with the certificate overwrite,
the reset stops after reading the MAC and OK runs it again with force.
@Oaradla
Oaradla force-pushed the fix/esp32-flasher-reset branch from 72c8263 to b07cb25 Compare November 12, 2026 15:14
@Oaradla

Oaradla commented Nov 12, 2026

Copy link
Copy Markdown
Contributor Author

@henryk86 Rebased on develop and moved the CHANGELOG line to 0.8.0.

The other two points were done before: another box's backup can be written again after a confirmation, and that confirmation uses ConfirmationDialog.
I left the old alert()s for a separate PR.

@henryk86 henryk86 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i am fine with this :) (not that this matters, but as i requested changes, i should also give a go after those have been fixed)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ESP32 box setup: "Reset Box" writes the chosen file at once, without confirmation and also another box's backup

2 participants