Public Access
Add ESP32 recovery app with WiFi setup portal
- New flash layout (partitions.csv): factory = recovery app, ota_0/ota_1 = clock firmware; esp32_usb uploads to ota_0 so it never overwrites it - src/recovery: WiFi + OTA + web page only. Opens the password protected 'FlipDot-Setup' AP with a captive portal when WiFi fails, lets you pick another WiFi (stored in NVS, used by both apps), start the clock or stay - Recovery is started when the clock firmware can't connect to WiFi, crashes 3 times, after 3 quick power cycles, from a new Home Assistant button, or by the bootloader when no clock firmware works - Shared NVS store and boot switching in src/esp32/system - Clock firmware keeps working on the old flash layout (falls back to OTA-only safe mode) - README: recovery app, one-time USB installation; tests: 65 total Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ddbdf7e65f
commit
4749f9e596
25 files changed
+979
-29
No files matched your search
+13
-6
@@ -20,8 +20,10 @@ debug output. Wiring is described in the [main README](../../README.md#wiring-be
|
||||
| `logic/power_timer.*` | Countdown to switching the display off |
|
||||
| `logic/status_led.h` | Blink pattern of the built-in LED |
|
||||
| `logic/boot_policy.*` | How to start after a reset: normal, OTA-only window, safe mode |
|
||||
| **`system/`** | **Keeping OTA alive** |
|
||||
| `system/firmware_guard.*` | Rollback of bad OTA firmware, watchdog, crash counter, status for Home Assistant |
|
||||
| **`system/`** | **Keeping OTA alive** (`system_store` and `boot_target` are shared with the recovery app) |
|
||||
| `system/firmware_guard.*` | Rollback of bad OTA firmware, watchdog, crash counter, power-cycle trigger, status for Home Assistant |
|
||||
| `system/boot_target.*` | Switching between the clock firmware and the recovery app |
|
||||
| `system/system_store.*` | Settings in NVS: WiFi, recovery reason, firmware slot and version, power-on count |
|
||||
| **`display/`** | **What is drawn** |
|
||||
| `display/frames.*` | The screens: clock, logo, blank, text (`FlipdotFrames`) |
|
||||
| `display/bitmaps.h` | 1-bit bitmaps (Pikachu, thought bubble, Nintendo logo, ...) |
|
||||
@@ -30,7 +32,7 @@ debug output. Wiring is described in the [main README](../../README.md#wiring-be
|
||||
| `nano_link/nano_flash_bridge.*` | WiFi to serial bridge for flashing the Nano over WiFi (TCP port 2323) |
|
||||
| **`net/`** | **Network** |
|
||||
| `net/wifi_ota.*` | WiFi (with a restart when it stays down), ESP32 OTA updates, OTA-only mode |
|
||||
| `net/home_assistant.*` | MQTT and the two Home Assistant switches |
|
||||
| `net/home_assistant.*` | MQTT and the Home Assistant entities (two switches, firmware sensor, recovery button) |
|
||||
|
||||
`DisplayController` only talks to two small interfaces, `DisplayPower` (implemented by
|
||||
`NanoLink`) and `Frames` (implemented by `FlipdotFrames`). The tests replace both with
|
||||
@@ -46,8 +48,9 @@ again. Several layers take care of that:
|
||||
| A new OTA firmware crashes, hangs or can't connect to WiFi | **Rollback.** A new firmware is only marked as good after it has run for 60 s with WiFi. If it restarts before that, the bootloader starts the previous firmware again. |
|
||||
| The firmware hangs in `loop()` | **Watchdog.** If `loop()` doesn't run for 30 s, the ESP32 restarts. That counts as a crash. |
|
||||
| The firmware crashes once or twice | **OTA window.** After a crash the ESP32 runs only WiFi and OTA for 15 s (LED blinks fast), then starts the main code again. |
|
||||
| The firmware keeps crashing (3 times in a row) | **Safe mode.** Only WiFi and OTA run, for 10 minutes. Then the main code gets one more try; one more crash brings safe mode back. Running 5 minutes without a crash clears the counter. |
|
||||
| WiFi stays down | After 10 minutes without WiFi, the ESP32 restarts, in case the WiFi stack is stuck. |
|
||||
| The firmware keeps crashing (3 times in a row) | **Recovery app** for 10 minutes (see the [main README](../../README.md#recovery-app)). Then the main code gets one more try; one more crash brings the recovery app back. Running 5 minutes without a crash clears the counter. Without the recovery app installed: only WiFi and OTA run, for 10 minutes. |
|
||||
| WiFi doesn't connect at boot (30 s), or stays down for 10 minutes | **Recovery app**, which keeps trying and opens the **FlipDot-Setup** WiFi with a setup page to choose another WiFi. Without the recovery app: restart. |
|
||||
| The firmware runs, but its OTA is broken | **Recovery app** through the Home Assistant button, or by switching the power on and off 3 times quickly. |
|
||||
|
||||
So in every case you can flash a fix with `pio run -e esp32 -t upload`, at the latest
|
||||
after waiting for a safe-mode cycle.
|
||||
@@ -59,7 +62,7 @@ The **FlipDot Display Firmware** sensor in Home Assistant shows the state, e.g.
|
||||
|-------|---------|
|
||||
| `testing` | New OTA firmware, not yet marked as good (first 60 s) |
|
||||
| `ok` | Firmware marked as good |
|
||||
| `ok, no rollback in bootloader` | The bootloader on the ESP32 can't roll back. The other layers still work. |
|
||||
| `ok, no rollback in bootloader` | The bootloader on the ESP32 can't roll back. The other layers still work. The one-time USB install of the recovery app also installs a bootloader that can. |
|
||||
| `usb` | Flashed over USB, so there is no previous firmware to roll back to |
|
||||
|
||||
Rules for changing the code:
|
||||
@@ -84,6 +87,10 @@ Rules for changing the code:
|
||||
- `FlipDot Display Clock`: on = clock; off = Nintendo logo while the display is on,
|
||||
then power off after 30 s
|
||||
- `FlipDot Display Power`: off = clear the display and power it off after 1 s
|
||||
|
||||
Plus the **FlipDot Display Firmware** sensor (see
|
||||
[Keeping OTA alive](#keeping-ota-alive)) and the **FlipDot Display Recovery** button,
|
||||
which restarts into the recovery app for 10 minutes.
|
||||
- **Relay on GPIO 13** switches the power for both the panels and the Nano. `LOW` turns it
|
||||
on.
|
||||
- **On:** the ESP waits for the Nano's `READY` message, at most 3 s
|
||||
|
||||
Reference in new issue
Block a user