Files
pyxis/platformio.ini
T
torlando-techandClaude Opus 4.7 5a3ee97856 deps(codec2): vendor codec2 v1.2.0, replace sh123/esp32_codec2_arduino@1.0.7
The PlatformIO dep sh123/esp32_codec2_arduino@1.0.7 bundles codec2
v0.9.2. Mac-side pycodec2 v3.0.4 links libcodec2 v1.2.0. Years of
codec2 development between those releases.

Replace the upstream lib with a local vendor of drowe67/codec2 v1.2.0
under lib/codec2/. Trim the 191-file source tree down to the
~100 files actually needed for codec2 (drop FreeDV, OFDM, COHPSK,
FSK, FM-FSK, LDPC, Horus, CLI tools — pyxis only uses
codec2_create/destroy/encode/decode + samples_per_frame /
bytes_per_frame). Carry over the v0.9 codebook .c files since the
codebook contents matched (compared against v1.2's src/codebook/*.txt).

Define __EMBEDDED__ so the codebooks land in flash (.const) rather
than RAM. Without it the codebooks add ~127KB to BSS and the LVGL
task fails to start (RAM was 65% full vs 27% with __EMBEDDED__).
Provide trivial codec2_malloc/codec2_free wrappers in
codec2_alloc_esp32.c (codec2 v1.2 expects them when __EMBEDDED__ is
defined; ESP-IDF's malloc/free already pull from internal RAM).

Also explicitly add SD/FS to lib_deps and #include <SD.h> in
main.cpp — the previous esp32_codec2 dep transitively pulled SD
which let SDArchiveFileSystem.h get away with depending on it
implicitly. With chain+ ldf mode and no esp32_codec2 dep, we have
to declare the framework lib explicitly.

DOES NOT fix the ~30x speech-decode RMS asymmetry between pycodec2
self-tests (~5800) and pyxis decoding the same encoded bytes (~170).
Sine waves and 3-formant synthesis pass clean both directions; only
real TTS speech triggers it. Probably a separate codec-state
divergence (the encoder/decoder are independent codec2 instances
in pyxis, both fresh per call) or a wire-format quirk we still need
to track down. v1.2 is the right baseline regardless — same bug
class as several upstream fixes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-08 12:25:52 -04:00

282 lines
11 KiB
INI

; T-Deck environment using Bluedroid BLE stack (fallback, uses more RAM)
[env:tdeck-bluedroid]
extra_scripts =
pre:version.py
pre:generate_splash.py
platform = espressif32
board = esp32-s3-devkitc-1
framework = arduino
; T-Deck Plus has ESP32-S3 with 8MB Flash + 8MB PSRAM
board_build.flash_mode = qio
board_build.partitions = partitions.csv
board_build.arduino.memory_type = qio_opi
board_upload.flash_size = 8MB
; Enable PSRAM (required for LVGL buffers)
board_build.arduino.psram_type = opi
; Serial monitor
monitor_speed = 115200
monitor_filters =
esp32_exception_decoder
time
; Dependencies
lib_deps =
lvgl/lvgl@^8.3.11
bblanchon/ArduinoJson@^7.4.2
hideakitai/MsgPack@^0.4.2
rweather/Crypto@^0.4.0
mikalhart/TinyGPSPlus@^1.0.3
jgromes/RadioLib@^6.0
WiFi
SPI
Wire
SD
FS
LittleFS
tdeck_ui
universal_filesystem
sx1262_interface
tone
auto_interface
ble_interface
lxst_audio
codec2 ; vendored v1.2.0 at lib/codec2 (replaced sh123/esp32_codec2 v1.0.7 which bundled v0.9 — see lib/codec2/README.md)
libbz2
https://github.com/attermann/microStore.git
; Library dependency finder mode (deep search)
; deep+ scans #include statements and auto-fetches matching libs from the
; registry — that pulled a parallel copy of microReticulum into
; .pio/libdeps/tdeck/microReticulum/ alongside our deps/microReticulum/
; overlay, and the linker picked the registry copy (silently dropping
; all our local .cpp changes). chain+ follows only explicit dependencies
; declared in library.json, so deps/microReticulum (via lib_extra_dirs)
; is the only microReticulum source.
lib_ldf_mode = chain+
; (was: lib_extra_dirs = deps/microReticulum — replaced by an
; explicit file:// lib_dep below. lib_extra_dirs caused the duplicate
; compilation that produced two _path_store statics.)
; Build configuration
build_type = release
build_flags =
-std=gnu++11
-DBOARD_HAS_PSRAM
-DBOARD_ESP32
; Arduino loop task stack — Codec2 decode (lpc_post_filter + kiss_fft)
; uses ~6KB stack on top of ~10KB normal peak. 24KB gives safe headroom.
-DARDUINO_LOOP_STACK_SIZE=24576
-DARDUINO_USB_CDC_ON_BOOT=1
-DARDUINO_USB_MODE=1
-DLV_CONF_INCLUDE_SIMPLE
-Ilib
-Ilib/libbz2
-Ideps/microReticulum/src
; -Ilib/microreticulum-shim alone is enough — subdir lookups use <Cryptography/BZ2.h>,
; <Utilities/Stream.h>, etc. Don't add -Ilib/microreticulum-shim/Utilities on top:
; that puts our Stream.h on the GLOBAL header path and breaks Arduino's
; Wire.cpp (`class TwoWire: public Stream` finds ours first).
-Ilib/microreticulum-shim
-DBZ_NO_STDIO
; Move microReticulum allocations from internal DRAM (~320KB total)
; to PSRAM (~8MB on T-Deck Plus). The default `::operator new` on
; ESP32 prefers internal SRAM and would otherwise compete with LVGL
; framebuffers, BLE/WiFi, etc — under heavy announce flood we saw
; the path table fill internal heap and "Failed to add destination
; to path table" / "PropagationNodeManager: Pool full" spam.
; RNS_PSRAM_ALLOCATOR routes default new/delete to ps_malloc;
; RNS_PSRAM_POOL_ALLOCATOR routes long-lived STL containers (path
; table) into a dedicated 2MB TLSF pool in PSRAM.
-DRNS_DEFAULT_ALLOCATOR=RNS_PSRAM_ALLOCATOR
-DRNS_CONTAINER_ALLOCATOR=RNS_PSRAM_POOL_ALLOCATOR
-DRNS_PSRAM_POOL_BUFFER_SIZE=2048000
; Enable filesystem-backed path persistence in microReticulum.
; Without these, Transport::start() skips _path_store.init(), and
; every announce-driven _new_path_table.put() bails silently at
; TypedStore::isValid() → "Failed to add destination to path table"
; spam. With LittleFS as the backend (USTORE_USE_LITTLEFS) the
; sustained-write pattern is tractable.
-DRNS_USE_FS
-DRNS_PERSIST_PATHS
; Test-mode hooks: hard-override the TCP server NVS settings to
; point at the Mac-side rnsd (<MAC-RNSD-HOST>:4242) and add a `T:`-
; prefixed serial command interface (T:DEST, T:SEND, T:STATE,
; T:RX, T:ANN, etc.) for the harness to drive the device. Remove
; this group of flags for production firmware.
-DPYXIS_TEST_HOOKS
'-DPYXIS_TEST_TCP_HOST="<MAC-RNSD-HOST>"'
-DPYXIS_TEST_TCP_PORT=4242
; microStore LittleFS adapter — replaces pyxis's pre-graft
; lib/universal_filesystem/ (which targeted SPIFFS directly).
; LittleFS reuses the existing partition labeled "spiffs" (LittleFS's
; default partitionLabel is "spiffs" too) and reformats it on first
; boot. SPIFFS was swapped out because its GC-induced flush stalls
; caused FileStore::put → flush_buffer() to fail under sustained
; announce writes (~3/sec), surfacing as path-table-add error spam.
-DUSTORE_USE_LITTLEFS
-DUSE_BLUEDROID
-Os
-DCORE_DEBUG_LEVEL=2
; Enable memory instrumentation (heap/stack monitoring)
; Remove this flag to disable instrumentation and eliminate overhead
-DMEMORY_INSTRUMENTATION_ENABLED
; Enable boot profiling (timing instrumentation for setup phases)
; Remove this flag to disable boot profiling
-DBOOT_PROFILING_ENABLED
; Reduce log verbosity during boot for faster startup
; CORE_DEBUG_LEVEL=2 (WARNING) reduces INFO-level log output
-DBOOT_REDUCED_LOGGING
; Default T-Deck environment using NimBLE BLE stack (uses ~100KB less RAM than Bluedroid)
[env:tdeck]
extra_scripts =
pre:version.py
pre:generate_splash.py
pre:patch_nimble.py
pre:patch_msgpack.py
; pre:patch_filestore.py — diagnostic patch (very chatty); re-add
; only when investigating put/exists drift in the path-table store
platform = espressif32
board = esp32-s3-devkitc-1
framework = arduino
; T-Deck Plus has ESP32-S3 with 8MB Flash + 8MB PSRAM
board_build.flash_mode = qio
board_build.partitions = partitions.csv
board_build.arduino.memory_type = qio_opi
board_upload.flash_size = 8MB
; Enable PSRAM (required for LVGL buffers)
board_build.arduino.psram_type = opi
; Serial monitor
monitor_speed = 115200
monitor_filters =
esp32_exception_decoder
time
; Library dependency finder mode (deep search)
; deep+ scans #include statements and auto-fetches matching libs from the
; registry — that pulled a parallel copy of microReticulum into
; .pio/libdeps/tdeck/microReticulum/ alongside our deps/microReticulum/
; overlay, and the linker picked the registry copy (silently dropping
; all our local .cpp changes). chain+ follows only explicit dependencies
; declared in library.json, so deps/microReticulum (via lib_extra_dirs)
; is the only microReticulum source.
lib_ldf_mode = chain+
; Build type
build_type = release
lib_deps =
; Explicit file:// dep so PIO links exactly ONE microReticulum (the
; live source). lib_extra_dirs was creating duplicate compilations
; — PIO compiled deps/microReticulum/ as one library AND auto-
; fetched the same source as another, leaving two copies of
; Transport::_path_store / _new_path_table in BSS. Different TUs
; ended up linking against different statics, so put() and
; exists() landed in different stores.
file://~/repos/microReticulum
lvgl/lvgl@^8.3.11
bblanchon/ArduinoJson@^7.4.2
hideakitai/MsgPack@^0.4.2
rweather/Crypto@^0.4.0
mikalhart/TinyGPSPlus@^1.0.3
jgromes/RadioLib@^6.0
WiFi
SPI
Wire
SD
FS
LittleFS
tdeck_ui
universal_filesystem
sx1262_interface
tone
auto_interface
h2zero/NimBLE-Arduino@^2.1.0
ble_interface
lxst_audio
codec2 ; vendored v1.2.0 at lib/codec2 (replaced sh123/esp32_codec2 v1.0.7 which bundled v0.9 — see lib/codec2/README.md)
libbz2
https://github.com/attermann/microStore.git
; Build configuration
build_flags =
-std=gnu++11
-DBOARD_HAS_PSRAM
-DBOARD_ESP32
; Arduino loop task stack — Codec2 decode (lpc_post_filter + kiss_fft)
; uses ~6KB stack on top of ~10KB normal peak. 24KB gives safe headroom.
-DARDUINO_LOOP_STACK_SIZE=24576
-DARDUINO_USB_CDC_ON_BOOT=1
-DARDUINO_USB_MODE=1
-DLV_CONF_INCLUDE_SIMPLE
-Ilib
-Ilib/libbz2
-Ideps/microReticulum/src
; -Ilib/microreticulum-shim alone is enough — subdir lookups use <Cryptography/BZ2.h>,
; <Utilities/Stream.h>, etc. Don't add -Ilib/microreticulum-shim/Utilities on top:
; that puts our Stream.h on the GLOBAL header path and breaks Arduino's
; Wire.cpp (`class TwoWire: public Stream` finds ours first).
-Ilib/microreticulum-shim
-DBZ_NO_STDIO
; Move microReticulum allocations from internal DRAM (~320KB total)
; to PSRAM (~8MB on T-Deck Plus). The default `::operator new` on
; ESP32 prefers internal SRAM and would otherwise compete with LVGL
; framebuffers, BLE/WiFi, etc — under heavy announce flood we saw
; the path table fill internal heap and "Failed to add destination
; to path table" / "PropagationNodeManager: Pool full" spam.
; RNS_PSRAM_ALLOCATOR routes default new/delete to ps_malloc;
; RNS_PSRAM_POOL_ALLOCATOR routes long-lived STL containers (path
; table) into a dedicated 2MB TLSF pool in PSRAM.
-DRNS_DEFAULT_ALLOCATOR=RNS_PSRAM_ALLOCATOR
-DRNS_CONTAINER_ALLOCATOR=RNS_PSRAM_POOL_ALLOCATOR
-DRNS_PSRAM_POOL_BUFFER_SIZE=2048000
; Enable filesystem-backed path persistence in microReticulum.
; Without these, Transport::start() skips _path_store.init(), and
; every announce-driven _new_path_table.put() bails silently at
; TypedStore::isValid() → "Failed to add destination to path table"
; spam. With LittleFS as the backend (USTORE_USE_LITTLEFS) the
; sustained-write pattern is tractable.
-DRNS_USE_FS
-DRNS_PERSIST_PATHS
; Test-mode hooks: hard-override the TCP server NVS settings to
; point at the Mac-side rnsd (<MAC-RNSD-HOST>:4242) and add a `T:`-
; prefixed serial command interface (T:DEST, T:SEND, T:STATE,
; T:RX, T:ANN, etc.) for the harness to drive the device. Remove
; this group of flags for production firmware.
-DPYXIS_TEST_HOOKS
'-DPYXIS_TEST_TCP_HOST="<MAC-RNSD-HOST>"'
-DPYXIS_TEST_TCP_PORT=4242
; microStore LittleFS adapter — replaces pyxis's pre-graft
; lib/universal_filesystem/ (which targeted SPIFFS directly).
; LittleFS reuses the existing partition labeled "spiffs" (LittleFS's
; default partitionLabel is "spiffs" too) and reformats it on first
; boot. SPIFFS was swapped out because its GC-induced flush stalls
; caused FileStore::put → flush_buffer() to fail under sustained
; announce writes (~3/sec), surfacing as path-table-add error spam.
-DUSTORE_USE_LITTLEFS
-DUSE_NIMBLE
-DCONFIG_BT_NIMBLE_MEM_ALLOC_MODE_EXTERNAL=1
-Os
-DCORE_DEBUG_LEVEL=2
; Enable memory instrumentation (heap/stack monitoring)
; Remove this flag to disable instrumentation and eliminate overhead
-DMEMORY_INSTRUMENTATION_ENABLED
; Enable boot profiling (timing instrumentation for setup phases)
; Remove this flag to disable boot profiling
-DBOOT_PROFILING_ENABLED
; Reduce log verbosity during boot for faster startup
; CORE_DEBUG_LEVEL=2 (WARNING) reduces INFO-level log output
-DBOOT_REDUCED_LOGGING
; OTA flashing environment (wireless upload via ArduinoOTA)
; Usage: pio run -e tdeck-ota -t upload
[env:tdeck-ota]
extends = env:tdeck
upload_protocol = custom
upload_command = "$PYTHONEXE" tools/espota.py -i pyxis-tdeck.local -p 3232 -f $SOURCE