Files
pictureFrame-firmware/platformio.ini
T
football2801 8eec4bd5fa fix(13e6): SPI corruption fix + setup-screen polish
- SPI corruption: lower clock to 4 MHz (matches 7.3" prod) and push from
  internal SRAM in 8 KB chunks instead of streaming directly from a PSRAM
  scratch buffer. On the S3, Arduino's SPI DMA reads RAM directly — the
  CPU's cache can hold writes to PSRAM that the DMA never sees, painting
  the panel yellow/garbage. Internal-SRAM chunks are DMA-coherent.
- LittleFS partition: switch the env to default_16MB.csv. The stock
  partition table for esp32-s3-devkitc-1 reserves ~1.5 MB for SPIFFS;
  three 960 KB setup-screen .bin files need ~2.9 MB + LittleFS metadata.
- Setup screens: redesigned to match the 7.3" information density —
  yellow header band, two-column body with vertical divider, "Connect to
  WiFi" heading + 5 numbered steps + manual QR + side label on the left,
  Step 1 / Step 2 QRs on the right.
- Orientation diagrams: PORTRAIT drawn upright (ribbon-bottom, up-arrow);
  LANDSCAPE drawn pre-rotated 90° CCW so it snaps to upright landscape
  when the user rotates the frame 90° CW (ribbon-bottom + left-arrow in
  portrait view → ribbon-left + up-arrow after rotation). "LANDSCAPE"
  label runs vertically up the long edge so it reads horizontally once
  the frame is mounted landscape.
- New helper paste_rotated_text() — PIL's text() can't rotate, so render
  → rotate → paste-with-alpha. Used for the vertical LANDSCAPE label.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 19:45:58 -04:00

157 lines
5.2 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
; Default partition table reserves ~1.5MB for SPIFFS — not enough for three
; 960 KB setup-screen .bin files (2.88 MB minimum + LittleFS metadata).
; 16MB preset gives ~3.5 MB to the filesystem, tight but works.
board_build.partitions = default_16MB.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/ ──
[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