diff --git a/Arduino/CanGrow/cangrow.sh b/Arduino/CanGrow/cangrow.sh index 8eac57d..5516010 100755 --- a/Arduino/CanGrow/cangrow.sh +++ b/Arduino/CanGrow/cangrow.sh @@ -101,14 +101,34 @@ case $1 in echo ":: Building firmware $VER $BUILD, target dir: $(pwd)/build/" #version_header test -d build || mkdir build - ${ACLI_CMD} --no-color compile -b ${BOARD} --build-property "build.extra_flags=-DCANGROW_VER=\"${VER}\" -DCANGROW_BUILD=\"${BUILD}\"" "CanGrow.ino" --output-dir build/ || exit 1 + + + # esp8266 and esp32 compiler have to use different compile flags for VER and BUILD + if [ "$(echo $BOARD | cut -d : -f1)" == "esp8266" ] + then + ${ACLI_CMD} --no-color compile -b ${BOARD} --build-property "build.extra_flags=-DCANGROW_VER=\"${VER}\" -DCANGROW_BUILD=\"${BUILD}\"" "CanGrow.ino" --output-dir build/ || exit 1 + elif [ "$(echo $BOARD | cut -d : -f1)" == "esp32" ] + then + ${ACLI_CMD} --no-color compile -b ${BOARD} --build-property "build.defines=-DCANGROW_VER=\"${VER}\" -DCANGROW_BUILD=\"${BUILD}\"" "CanGrow.ino" --output-dir build/ || exit 1 + fi + cp build/CanGrow.ino.bin build/CanGrow_v${VER}_${BUILD}.bin ;; u|upload) check_acli echo ":: Build and upload firmware $VER $BUILD to $TTY" #version_header - ${ACLI_CMD} --no-color compile -b ${BOARD} --build-property "build.extra_flags=-DCANGROW_VER=\"${VER}\" -DCANGROW_BUILD=\"${BUILD}\"" ${ACLI_BUILD_OPTS} -u -p $TTY "CanGrow.ino" + test -d build || mkdir build + + # esp8266 and esp32 compiler have to use different compile flags for VER and BUILD + if [ "$(echo $BOARD | cut -d : -f1)" == "esp8266" ] + then + ${ACLI_CMD} --no-color compile -b ${BOARD} --build-property "build.extra_flags=-DCANGROW_VER=\"${VER}\" -DCANGROW_BUILD=\"${BUILD}\"" ${ACLI_BUILD_OPTS} -u -p $TTY "CanGrow.ino" + elif [ "$(echo $BOARD | cut -d : -f1)" == "esp32" ] + then + ${ACLI_CMD} --no-color compile -b ${BOARD} --build-property "build.defines=-DCANGROW_VER=\"${VER}\" -DCANGROW_BUILD=\"${BUILD}\"" ${ACLI_BUILD_OPTS} -u -p $TTY "CanGrow.ino" + fi + ;; w|webupload) echo ":: Uploading to $IP"