move to new multi-board setup

This commit is contained in:
2026-02-16 17:36:28 -08:00
parent 2d0427604c
commit 6f0611c3bd
24 changed files with 1629 additions and 96 deletions

View File

@@ -1,112 +1,115 @@
# ═══════════════════════════════════════════════════════════
# Klubhaus Doorbell — Multi-Target Build Harness
# ═══════════════════════════════════════════════════════════
[tools]
arduino-cli = "latest"
lazygit = "latest"
python = "latest"
ruby = "latest"
[tasks.install-libs-shared]
description = "Install shared (platform-independent) libraries"
run = """
arduino-cli lib install "ArduinoJson@7.4.1"
arduino-cli lib install "NTPClient@3.2.1"
echo "[OK] Shared libraries installed"
"""
[tasks.install-core]
run = "arduino-cli core update-index && arduino-cli core install esp32:esp32"
[tasks.install-libs-32e]
description = "Vendor TFT_eSPI into vendor/esp32-32e"
run = """
#!/usr/bin/env bash
set -euo pipefail
if [ ! -d "vendor/esp32-32e/TFT_eSPI" ]; then
echo "Cloning TFT_eSPI..."
git clone --depth 1 --branch 2.5.43 \
https://github.com/Bodmer/TFT_eSPI.git \
vendor/esp32-32e/TFT_eSPI
fi
echo "Copying board-specific User_Setup.h..."
cp boards/esp32-32e/tft_user_setup.h vendor/esp32-32e/TFT_eSPI/User_Setup.h
echo "[OK] TFT_eSPI 2.5.43 vendored + configured"
"""
[tasks.install-libs-s3-43]
description = "Vendor Arduino_GFX into vendor/esp32-s3-lcd-43"
run = """
#!/usr/bin/env bash
set -euo pipefail
if [ ! -d "vendor/esp32-s3-lcd-43/GFX_Library_for_Arduino" ]; then
echo "Cloning Arduino_GFX..."
git clone --depth 1 --branch v1.6.5 \
https://github.com/moononournation/Arduino_GFX.git \
vendor/esp32-s3-lcd-43/GFX_Library_for_Arduino
fi
echo "[OK] Arduino_GFX 1.6.5 vendored"
"""
[tasks.install-libs]
description = "Install all libraries (shared + vendored)"
depends = ["install-libs-shared", "install-libs-32e", "install-libs-s3-43"]
# ── ESP32-32E ────────────────────────────────────────────
[tasks.compile-32e]
description = "Compile ESP32-32E sketch"
depends = ["install-libs"]
run = """
#!/usr/bin/env bash
set -euo pipefail
arduino-cli lib install "ArduinoJson"
arduino-cli lib install "NTPClient"
case "${BOARD_TARGET:-e32r35t}" in
e32r35t)
arduino-cli lib install "TFT_eSPI"
;;
waveshare_s3)
arduino-cli lib install "GFX Library for Arduino"
# Uncomment when enabling GT911 touch:
# arduino-cli lib install "TAMC_GT911"
;;
*)
echo "ERROR: Unknown BOARD_TARGET: $BOARD_TARGET"
echo "Valid targets: e32r35t, waveshare_s3"
exit 1
;;
esac
echo "Libraries installed for target: ${BOARD_TARGET:-e32r35t}"
arduino-cli compile \
--fqbn "esp32:esp32:esp32:FlashSize=4M,PartitionScheme=default" \
--libraries ./libraries \
--libraries ./vendor/esp32-32e \
--build-property "compiler.cpp.extra_flags=-DDEBUG_MODE" \
--warnings default \
./boards/esp32-32e
"""
[tasks.compile]
[tasks.upload-32e]
description = "Upload to ESP32-32E"
run = """
#!/usr/bin/env bash
set -euo pipefail
case "${BOARD_TARGET:-e32r35t}" in
e32r35t)
FQBN="esp32:esp32:esp32:UploadSpeed=921600,CPUFreq=240,FlashFreq=80,FlashMode=qio,FlashSize=4M,PartitionScheme=default,DebugLevel=info,EraseFlash=none"
BUILD_FLAGS="-DTARGET_E32R35T"
;;
waveshare_s3)
FQBN="esp32:esp32:waveshare_esp32_s3_touch_lcd_43:UploadSpeed=921600,USBMode=hwcdc,CDCOnBoot=cdc,CPUFreq=240,FlashMode=qio,FlashSize=16M,PartitionScheme=app3M_fat9M_16MB,DebugLevel=info,PSRAM=enabled,LoopCore=1,EventsCore=1,EraseFlash=none"
BUILD_FLAGS="-DTARGET_WAVESHARE_S3_43"
;;
*)
echo "ERROR: Unknown BOARD_TARGET: $BOARD_TARGET"
echo "Valid targets: e32r35t, waveshare_s3"
exit 1
;;
esac
echo ""
echo " Building: ${BOARD_TARGET:-e32r35t}"
echo " FQBN: $FQBN"
echo " Flags: $BUILD_FLAGS"
echo ""
arduino-cli compile --fqbn "$FQBN" \
--build-property "compiler.cpp.extra_flags=$BUILD_FLAGS" .
arduino-cli upload \
--fqbn "esp32:esp32:esp32:FlashSize=4M,PartitionScheme=default" \
--port "${PORT:-/dev/ttyUSB0}" \
./boards/esp32-32e
"""
[tasks.upload]
depends = ["compile"]
[tasks.monitor-32e]
description = "Serial monitor for ESP32-32E"
run = """
#!/usr/bin/env bash
set -euo pipefail
case "${BOARD_TARGET:-e32r35t}" in
e32r35t)
FQBN="esp32:esp32:esp32:UploadSpeed=921600,CPUFreq=240,FlashFreq=80,FlashMode=qio,FlashSize=4M,PartitionScheme=default,DebugLevel=info,EraseFlash=none"
PORT_PATTERN='ttyUSB|CP210|CH340'
;;
waveshare_s3)
FQBN="esp32:esp32:waveshare_esp32_s3_touch_lcd_43:UploadSpeed=921600,USBMode=hwcdc,CDCOnBoot=cdc,CPUFreq=240,FlashMode=qio,FlashSize=16M,PartitionScheme=app3M_fat9M_16MB,DebugLevel=info,PSRAM=enabled,LoopCore=1,EventsCore=1,EraseFlash=none"
PORT_PATTERN='ttyACM'
;;
*)
echo "ERROR: Unknown BOARD_TARGET: $BOARD_TARGET"; exit 1
;;
esac
PORT=$(arduino-cli board list | grep -iE "$PORT_PATTERN" | head -1 | awk '{print $1}')
if [ -z "$PORT" ]; then
echo "No matching port for pattern: $PORT_PATTERN"
echo "Available boards:"
arduino-cli board list
exit 1
fi
echo "Uploading to $PORT ..."
arduino-cli upload --fqbn "$FQBN" -p "$PORT" .
arduino-cli monitor --port "${PORT:-/dev/ttyUSB0}" --config baudrate=115200
"""
[tasks.monitor]
# ── ESP32-S3-LCD-4.3 ────────────────────────────────────
[tasks.compile-s3-43]
description = "Compile ESP32-S3-LCD-4.3 sketch"
depends = ["install-libs"]
run = """
#!/usr/bin/env bash
set -euo pipefail
case "${BOARD_TARGET:-e32r35t}" in
e32r35t) PORT_PATTERN='ttyUSB|CP210|CH340' ;;
waveshare_s3) PORT_PATTERN='ttyACM' ;;
*) echo "Unknown BOARD_TARGET"; exit 1 ;;
esac
PORT=$(arduino-cli board list | grep -iE "$PORT_PATTERN" | head -1 | awk '{print $1}')
if [ -z "$PORT" ]; then
echo "No matching port for pattern: $PORT_PATTERN"
arduino-cli board list
exit 1
fi
arduino-cli monitor -p "$PORT" -c baudrate=115200
arduino-cli compile \
--fqbn "esp32:esp32:waveshare_esp32_s3_touch_lcd_43:PSRAM=opi,FlashSize=16M,USBMode=hwcdc,PartitionScheme=app3M_fat9M_16MB" \
--libraries ./libraries \
--libraries ./vendor/esp32-s3-lcd-43 \
--build-property "compiler.cpp.extra_flags=-DDEBUG_MODE -DBOARD_HAS_PSRAM" \
--warnings default \
./boards/esp32-s3-lcd-43
"""
[tasks.all]
depends = ["upload"]
run = "mise run monitor"
[tasks.upload-s3-43]
description = "Upload to ESP32-S3-LCD-4.3"
run = """
arduino-cli upload \
--fqbn "esp32:esp32:waveshare_esp32_s3_touch_lcd_43:PSRAM=opi,FlashSize=16M,USBMode=hwcdc,PartitionScheme=app3M_fat9M_16MB" \
--port "${PORT:-/dev/ttyACM0}" \
./boards/esp32-s3-lcd-43
"""
[tasks.monitor-s3-43]
description = "Serial monitor for ESP32-S3-LCD-4.3"
run = """
arduino-cli monitor --port "${PORT:-/dev/ttyACM0}" --config baudrate=115200
"""
# ── Convenience ──────────────────────────────────────────
[tasks.clean]
description = "Remove build artifacts"
run = """
rm -rf boards/esp32-32e/build
rm -rf boards/esp32-s3-lcd-43/build
echo "[OK] Build artifacts cleaned"
"""