Commit b206723a authored by Nelso Jost's avatar Nelso Jost
Browse files

NEW: installation is now independent of the firmware building

parent 637753f6
PYVER := 3
VENV := .venv
INODIR := .ino
INO_DIR := .ino
INO_OR_ANO := ino
ARDUINO_PATH := #-d ~/Downloads/arduino-1.6.5
USE := ino
ARDUINO :=#~/Downloads/arduino-1.6.5
all: help
......@@ -42,9 +42,9 @@ help-full:
@ echo ""
@ echo " sync-rtc -- Synchronizes the board's clock with the system's"
@ echo ""
@ echo " run-logger -- Starts the logger. Keep log at logger/logs"
@ echo " deploy-logger -- Activate logger daemon. Keep log at logger/logs/"
@ echo " undeploy-logger -- Deactivate logger daemon"
@ echo " run -- Starts the logger. Keep log at logger/logs"
@ echo " deploy -- Activate logger daemon. Keep log at logger/logs/"
@ echo " undeploy -- Deactivate logger daemon"
@ echo ""
@ echo " tail-log -- Exibits and follow last modified execution log file"
@ echo " tail-data -- Exibits and follow last modified datalog file"
......@@ -58,24 +58,27 @@ help-full:
@ echo " clean-all -- Performs all the above cleans"
@ echo ""
install: setup bu deploy-logger
install: setup deploy
uninstall: undeploy-logger clean-venv clean-ino
uninstall: undeploy clean-venv clean-ino
firmware: bu
apt-install:
./tools/apt-install.sh
@ if [ ! -d "${VENV}" ]; then \
chmod +x scripts/apt-install.sh \
./scripts/apt-install.sh; \
fi
ano-install:
chmod +x tools/arturo-install.sh
./tools/arturo-install.sh
chmod +x scripts/ano-install.sh
./scripts/ano-install.sh
ino-install:
@ echo "Finding pip2 binary.."
@PIP2=`dpkg -L python-pip | grep /usr/bin/pip | tail -1`;\
echo "Got it! PIP2=$$PIP2";\
sudo $$PIP2 install -v ino
chmod +x scripts/ino-install.sh
./scripts/ino-install.sh
setup: apt-install venv ${INO_OR_ANO}-install
setup: apt-install venv
venv:
@ echo "-------------------------------------------------------"
......@@ -97,31 +100,23 @@ clean-venv:
serial:
${VENV}/bin/ipython -i logger/init_serial.py
bu:
rm -rf ${INODIR}
mkdir -p ${INODIR}
mkdir -p ${INODIR}/src/ ${INODIR}/lib/
cp -rf meteorolog/. ${INODIR}/src/
${INO_OR_ANO} list-models ${ARDUINO_PATH}
@ echo "Getting board model from settings.yaml"
$(eval MODEL := $(shell cd logger && ../${VENV}/bin/python -c "from app import Meteorologger; print(Meteorologger().CFG['ARDUINO']['BOARD_MODEL'])"))
@ echo ""
@ read -p "Type your board model (or hit ENTER to proceed with '${MODEL}'): " MODEL_CONF; \
cd ${INODIR}/ && ${INO_OR_ANO} build ${ARDUINO_PATH} -m $${MODEL_CONF:-${MODEL}} && ${INO_OR_ANO} upload -m $${MODEL_CONF:-${MODEL}} ${ARDUINO_PATH}
bu: ${USE}-install
chmod +x scripts/ino-build.sh
./scripts/ino-build.sh ${USE} ${INO_DIR} ${ARDUINO}
bus: bu serial
sync-rtc:
${VENV}/bin/python${PYVER} run.py --syncrtc
run-logger:
run:
${VENV}/bin/python logger/run.py
deploy-logger: undeploy-logger
deploy: undeploy
mkdir -p logger/logs
sudo ${VENV}/bin/python${PYVER} logger/deploy.py
undeploy-logger:
undeploy:
sudo ${VENV}/bin/python${PYVER} logger/deploy.py -u
tail-log:
......@@ -131,10 +126,6 @@ tail-log:
@ echo ""
@ tail -F logger/logs/$(TMP)
plot-data:
@ echo "Quit by closing the window with Q and hitting Ctrl+C here to end the process"
@ cd tools && gnuplot -persist -e "config='config.plt'; col=${col}" loop.plt
tail-data:
$(eval TMP := $(shell ls -t -I outgoing* data/ | head -n 1))
@ echo "Last datalog file updated: data/$(TMP)"
......@@ -145,6 +136,10 @@ tail-data:
@ echo ""
@ tail -F data/$(TMP)
plot-data:
@ echo "Quit by closing the window with Q and hitting Ctrl+C here to end the process"
@ cd tools && gnuplot -persist -e "config='config.plt'; col=${col}" loop.plt
clean-data:
rm -rfv data/*.csv data/outgoing/*.json
......
if ! type ano > /dev/null; then
mkdir -p .arturo-temp
cd .arturo-temp && wget https://github.com/scottdarch/Arturo/archive/master.zip
unzip master.zip
cd Arturo-master && sudo python setup.py install
cd ../.. && sudo rm -rf .arturo-temp
else
echo "[OK] Arturo tool exists.";
fi
ano list-models > /dev/null
if [ ! $? -eq 0 ]; then
printf "\nArturo (http://32bits.io/Arturo/) tool seems not be working with your system's Arduino instalation. Here is what 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 BUILD_WITH=ano ARDUINO=~/Downloads/arduino-1.6.5\n"
printf "\n * Simply use de Arduino IDE to compile and upload the firmware yourself.\n"
else
echo "[OK] Arturo tool seems to work."
fi
#sudo apt-get purge python3-pip python-pip
sudo apt-get update
sudo apt-get install python python3 python3-pip supervisor python-pip
echo "Finding pip3 binary.."
PIP3=`dpkg -L python3-pip | grep /usr/bin/pip | tail -1`
echo "PIP3=$PIP3"
sudo $PIP3 install -v virtualenv
#PIP2=`dpkg -L python-pip | grep /usr/bin/pip | tail -1`
#echo "PIP2=$PIP2"
#sudo $PIP2 install -v ino
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
#!/bin/bash
#if [ ! ino_loc="$(type -p ino)" || [ -z "ino" ]]; then
if ! type ino > /dev/null; then
# caso o comando 'ino' esteja disponível
# echo "I need the 'ino' command line tool (inotool.org) to be installed";
sudo apt-get update
sudo apt-get install python-pip arduino;
echo "Finding pip2 binary..";
PIP2=`dpkg -L python-pip | grep /usr/bin/pip | tail -1`;
echo "Got it! PIP2=$PIP2";
sudo $PIP2 install -v ino;
ino --version
else
echo "[OK] Ino Tool exists.";
fi
inno list-models > /dev/null
if [ ! $? -eq 0 ]; then
printf "\nIno Tool (http://inotool.org/) seems not be working with your system's Arduino instalation. Here is what 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.0.5\n"
printf "\n BEWARE: Ino Tool only support versions 1.0.x of the Arduino toolchain!\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 PS: Arturo DOES support newer versions of the Arduino toolchain.\n"
printf "\n * Simply use de Arduino IDE to compile meteorolog/meteorolog.ino and upload the firmware yourself.\n"
else
echo "[OK] Ino Tools seems to work."
fi
......@@ -42,12 +42,6 @@ ARDUINO:
#
BAUD_RATE: 9600
# board model used for Ino Tool compilation process
# see all supported with the command: $ ino list-models
# commom possibilities: atmega328 (for duemilanove), mega, mega2560
#
BOARD_MODEL: uno
DATALOG:
# CSV delimiter to be used on the file DATA_LOG_FILENAME
# Sugestions: ',' or ';' or '\t' for tab (do not use the period '.')
......
mkdir -p .arturo-temp
cd .arturo-temp && wget https://github.com/scottdarch/Arturo/archive/master.zip
unzip master.zip
cd Arturo-master && sudo python setup.py install
cd ../.. && sudo rm -rf .arturo-temp
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment