Files
pictureFrame-firmware/platformio.ini
T
football2801 e9f2ec0629 test(firmware): broaden native-test coverage + gcov instrumentation
Extract the pre-first-image retry from normal_operation() into a
templated bootstrap_loop() helper in operation.h so the loop body
becomes unit-testable. Add four tests against it: two that verify the
X-Panel-Id header is sent on every poll and matches the compile-time
PANEL_ID (a silent server-side mis-routing risk if dropped), and two
that exercise the loop's exit-on-deep-sleep vs. iterate-while-204
behaviour.

Wire --coverage into env:native-test (compile + link via a post-script)
so `gcovr -r . --filter src/` produces a real number, and ignore the
stray *.gcov files gcovr drops at the repo root.

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

166 lines
5.7 KiB
INI

; pictureFrame firmware build environments.
;
; Layout: shared sources at src/ root + panel-specific implementations at
; src/panels/{vendor}/v{N}/. Each panel/version gets its own [env:...] block
; that sets dimensions, pins, and panel-id via build_flags, and selects its
; driver via build_src_filter. New panel = new env block + new
; src/panels/{vendor}/v{N}/ folder + new data/{vendor}-v{N}/ folder. No
; surgery to existing envs.
;
; Old envs preserved as historical snapshots — re-flashing units in the
; field stays a one-line `pio run -e <env> --target upload` command.
; data_dir is single project-wide in [platformio]; PlatformIO silently
; ignores it inside [env:…] blocks. To route uploadfs to the right
; LittleFS payload per panel (waveshare73-v1 vs waveshare13e6-v1), each
; env wires in scripts/data_dir.py via extra_scripts, which overrides
; PROJECT_DATA_DIR from $PIOENV before SCons evaluates uploadfs.
; The project-level default below keeps tooling that runs outside a
; specific env (e.g. raw `pio run`) pointed at the 7.3" payload.
[platformio]
data_dir = data/waveshare73-v1
; ── Production firmware: Waveshare 7.3" Spectra-6 + ESP32 dev breakout ──
[env:waveshare73-v1]
platform = espressif32
board = esp32dev
framework = arduino
upload_port = /dev/ttyUSB0
monitor_port = /dev/ttyUSB0
monitor_speed = 115200
board_build.filesystem = littlefs
extra_scripts = pre:scripts/data_dir.py
build_src_filter =
+<main.cpp>
+<panels/waveshare73/v1/>
build_flags =
-DEPD_WIDTH=800
-DEPD_HEIGHT=480
-DMAX_PANEL_WIDTH=800
-DPIN_SCK=18
-DPIN_MOSI=23
-DPIN_CS=5
-DPIN_DC=17
-DPIN_RST=16
-DPIN_BUSY=4
-DPANEL_ID=\"waveshare-7.3-spectra6\"
lib_deps =
ricmoo/QRCode@^0.0.1
; ── Hardware visual test: flash a single image from data/waveshare73-v1/img.bin ──
; No WiFi, no server.
; 1. pio run -e test-display --target uploadfs (upload data/)
; 2. pio run -e test-display --target upload (upload sketch)
[env:test-display]
extends = env:waveshare73-v1
build_src_filter =
+<test_display.cpp>
+<panels/waveshare73/v1/>
build_flags =
${env:waveshare73-v1.build_flags}
-DENV_TEST_DISPLAY
; ── Visual hardware tests for the sync-fail / no-WiFi border ──
; Reads the cached /img.bin from LittleFS and draws it with a yellow / red
; border. Sets NVS err_border=1 so the next normal-firmware boot exercises
; the recovery redraw via 304. Flow:
; 1. pio run -e sim-yellow --target upload (see yellow border)
; 2. pio run -e sim-red --target upload (see red border)
; 3. pio run -e waveshare73-v1 --target upload (back to normal; verifies 304 recovery)
[env:sim-yellow]
extends = env:waveshare73-v1
build_src_filter =
+<sim_border.cpp>
+<panels/waveshare73/v1/>
build_flags =
${env:waveshare73-v1.build_flags}
-DSIM_BORDER
-DSIM_BORDER_COLOR=COLOR_YELLOW
[env:sim-red]
extends = env:waveshare73-v1
build_src_filter =
+<sim_border.cpp>
+<panels/waveshare73/v1/>
build_flags =
${env:waveshare73-v1.build_flags}
-DSIM_BORDER
-DSIM_BORDER_COLOR=COLOR_RED
; ── Production firmware: Waveshare 13.3" Spectra-6 + ESP32-S3-ePaper-13.3E6 ──
; All-in-one board: ESP32-S3-WROOM-2-N32R16V (32MB OPI flash, 16MB OPI PSRAM),
; CH343 USB-serial on USB-C. PIN_CS aliases CS_M only to satisfy config.h's
; required-pin check — the driver uses CS_M / CS_S explicitly, never PIN_CS.
[env:waveshare13e6-v1]
platform = espressif32
board = esp32-s3-devkitc-1
framework = arduino
monitor_speed = 115200
board_build.flash_size = 32MB
board_build.flash_mode = opi
board_upload.flash_size = 32MB
board_build.arduino.memory_type = opi_opi
board_build.filesystem = littlefs
; Custom partition layout: 4 MB app slots + 24 MB LittleFS on 32 MB flash.
; The 16 MB preset's ~3.5 MB SPIFFS is too tight — three 960 KB setup
; screens + a 960 KB cached /img.bin overflows it, and LittleFS panics
; in lfs_ctz_traverse (lfs.c:2988) with an IntegerDivideByZero
; mid-write rather than returning a clean "no space" error.
board_build.partitions = partitions_13e6.csv
extra_scripts = pre:scripts/data_dir.py
build_src_filter =
+<main.cpp>
+<panels/waveshare13e6/v1/>
build_flags =
-DEPD_WIDTH=1200
-DEPD_HEIGHT=1600
-DMAX_PANEL_WIDTH=1200
-DPIN_SCK=9
-DPIN_MOSI=46
-DPIN_CS=10
-DPIN_CS_M=10
-DPIN_CS_S=3
-DPIN_DC=11
-DPIN_RST=2
-DPIN_BUSY=12
-DPIN_PWR=1
-DPANEL_ID=\"waveshare-13.3-spectra6\"
-DBOARD_HAS_PSRAM
lib_deps =
ricmoo/QRCode@^0.0.1
; ── First-pixels smoke test for ESP32-S3-ePaper-13.3E6 ──
; Self-contained color-bar bringup, no LittleFS / no shared driver. Kept
; alongside the production env as a fallback for hardware diagnostics:
; if waveshare13e6-v1 misbehaves, this verifies the panel + SPI bus alone.
; pio run -e test-display-13e6 --target upload
[env:test-display-13e6]
platform = espressif32
board = esp32-s3-devkitc-1
framework = arduino
monitor_speed = 115200
board_build.flash_size = 32MB
board_build.flash_mode = opi
board_upload.flash_size = 32MB
board_build.arduino.memory_type = opi_opi
build_src_filter =
+<test_display_13e6.cpp>
build_flags =
-DENV_TEST_DISPLAY_13E6
-DBOARD_HAS_PSRAM
; ── Native unit tests — no hardware, uses test/mocks/ ──
; --coverage instruments gcov on both compile and link. After a test run,
; .gcda files land in .pio/build/native-test/test/... — gcovr aggregates
; them against src/. To regenerate the number:
; pio test -e native-test
; gcovr -r . --filter src/ --print-summary
[env:native-test]
platform = native
lib_deps =
throwtheswitch/Unity@^2.6
build_flags = -DUNIT_TEST -std=c++17 -iquote test/mocks -iquote test -Itest/mocks -Itest --coverage -O0 -g
build_unflags = -O2
test_build_src = no
extra_scripts = post:scripts/native_coverage_link.py