diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/Makefile | 26 |
1 files 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 | |||
92 | endif | 92 | endif |
93 | endif | 93 | endif |
94 | 94 | ||
95 | BUILD_DIR := $(subst :,.,build/$(FQBN)) | 95 | BUILD_DIR != arduino-cli compile -b $(FQBN) --show-properties | sed -ne 's/^build.path=//p' |
96 | 96 | ||
97 | SRC := $(wildcard *.ino) | 97 | SRC := main.ino |
98 | HDRS := $(wildcard *.h) | 98 | HDRS := $(wildcard *.h) |
99 | BIN := $(BUILD_DIR)/$(SRC).bin | 99 | BIN := $(BUILD_DIR)/main.ino.bin |
100 | ELF := $(BUILD_DIR)/$(SRC).elf | 100 | ELF := $(BUILD_DIR)/main.ino.elf |
101 | 101 | ||
102 | $(info FQBN is [${FQBN}]) | 102 | $(info FQBN is [${FQBN}]) |
103 | $(info IOT_NAME is [${IOT_NAME}]) | 103 | $(info IOT_NAME is [${IOT_NAME}]) |
@@ -134,20 +134,12 @@ upload: | |||
134 | arduino-cli upload -b $(FQBN) -p $(SERIAL_DEV) $(VFLAG); \ | 134 | arduino-cli upload -b $(FQBN) -p $(SERIAL_DEV) $(VFLAG); \ |
135 | fi | 135 | fi |
136 | 136 | ||
137 | PLAT_PATH != arduino-cli compile -b "$(FQBN)" --show-properties | grep '^runtime.platform.path' | awk -F= '{print $$2}' | ||
138 | PY_PATH != arduino-cli compile -b "$(FQBN)" --show-properties | grep '^runtime.tools.python3.path' | awk -F= '{print $$2}' | ||
139 | IOT_IP != getent ahostsv4 esp8266-mush.local | (read ip _; echo $$ip) | ||
140 | |||
137 | ota: | 141 | ota: |
138 | @PLAT_PATH=`arduino-cli compile -b $(FQBN) --show-properties | grep '^runtime.platform.path' | awk -F= '{print $$2}'` ; \ | 142 | "$(PY_PATH)/python3" "$(PLAT_PATH)/tools/espota.py" -i "$(IOT_IP)" -p "$(OTA_PORT)" --auth="$(OTA_PASS)" -f "$(BIN)" |
139 | PY_PATH=`arduino-cli compile -b $(FQBN) --show-properties | grep '^runtime.tools.python3.path' | awk -F= '{print $$2}'` ; \ | ||
140 | IOT_IP=`avahi-browse _arduino._tcp --resolve --parsable --terminate|grep -i ';$(IOT_NAME);'|grep ';$(OTA_PORT);'| awk -F\; '{print $$8}'|head -1`; \ | ||
141 | BINFILE=$(wildcard $(BUILD_DIR)/$(SRC)*bin); \ | ||
142 | echo "PLAT_PATH is [$$PLAT_PATH]" ; \ | ||
143 | echo "PY_PATH: is [$$PY_PATH]" ; \ | ||
144 | echo "IOT_IP: is [$$IOT_IP]" ; \ | ||
145 | echo "BINFILE: is [$$BINFILE]" ; \ | ||
146 | if [ "$$IOT_IP" = "" ] ; \ | ||
147 | then echo "Unable to find device IP. Check that the IOT_NAME environment variable is correctly set. Use 'make find' to search devices"; \ | ||
148 | else echo "---> Uploading Over The Air"; \ | ||
149 | $$PY_PATH/python3 $$PLAT_PATH/tools/espota.py -i $$IOT_IP -p $(OTA_PORT) --auth=$(OTA_PASS) -f $$BINFILE ;\ | ||
150 | fi | ||
151 | 143 | ||
152 | clean: | 144 | clean: |
153 | @echo "---> Cleaning the build directory" | 145 | @echo "---> Cleaning the build directory" |