cangrow.sh tweaks
This commit is contained in:
parent
e82046d297
commit
73f017cd2f
1 changed files with 14 additions and 9 deletions
23
cangrow.sh
23
cangrow.sh
|
@ -6,7 +6,7 @@ test -z $IP && IP="192.168.30.212"
|
|||
test -z $VER && VER="0.2-dev"
|
||||
test -z $BOARD && BOARD="esp8266:esp8266:d1_mini_clone"
|
||||
|
||||
BUILD="$(git rev-parse --short HEAD)-$(date '+%Y%m%d%H%M%S')"
|
||||
BUILD="$(git rev-parse --short HEAD)-$(echo $BOARD | cut -d : -f1)-$(date '+%Y%m%d%H%M%S')"
|
||||
|
||||
ACLI="$HOME/.local/bin/arduino-cli"
|
||||
ACLI_CMD="$ACLI --config-file arduino-cli.yml"
|
||||
|
@ -29,6 +29,14 @@ function check_acli() {
|
|||
fi
|
||||
}
|
||||
|
||||
function version_header() {
|
||||
echo "/* CanGrow_Version.h gets generated from cangrow.sh */
|
||||
|
||||
const char* CanGrowVer = \"${VER}\";
|
||||
const char* CanGrowBuild = \"${BUILD}\";
|
||||
" > Arduino/CanGrow/include/CanGrow_Version.h
|
||||
}
|
||||
|
||||
test -z $1 && help
|
||||
|
||||
case $1 in
|
||||
|
@ -74,19 +82,16 @@ case $1 in
|
|||
b|build)
|
||||
check_acli
|
||||
echo ":: Building firmware $VER $BUILD, target dir: $(pwd)/build/"
|
||||
version_header
|
||||
test -d build || mkdir build
|
||||
echo "/* CanGrow_Version.h gets generated from cangrow.sh */
|
||||
|
||||
const char* CanGrowVer = \"${VER}\";
|
||||
const char* CanGrowBuild = \"${BUILD}\";
|
||||
" > Arduino/CanGrow/include/CanGrow_Version.h
|
||||
${ACLI_CMD} --no-color compile -b ${BOARD} "Arduino/CanGrow/CanGrow.ino" --output-dir build/ || exit 1
|
||||
${ACLI_CMD} --no-color compile -v -b ${BOARD} "Arduino/CanGrow/CanGrow.ino" --output-dir build/ || exit 1
|
||||
cp build/CanGrow.ino.bin build/CanGrow_v${VER}_${BUILD}.bin
|
||||
;;
|
||||
u|upload)
|
||||
check_acli
|
||||
echo ":: Uploading to $TTY"
|
||||
${ACLI_CMD} --no-color compile -v -b ${BOARD} -u -p $TTY "Arduino/CanGrow/CanGrow.ino"
|
||||
echo ":: Build and upload firmware $VER $BUILD to $TTY"
|
||||
version_header
|
||||
${ACLI_CMD} --no-color compile -b ${BOARD} -u -p $TTY "Arduino/CanGrow/CanGrow.ino"
|
||||
;;
|
||||
w|webupload)
|
||||
echo ":: Uploading to $IP"
|
||||
|
|
Loading…
Reference in a new issue