feat: autodetect usb

This commit is contained in:
2025-08-21 07:40:34 +02:00
parent fc108a4b7f
commit e03ef29f4d

View File

@@ -1,13 +1,26 @@
PHONY:
.PHONY: compile upload watch all
# Auto-detect ESP32 USB port
ESP32_PORT := $(shell ls /dev/ttyUSB* 2>/dev/null | head -1)
compile: esp32_radio/esp32_radio.ino esp32_radio/wifiinfo.h
arduino-cli compile --fqbn esp32:esp32:esp32 esp32_radio
upload:
arduino-cli upload -p /dev/ttyUSB0 -b esp32:esp32:esp32 esp32_radio
@if [ -z "$(ESP32_PORT)" ]; then \
echo "Error: No USB device found. Please check ESP32 connection."; \
exit 1; \
fi
@echo "Using port: $(ESP32_PORT)"
arduino-cli upload -p $(ESP32_PORT) -b esp32:esp32:esp32 esp32_radio
watch:
screen /dev/ttyUSB0 115200
@if [ -z "$(ESP32_PORT)" ]; then \
echo "Error: No USB device found. Please check ESP32 connection."; \
exit 1; \
fi
@echo "Monitoring port: $(ESP32_PORT)"
screen $(ESP32_PORT) 115200
all: compile upload watch