File tree 3 files changed +17
-6
lines changed
3 files changed +17
-6
lines changed Original file line number Diff line number Diff line change 2
2
3
3
Build, upload and monitor arduino sketches from zsh. Reuses ` .vscode/arduino.json ` if available else you can set env vars.
4
4
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
+
5
16
### Needs
6
17
1 . [ arduino-cli] ( https://github.com/arduino/arduino-cli )
7
18
2 . ` jq ` - sudo apt install jq
Original file line number Diff line number Diff line change @@ -3,16 +3,16 @@ ar_build() {
3
3
if [[ -z $AR_FQBN ]]; then
4
4
ar_configure
5
5
fi
6
- op=$( arduino-cli compile -v --fqbn=$AR_FQBN $1)
6
+ arduino-cli compile -v --fqbn=$AR_FQBN $* | tee /tmp/_ar_build.log
7
7
error=$?
8
+ echo "*******************************"
8
9
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)
10
11
echo $AR_BIN
11
- return 0
12
12
else
13
13
echo "build failed!"
14
- echo $op
15
- return $error
16
14
fi
15
+ echo "*******************************"
16
+ return $error
17
17
}
18
18
Original file line number Diff line number Diff line change 1
1
2
2
ar_upload() {
3
3
if [[ -z $AR_BIN ]]; then
4
- ar_build
4
+ ar_build $*
5
5
fi
6
6
arduino-cli -v upload --fqbn=$AR_FQBN -i $AR_BIN -p $AR_PORT
7
7
}
You can’t perform that action at this time.
0 commit comments