clement 43dc1478b1
CI / platformio (pull_request) Failing after 3m44s
CI / platformio (push) Failing after 3m34s
box3: fix gamebook audio, accents, and crashes
The BOX-3 touch gamebook had several blocking bugs that made the
voiced+foley story packs unusable. This fixes them end to end.

- Stack overflow on story start: gb_play_task kept a 2 KB buffer on
  its 4 KB stack and rebooted the board. Buffers are now static (the
  task is a singleton) and the stack is 6 KB.
- No sound at all: the ES8311 codec was never initialised — main.c
  wrote raw I2S to a muted DAC. Output (and the mic) now go through
  the BSP esp_codec_dev (bsp_audio_codec_speaker/microphone_init,
  esp_codec_dev_write/read). The power amplifier (GPIO46) is also
  forced on and volume set to 100, as the es8311 pa_pin handling did
  not drive it in practice.
- First passage silent: gb_play re-mounted the SD that the gamebook
  had already mounted; the failed second bsp_sdcard_mount tore down
  the VFS so the first fopen failed. Now we open the file first and
  only mount if that fails. A short silence lead-in also primes the
  codec/PA ramp.
- No accents: the gamebook used ASCII-only lv_font_montserrat_14/24.
  Added custom Montserrat fonts (font_fr_14/24, Latin-1 + œŒŸ « » ’ …,
  uncompressed so they render without LV_USE_FONT_COMPRESSED).
- Mic/voice streaming gated behind CONFIG_BOX3_VOICE_STREAMING
  (default off): as a gamebook the BOX-3 needs no mic, and the
  constant codec reads + bridge reconnects interfered with playback
  and flooded the log.

plip_virtual + cmd_exec handle types switched from i2s_chan_handle_t
to esp_codec_dev_handle_t accordingly.
2026-06-21 11:07:34 +02:00
2026-04-03 07:36:51 +02:00
2026-06-10 13:49:10 +02:00

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, branche feat/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). Voir idf_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. Voir box3_voice/README.md.

Arborescence utile

  • platformio.ini: env PlatformIO canonique freenove_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
S
Description
ESP32 ZACUS — firmware ESP32 pour le projet Le Mystere du Professeur Zacus
Readme 11 MiB
Languages
C 75.4%
C++ 22%
Python 2.1%
Shell 0.3%
CMake 0.1%