Добавить отдельные скрипты прошивки скетчей

This commit is contained in:
AidarKC
2026-10-16 18:38:31 +03:00
parent c0bb7d6b9a
commit ae6ee5361e
11 changed files with 321 additions and 12 deletions
@@ -24,8 +24,8 @@ Do not feed 5 V into GPIO2 or GPIO6.
## Build and flash
From `SKETCH/potentiometer_breath_monitor`:
From this folder:
```bash
./burn.sh potentiometer-breath-monitor-buzzer
./burn.sh
```
@@ -0,0 +1,21 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PORT="${PORT:-}"
FQBN="${FQBN:-esp32:esp32:esp32s3:USBMode=hwcdc,CDCOnBoot=cdc,UploadSpeed=921600,CPUFreq=240,FlashMode=dio,FlashSize=16M,PartitionScheme=app3M_fat9M_16MB,PSRAM=opi}"
BUILD_DIR="$ROOT_DIR/../../.arduino-build/potentiometer-breath-monitor-buzzer"
if [[ -z "$PORT" ]]; then
PORT="$(arduino-cli board list | awk '/ttyACM|ttyUSB/ {print $1; exit}')"
fi
if [[ -z "$PORT" && "${NO_UPLOAD:-0}" != "1" ]]; then
echo "Set PORT=/dev/ttyACM0 or use NO_UPLOAD=1." >&2
exit 1
fi
arduino-cli compile --fqbn "$FQBN" --build-path "$BUILD_DIR" "$ROOT_DIR"
if [[ "${NO_UPLOAD:-0}" == "1" ]]; then
exit 0
fi
arduino-cli upload --fqbn "$FQBN" -p "$PORT" --input-dir "$BUILD_DIR" "$ROOT_DIR"