BUILD_TOOL=$1 # can be 'ino' or 'ano' INO_DIR=$2 # provided by the Makefile ARDUINO=$3 # toolchain path (defaults to empty) if [ "$ARDUINO" = '' ]; then printf "\nTrying to use the system's Arduino Installation\n\n"; else ARDUINO_PATH="-d $ARDUINO" printf "\nUsing Arduino at $ARDUINO\n\n" fi rm -rf $INO_DIR mkdir -p $INO_DIR mkdir -p $INO_DIR/src/ $INO_DIR/lib/ cp -rf meteorolog/. $INO_DIR/src/ $BUILD_TOOL list-models $ARDUINO_PATH #@ echo "\nGetting board model from settings.yaml" # $(eval MODEL := $(shell cd logger && ../${VENV}/bin/python -c "from app import Meteorologger; print(Meteorologger().CFG['ARDUINO']['BOARD_MODEL'])")) printf "\n" DEFAULT_MODEL=uno read -p "Type your board model (or hit ENTER to proceed with 'uno'): " MODEL_CONF; cd ${INO_DIR}/ && $BUILD_TOOL build $ARDUINO_PATH -m ${MODEL_CONF:-$DEFAULT_MODEL} && $BUILD_TOOL upload -m ${MODEL_CONF:-$DEFAULT_MODEL} ${ARDUINO_PATH} if [ ! $? -eq 0 ]; then printf "\nSomething went wrong with the build & upload process when using '$BUILD_TOOL' command line tool. Probably there is some icompatibility with it and the Arduino toolchain $ARDUINO.\n\nHere is what else you can try:\n" printf "\n * Specify a new Arduino toolchain (for instance, downloaded at https://www.arduino.cc/en/Main/Software) with:\n" printf "\n $ make bu ARDUINO=~/Downloads/arduino-1.6.5\n" printf "\n * Use the Arturo tool (http://32bits.io/Arturo/):\n" printf "\n $ make bu USE=ano\n" printf " $ make bu USE=ano ARDUINO=~/Downloads/arduino-1.6.5\n" printf "\n * Simply use de Arduino IDE to compile meteorolog/meteorolog.ino and upload the firmware yourself.\n" fi