Add Makefile shortcuts for goTool and ignore built binary.
Expose common gotool targets (build, clients, version, unicast-test, deadzone) with configurable PORT, and add goTool/.gitignore for gotool. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
241e82b35b
commit
20fea02b78
46
Makefile
46
Makefile
@ -1,5 +1,17 @@
|
|||||||
|
# Serial port for goTool (override: make gotool-clients PORT=/dev/ttyACM0)
|
||||||
|
PORT ?= /dev/ttyUSB0
|
||||||
|
|
||||||
|
GOTOOL_DIR := goTool
|
||||||
|
GOTOOL := $(GOTOOL_DIR)/gotool
|
||||||
|
GOTOOL_RUN := cd $(GOTOOL_DIR) && go run . -port $(PORT)
|
||||||
|
|
||||||
|
.PHONY: default proto_generate proto_generate_uart proto_generate_espnow \
|
||||||
|
gotool-build gotool-proto gotool-tidy \
|
||||||
|
gotool-version gotool-clients gotool-unicast-test gotool-deadzone-get gotool-deadzone-set
|
||||||
|
|
||||||
default:
|
default:
|
||||||
echo "no default rule"
|
@echo "Targets: proto_generate gotool-build gotool-clients gotool-version …"
|
||||||
|
@echo "Set PORT=$(PORT) (current) for goTool targets."
|
||||||
|
|
||||||
proto_generate_uart:
|
proto_generate_uart:
|
||||||
python libs/nanopb/generator/nanopb_generator.py main/proto/uart_messages.proto
|
python libs/nanopb/generator/nanopb_generator.py main/proto/uart_messages.proto
|
||||||
@ -8,3 +20,35 @@ proto_generate_espnow:
|
|||||||
python libs/nanopb/generator/nanopb_generator.py main/proto/esp_now_messages.proto
|
python libs/nanopb/generator/nanopb_generator.py main/proto/esp_now_messages.proto
|
||||||
|
|
||||||
proto_generate: proto_generate_uart proto_generate_espnow
|
proto_generate: proto_generate_uart proto_generate_espnow
|
||||||
|
|
||||||
|
gotool-proto:
|
||||||
|
cd $(GOTOOL_DIR) && protoc --go_out=./pb --go_opt=paths=source_relative \
|
||||||
|
--go_opt=Muart_messages.proto=powerpod/gotool/pb \
|
||||||
|
-I ../main/proto ../main/proto/uart_messages.proto
|
||||||
|
|
||||||
|
gotool-tidy:
|
||||||
|
cd $(GOTOOL_DIR) && go mod tidy
|
||||||
|
|
||||||
|
gotool-build: gotool-tidy
|
||||||
|
cd $(GOTOOL_DIR) && go build -o gotool .
|
||||||
|
|
||||||
|
gotool-version: $(GOTOOL)
|
||||||
|
$(GOTOOL) -port $(PORT) version
|
||||||
|
|
||||||
|
gotool-clients: $(GOTOOL)
|
||||||
|
$(GOTOOL) -port $(PORT) clients
|
||||||
|
|
||||||
|
# CLIENT=<slave id> SEQ=42 (optional)
|
||||||
|
gotool-unicast-test: $(GOTOOL)
|
||||||
|
@test -n "$(CLIENT)" || (echo "Usage: make gotool-unicast-test CLIENT=16 [SEQ=42]"; exit 1)
|
||||||
|
$(GOTOOL) -port $(PORT) unicast-test -client $(CLIENT) -seq $(or $(SEQ),1)
|
||||||
|
|
||||||
|
gotool-deadzone-get: $(GOTOOL)
|
||||||
|
$(GOTOOL) -port $(PORT) deadzone -client $(or $(CLIENT),0)
|
||||||
|
|
||||||
|
# DEADZONE=100 CLIENT=0 (local) or slave id
|
||||||
|
gotool-deadzone-set: $(GOTOOL)
|
||||||
|
@test -n "$(DEADZONE)" || (echo "Usage: make gotool-deadzone-set DEADZONE=100 [CLIENT=16]"; exit 1)
|
||||||
|
$(GOTOOL) -port $(PORT) deadzone -set -value $(DEADZONE) -client $(or $(CLIENT),0)
|
||||||
|
|
||||||
|
$(GOTOOL): gotool-build
|
||||||
|
|||||||
7
goTool/.gitignore
vendored
Normal file
7
goTool/.gitignore
vendored
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# Built binary (make gotool-build)
|
||||||
|
/gotool
|
||||||
|
|
||||||
|
# Go toolchain artifacts
|
||||||
|
*.exe
|
||||||
|
*.test
|
||||||
|
*.out
|
||||||
Loading…
x
Reference in New Issue
Block a user