From abb79ebeccbc83c019a2bb016c057841415479b8 Mon Sep 17 00:00:00 2001 From: DeltaLima Date: Fri, 13 Dec 2024 20:50:29 +0100 Subject: [PATCH] firmware - change to set version in CanGrow_Version.h, build by cangrow.sh --- Arduino/CanGrow/CanGrow.ino | 8 -------- Arduino/CanGrow/CanGrow_Version.h | 13 +++++++++++++ Arduino/CanGrow/CanGrow_WebFunctions.h | 2 +- cangrow.sh | 6 ++++-- 4 files changed, 18 insertions(+), 11 deletions(-) create mode 100644 Arduino/CanGrow/CanGrow_Version.h diff --git a/Arduino/CanGrow/CanGrow.ino b/Arduino/CanGrow/CanGrow.ino index 7e8cc63..4fae1e7 100644 --- a/Arduino/CanGrow/CanGrow.ino +++ b/Arduino/CanGrow/CanGrow.ino @@ -4,14 +4,6 @@ */ -// set CANGROW_VER and CANGROW_BUILD if not already done as Compiler Flag -#ifndef CANGROW_VER - #define CANGROW_VER "0.0.0-dev" -#endif -#ifndef CANGROW_BUILD - #define CANGROW_BUILD "1a2b3c4-0000000000000" -#endif - /* * Includes * diff --git a/Arduino/CanGrow/CanGrow_Version.h b/Arduino/CanGrow/CanGrow_Version.h new file mode 100644 index 0000000..2e4fd74 --- /dev/null +++ b/Arduino/CanGrow/CanGrow_Version.h @@ -0,0 +1,13 @@ +/* + * + * + * Version + * + * + */ + +#define CANGROW_VER "0.1.4-dev" +// CANGROW_BUILD default dummy value if not set as Compiler Flag +#ifndef CANGROW_BUILD + #define CANGROW_BUILD "1a2b3c4-0000000000000" +#endif diff --git a/Arduino/CanGrow/CanGrow_WebFunctions.h b/Arduino/CanGrow/CanGrow_WebFunctions.h index 7599a35..18b98ff 100644 --- a/Arduino/CanGrow/CanGrow_WebFunctions.h +++ b/Arduino/CanGrow/CanGrow_WebFunctions.h @@ -383,7 +383,7 @@ void WEBroot() { body += returnStrDateFromEpoch(GrowStart); body += "
\n"; body += "Harvest date (est.): 🍂 "; - body += returnStrDateFromEpoch(GrowStart + (60 * 60 * 24 * (DaysVeg + DaysVeg) ) ); + body += returnStrDateFromEpoch(GrowStart + (60 * 60 * 24 * (DaysVeg + DaysBloom) ) ); body += "
\n"; body += "Day of Grow: "; if(DayNight == true) { diff --git a/cangrow.sh b/cangrow.sh index 1113622..337f037 100755 --- a/cangrow.sh +++ b/cangrow.sh @@ -3,7 +3,8 @@ test -z $TTY && TTY="/dev/ttyUSB0" test -z $IP && IP="192.168.4.20" -test -z $VER && VER="0.1.4-dev" + +VER="$(grep "define CANGROW_VER" Arduino/CanGrow/CanGrow_Version.ino | cut -d \" -f2 |sed -e 's/\"//g')" BUILD="$(git rev-parse --short HEAD)-$(date '+%Y%m%d%H%M%S')" ACLI="$HOME/.local/bin/arduino-cli" @@ -74,7 +75,8 @@ case $1 in check_acli echo ":: Building firmware $VER $BUILD, target dir: $(pwd)/build/" test -d build || mkdir build - ${ACLI_CMD} --no-color compile -b ${BOARD} "Arduino/CanGrow/CanGrow.ino" --build-property "build.extra_flags=-DCANGROW_VER=\"${VER}\" -DCANGROW_BUILD=\"${BUILD}\"" --output-dir build/ || exit 1 + ${ACLI_CMD} --no-color compile -b ${BOARD} "Arduino/CanGrow/CanGrow.ino" --build-property "build.extra_flags=-DCANGROW_BUILD=\"${BUILD}\"" --output-dir build/ || exit 1 + #${ACLI_CMD} --no-color compile -b ${BOARD} "Arduino/CanGrow/CanGrow.ino" --build-property "build.extra_flags=-DCANGROW_VER=\"${VER}\" -DCANGROW_BUILD=\"${BUILD}\"" --output-dir build/ || exit 1 cp build/CanGrow.ino.bin build/CanGrow_v${VER}_${BUILD}.bin ;; u|upload)