feat: autodetect usb
This commit is contained in:
19
Makefile
19
Makefile
@@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user