refactor(firmware): per-panel folder layout + parametrized config.h
Reorganizes the tree so adding a new panel is purely additive — drop in a
new src/panels/{vendor}/v{N}/ folder and a new platformio.ini env block,
no surgery to existing files.
Layout:
src/ shared across all panels
src/panels/waveshare73/v1/ V1 driver, version, README
data/waveshare73-v1/ LittleFS payload at this panel's size
src/config.h still defines the panel-agnostic bits (NVS keys, color
palette, network, sync-fail border) but EPD_WIDTH / EPD_HEIGHT / pin
assignments now come from each env's -D flags. Strict #error guards in
production builds; native tests get the V1 defaults via UNIT_TEST.
build_src_filter per env picks the right driver:
waveshare73-v1 main + panels/waveshare73/v1/
test-display test_display + panels/waveshare73/v1/
sim-yellow sim_border + panels/waveshare73/v1/
sim-red sim_border + panels/waveshare73/v1/
native-test unchanged
When V2 hardware lands, the diff is a new env block, a new
src/panels/waveshare133/v1/epd_driver.cpp, and regenerated screens at
data/waveshare133-v1/. Existing V1 envs stay frozen — re-flashing old
units remains a one-liner.
scripts/gen_screens.py takes --panel to target the correct
data/{panel}/ subfolder; defaults to waveshare73-v1.
29/29 native tests pass. All four hardware envs build clean.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
+69
-49
@@ -1,66 +1,86 @@
|
||||
[env:esp32dev]
|
||||
; 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.
|
||||
|
||||
; ── Production firmware: Waveshare 7.3" Spectra-6 + ESP32 dev breakout ──
|
||||
[env:waveshare73-v1]
|
||||
platform = espressif32
|
||||
board = esp32dev
|
||||
framework = arduino
|
||||
monitor_speed = 115200
|
||||
upload_port = /dev/ttyUSB0
|
||||
monitor_port = /dev/ttyUSB0
|
||||
monitor_speed = 115200
|
||||
board_build.filesystem = littlefs
|
||||
data_dir = data/waveshare73-v1
|
||||
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
|
||||
|
||||
; Flash a single image from firmware/data/img.bin — no WiFi, no server needed.
|
||||
; 1. pio run -e test-display --target uploadfs (upload the image)
|
||||
; 2. pio run -e test-display --target upload (upload the sketch)
|
||||
; ── 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]
|
||||
platform = espressif32
|
||||
board = esp32dev
|
||||
framework = arduino
|
||||
monitor_speed = 115200
|
||||
upload_port = /dev/ttyUSB0
|
||||
monitor_port = /dev/ttyUSB0
|
||||
board_build.filesystem = littlefs
|
||||
build_flags = -DENV_TEST_DISPLAY
|
||||
build_src_filter = +<epd.cpp> +<test_display.cpp>
|
||||
lib_deps =
|
||||
ricmoo/QRCode@^0.0.1
|
||||
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
|
||||
|
||||
; ── Native unit tests — no hardware, uses test/mocks/ ──
|
||||
[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
|
||||
test_build_src = no
|
||||
|
||||
; 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 on hardware)
|
||||
; 2. pio run -e sim-red --target upload (see red border on hardware)
|
||||
; 3. pio run -e esp32dev --target upload (back to normal; verifies 304 recovery)
|
||||
[env:sim-yellow]
|
||||
platform = espressif32
|
||||
board = esp32dev
|
||||
framework = arduino
|
||||
monitor_speed = 115200
|
||||
upload_port = /dev/ttyUSB0
|
||||
monitor_port = /dev/ttyUSB0
|
||||
board_build.filesystem = littlefs
|
||||
build_flags = -DSIM_BORDER -DSIM_BORDER_COLOR=COLOR_YELLOW
|
||||
build_src_filter = +<epd.cpp> +<sim_border.cpp>
|
||||
lib_deps =
|
||||
ricmoo/QRCode@^0.0.1
|
||||
|
||||
[env:sim-red]
|
||||
platform = espressif32
|
||||
board = esp32dev
|
||||
framework = arduino
|
||||
monitor_speed = 115200
|
||||
upload_port = /dev/ttyUSB0
|
||||
monitor_port = /dev/ttyUSB0
|
||||
board_build.filesystem = littlefs
|
||||
build_flags = -DSIM_BORDER -DSIM_BORDER_COLOR=COLOR_RED
|
||||
build_src_filter = +<epd.cpp> +<sim_border.cpp>
|
||||
lib_deps =
|
||||
ricmoo/QRCode@^0.0.1
|
||||
|
||||
Reference in New Issue
Block a user