Default ESP-NOW channel is now 11. Adds the bare ESP-NOW-only build option (CONFIG_LED_ESPNOW_ONLY) with its sdkconfig fragments, a default hostname from the Wi-Fi MAC, and the related net, link, web and settings changes. Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
102 lines
3.0 KiB
Makefile
102 lines
3.0 KiB
Makefile
# Top-level Makefile for the led_strip ESP-IDF project.
|
|
# Thin wrapper around idf.py. Runs on Linux, macOS (bash) and Windows (GNU make with cmd.exe or sh).
|
|
#
|
|
# Override any variable on the command line, for example:
|
|
# make flash PORT=/dev/ttyUSB0 # Linux
|
|
# make flash PORT=/dev/cu.usbmodem101 # macOS
|
|
# make flash PORT=COM4 # Windows
|
|
|
|
ifeq ($(OS),Windows_NT)
|
|
HOST_OS := windows
|
|
HOME_DIR := $(USERPROFILE)
|
|
DEFAULT_PORT := COM3
|
|
else
|
|
HOST_OS := $(shell uname -s)
|
|
HOME_DIR := $(HOME)
|
|
ifeq ($(HOST_OS),Darwin)
|
|
DEFAULT_PORT := /dev/cu.usbmodem101
|
|
else
|
|
DEFAULT_PORT := /dev/ttyACM0
|
|
endif
|
|
endif
|
|
|
|
IDF_PATH ?= $(HOME_DIR)/.espressif/v6.1/esp-idf
|
|
IDF_PYTHON_ENV_PATH ?= $(HOME_DIR)/.espressif/python_env/idf6.1_py3.12_env
|
|
PORT ?= $(DEFAULT_PORT)
|
|
|
|
export IDF_PATH
|
|
export IDF_PYTHON_ENV_PATH
|
|
|
|
# Run idf.py in a shell that has sourced ESP-IDF's environment script (sets PATH and toolchains).
|
|
ifeq ($(HOST_OS),windows)
|
|
define idf
|
|
cmd /c "$(subst /,\,$(IDF_PATH))\export.bat && idf.py $(1)"
|
|
endef
|
|
else
|
|
define idf
|
|
bash -c '. "$(IDF_PATH)/export.sh" >/dev/null 2>&1 && idf.py $(1)'
|
|
endef
|
|
endif
|
|
|
|
# A running led-controller (desktop or `make rig`) probes every serial port while it looks for a bridge
|
|
# board, and a probe in the middle of a flash breaks the write (the erase still gets through). The flash
|
|
# and erase targets stop while one runs; FORCE=1 flashes anyway. Not checked on Windows.
|
|
APP_PROCS := led-controller|led_controller_
|
|
|
|
.PHONY: all no-app build flash erase monitor flash-monitor menuconfig clean fullclean help
|
|
|
|
all: build
|
|
|
|
ifeq ($(HOST_OS),windows)
|
|
no-app:
|
|
else
|
|
no-app:
|
|
@pids=$$(pgrep -x '$(APP_PROCS)' | xargs); \
|
|
if [ -n "$$pids" ] && [ -z "$(FORCE)" ]; then \
|
|
echo "led-controller is running (pid $$pids). It probes serial ports and breaks flashing: quit it first, or add FORCE=1."; \
|
|
exit 1; \
|
|
fi
|
|
endif
|
|
|
|
build:
|
|
$(call idf,build)
|
|
|
|
flash: no-app build
|
|
$(call idf,-p $(PORT) flash)
|
|
|
|
# Erase the whole flash on PORT (firmware and stored settings); make flash afterwards
|
|
erase: no-app
|
|
$(call idf,-p $(PORT) erase-flash)
|
|
|
|
monitor:
|
|
$(call idf,-p $(PORT) monitor)
|
|
|
|
flash-monitor: no-app build
|
|
$(call idf,-p $(PORT) flash monitor)
|
|
|
|
menuconfig:
|
|
$(call idf,menuconfig)
|
|
|
|
clean:
|
|
$(call idf,clean)
|
|
|
|
fullclean:
|
|
$(call idf,fullclean)
|
|
|
|
help:
|
|
@echo Targets:
|
|
@echo build Build the firmware
|
|
@echo flash Build, then flash to the board on PORT
|
|
@echo erase Erase the whole flash on PORT, stored settings included
|
|
@echo monitor Open the serial monitor on PORT
|
|
@echo flash-monitor Build, flash, then open the serial monitor
|
|
@echo menuconfig Open the project configuration menu
|
|
@echo clean Remove build outputs
|
|
@echo fullclean Delete the build directory entirely
|
|
@echo help Show this help
|
|
|
|
# Over-the-air update over Wi-Fi (the access point or the home network): make ota HOST=<ip or name>
|
|
ota: HOST ?= led.local
|
|
ota: build
|
|
python3 tools/ota.py $(HOST)
|