[tools] arduino-cli = "latest" lazygit = "latest" python = "latest" ruby = "latest" # ═══════════════════════════════════════════════════════════════════ # Default target — override with: BOARD_TARGET=waveshare_s3 mise run compile # ═══════════════════════════════════════════════════════════════════ [env] BOARD_TARGET = "e32r35t" [tasks.install-core] run = "arduino-cli core update-index && arduino-cli core install esp32:esp32" [tasks.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}" """ [tasks.compile] 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 "build.extra_flags=$BUILD_FLAGS" . """ [tasks.upload] depends = ["compile"] 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" . """ [tasks.monitor] 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 """ [tasks.all] depends = ["upload"] run = "mise run monitor"