.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: @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: @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