Skip to content

Commit b32fc1e

Browse files
committed
fix build & upload with props
1 parent 538d907 commit b32fc1e

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

README.md

+11
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,17 @@
22

33
Build, upload and monitor arduino sketches from zsh. Reuses `.vscode/arduino.json` if available else you can set env vars.
44

5+
## Usage
6+
7+
1. In a sketch folder, run `ar_build`
8+
- If you have `.vscode/arduino.json`, then all flags - esp `fqbn` is pulled in from there.
9+
2. Setting compile time vars
10+
- `ar_build stm32-nrf24tx02.ino --build-properties='compiler.cpp.extra_flags=-DDEBUG`
11+
3. You can just run `ar_upload` directly - if a binary (`AR_BIN`) isn't set, then it will build & upload
12+
- to force build, use `ar_build; ar_upload`
13+
14+
15+
516
### Needs
617
1. [arduino-cli](https://github.com/arduino/arduino-cli)
718
2. `jq` - sudo apt install jq

ar_build

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@ ar_build() {
33
if [[ -z $AR_FQBN ]]; then
44
ar_configure
55
fi
6-
op=$(arduino-cli compile -v --fqbn=$AR_FQBN $1)
6+
arduino-cli compile -v --fqbn=$AR_FQBN $* | tee /tmp/_ar_build.log
77
error=$?
8+
echo "*******************************"
89
if [[ $error -eq 0 ]]; then
9-
AR_BIN=$(echo $op | grep '\.ino\.bin'| cut -d' ' -f5)
10+
AR_BIN=$(grep '\.ino\.bin' /tmp/_ar_build.log| cut -d' ' -f5)
1011
echo $AR_BIN
11-
return 0
1212
else
1313
echo "build failed!"
14-
echo $op
15-
return $error
1614
fi
15+
echo "*******************************"
16+
return $error
1717
}
1818

ar_upload

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
ar_upload() {
33
if [[ -z $AR_BIN ]]; then
4-
ar_build
4+
ar_build $*
55
fi
66
arduino-cli -v upload --fqbn=$AR_FQBN -i $AR_BIN -p $AR_PORT
77
}

0 commit comments

Comments
 (0)