From 73f017cd2f76a55fd2a23c9e54d7d6173f5ad638 Mon Sep 17 00:00:00 2001 From: Marcus Date: Thu, 17 Oct 2024 15:26:41 +0200 Subject: [PATCH] cangrow.sh tweaks --- cangrow.sh | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/cangrow.sh b/cangrow.sh index cd73a93..c11bf98 100755 --- a/cangrow.sh +++ b/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"