From 4d2c1e3093706bb59f08304fa3b96b7e650bec99 Mon Sep 17 00:00:00 2001 From: Steven Date: Thu, 30 Sep 2021 15:16:44 -0400 Subject: fixed makefile for ota --- src/main/Makefile | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/src/main/Makefile b/src/main/Makefile index f77db85..8b136e6 100644 --- a/src/main/Makefile +++ b/src/main/Makefile @@ -92,12 +92,12 @@ ifndef SERIAL_DEV endif endif -BUILD_DIR := $(subst :,.,build/$(FQBN)) +BUILD_DIR != arduino-cli compile -b $(FQBN) --show-properties | sed -ne 's/^build.path=//p' -SRC := $(wildcard *.ino) +SRC := main.ino HDRS := $(wildcard *.h) -BIN := $(BUILD_DIR)/$(SRC).bin -ELF := $(BUILD_DIR)/$(SRC).elf +BIN := $(BUILD_DIR)/main.ino.bin +ELF := $(BUILD_DIR)/main.ino.elf $(info FQBN is [${FQBN}]) $(info IOT_NAME is [${IOT_NAME}]) @@ -134,20 +134,12 @@ upload: arduino-cli upload -b $(FQBN) -p $(SERIAL_DEV) $(VFLAG); \ fi +PLAT_PATH != arduino-cli compile -b "$(FQBN)" --show-properties | grep '^runtime.platform.path' | awk -F= '{print $$2}' +PY_PATH != arduino-cli compile -b "$(FQBN)" --show-properties | grep '^runtime.tools.python3.path' | awk -F= '{print $$2}' +IOT_IP != getent ahostsv4 esp8266-mush.local | (read ip _; echo $$ip) + ota: - @PLAT_PATH=`arduino-cli compile -b $(FQBN) --show-properties | grep '^runtime.platform.path' | awk -F= '{print $$2}'` ; \ - PY_PATH=`arduino-cli compile -b $(FQBN) --show-properties | grep '^runtime.tools.python3.path' | awk -F= '{print $$2}'` ; \ - IOT_IP=`avahi-browse _arduino._tcp --resolve --parsable --terminate|grep -i ';$(IOT_NAME);'|grep ';$(OTA_PORT);'| awk -F\; '{print $$8}'|head -1`; \ - BINFILE=$(wildcard $(BUILD_DIR)/$(SRC)*bin); \ - echo "PLAT_PATH is [$$PLAT_PATH]" ; \ - echo "PY_PATH: is [$$PY_PATH]" ; \ - echo "IOT_IP: is [$$IOT_IP]" ; \ - echo "BINFILE: is [$$BINFILE]" ; \ - if [ "$$IOT_IP" = "" ] ; \ - then echo "Unable to find device IP. Check that the IOT_NAME environment variable is correctly set. Use 'make find' to search devices"; \ - else echo "---> Uploading Over The Air"; \ - $$PY_PATH/python3 $$PLAT_PATH/tools/espota.py -i $$IOT_IP -p $(OTA_PORT) --auth=$(OTA_PASS) -f $$BINFILE ;\ - fi + "$(PY_PATH)/python3" "$(PLAT_PATH)/tools/espota.py" -i "$(IOT_IP)" -p "$(OTA_PORT)" --auth="$(OTA_PASS)" -f "$(BIN)" clean: @echo "---> Cleaning the build directory" -- cgit v1.2.3