f58b090a345f6520d31958565d86ca7d346e90ed
Context: We wanted a "livre dont vous etes le heros" playable on the Freenove master with NO model in RAM: narration as say()-rendered WAV staged on the SD card, and navigation on the physical 5-way pad. Nothing in the firmware drove a branching, button-navigated story before this. Approach: A self-contained gamebook component reads a JSON book from the SD, drives the display and audio, and owns the 5-way pad through a registered display_ui key hook (so display_ui keeps no dependency on gamebook — no cycle). A dedicated full-screen gamebook view renders each page (title / wrapped body / choice list). Changes: - New gamebook component: loads /sdcard/gamebook/gamebook.json; per passage plays its WAV (media_manager, absolute /sdcard path) and renders the title, wrapped text, and a choice list with a ">" cursor. - Navigation: D-pad up/down (and left/right) move the cursor, the center click confirms; endings (no choices) restart on click; a choice interrupts the current narration (media_manager_stop + play). - display_ui: add display_ui_set_key_hook (consume keys when a takeover mode is active) and a dedicated gamebook view (title + height-bounded body band + reserved bottom menu band) with display_ui_gamebook_show / display_ui_gamebook_hide; the gamebook view wins the view selector while open. - game_endpoint: POST /game/gamebook[?action=stop] to start/stop. - ota_server: bump max_uri_handlers 20 -> 22 for the new endpoint. - main: call gamebook_init() once the buttons are up. Impact: The Freenove plays a branching audio gamebook driven entirely by the pad, fully offline (no gateway, no model). Hardware-validated end to end: cursor navigation, click select, WAV narration from SD, endings restart.
ESP32_ZACUS
Workspace firmware centré sur une seule cible: Freenove FNK0102H avec ui_freenove_allinone.
Docs canoniques
docs/QUICKSTART.md: bootstrap, build, flash, monitor, smoke.docs/FNK0102H_SOURCE_OF_TRUTH.md: matrice board/config/pins/support.README_ESP32_ZACUS.md: notes runtime et signatures série utiles.
Deux firmwares
ui_freenove_allinone/— firmware Arduino/PlatformIO historique (UI/audio/caméra/réseau), chemin release stabilisé.idf_zacus/— firmware master ESP-IDF 5.4 (migration en cours, branchefeat/idf-migration) : voix NPC (esp-sr wakeword + bridge WS), énigmes locales P1 son / P3 QR (caméra OV3660 + micro), écran LVGL (vue scène, viewfinder, shell Workbench, intro cracktro), et une surface REST de jeu (/game/step,/game/puzzle_state,/game/file). Voiridf_zacus/README.md.box3_voice/— firmware annexe ESP32-S3-BOX-3 : pipeline voix + générateur de stimulus (/stim/qr,/stim/melody) pour exercer les énigmes du master. Voirbox3_voice/README.md.
Arborescence utile
platformio.ini: env PlatformIO canoniquefreenove_esp32s3_full_with_ui.ui_freenove_allinone/: firmware Arduino UI/audio/caméra/réseau.idf_zacus/: firmware master ESP-IDF (énigmes locales, écran LVGL, REST de jeu).box3_voice/: firmware BOX-3 (voix + générateur de stimulus QR/mélodie).data/: contenu LittleFS.lib/: bibliothèques runtime.scripts/: bootstrap et scripts repo.tests/: harness Sprint 1, Sprint 2, Sprint 3, Phase 9.
Environnements supportés
freenove_esp32s3_full_with_ui: chemin release/stabilisation.freenove_esp32s3: alias du chemin canonique.freenove_esp32s3_touch: expérimental, hors release, sans CI.
Démarrage rapide
./scripts/bootstrap_platformio.sh
./scripts/doctor_repo.sh
source .venv/bin/activate
python -m platformio run -e freenove_esp32s3_full_with_ui
python -m platformio run -e freenove_esp32s3_full_with_ui -t buildfs
python -m platformio run -e freenove_esp32s3_full_with_ui -t uploadfs --upload-port <PORT>
python -m platformio run -e freenove_esp32s3_full_with_ui -t upload --upload-port <PORT>
python -m platformio device monitor -b 115200 --port <PORT>
Guardrails runtime
- Si la PSRAM est détectée, le firmware démarre normalement puis autorise le réseau après validation UI.
- Si la PSRAM n'est pas détectée, le firmware bascule en
safe diagnostic mode. - En mode diagnostic, le firmware garde uniquement la pile série, l'affichage minimal et les boutons physiques.
- En mode diagnostic, caméra, FX, micro, audio, Wi-Fi, ESP-NOW, WebUI et partage de fichiers restent coupés.
Vérifications minimales
./scripts/doctor_repo.sh
./scripts/check_memory_budget.sh --env freenove_esp32s3_full_with_ui --max-ram 75 --max-flash 80 --yes
python tests/sprint1_utility_contract.py --mode serial --port <PORT>
python tests/sprint2_capture_contract.py --mode serial --port <PORT>
python tests/sprint3_audio_contract.py --mode serial --port <PORT>
python tests/phase9_ui_validation.py --port <PORT>
Audit & Execution Plan (2026-03-10)
Snapshot
- Priority:
P2 - Tech profile:
embedded - Workflows:
yes - Tests:
yes - Debt markers:
0 - Source files:
258
Corrections Prioritaires
- Vérifier target PlatformIO et budget mémoire
- Ajouter/fiabiliser les commandes de vérification automatiques.
- Clore les points bloquants avant optimisation avancée.
Optimisation
- Identifier le hotspot principal et mesurer avant/après.
- Réduire la complexité des modules les plus touchés.
Mémoire chantier
- Control plane:
/Users/electron/.codex/memories/electron_rare_chantier - Repo card:
/Users/electron/.codex/memories/electron_rare_chantier/REPOS/ESP32_ZACUS.md
Description
Languages
C
75.4%
C++
22%
Python
2.1%
Shell
0.3%
CMake
0.1%