Commit bc2280e9 authored by Nelso Jost's avatar Nelso Jost

NEW: uses Arturo for command line build & upload

parent a7c6ddba
......@@ -2,6 +2,9 @@ PYVER := 3
VENV := .venv
INODIR := .ino
ARDUINO_PATH := ~/Downloads/arduino-1.6.5
ARTURO_ARDUINO_FLAG := #-d ${ARDUINO_PATH}
all: help
help:
......@@ -33,10 +36,8 @@ help-full:
@ echo " venv -- Creates a Python local virtual environment at ${VENV}"
@ echo " setup -- apt-install & venv"
@ echo ""
@ echo " build -- Compile the sketch usin Ino Tool"
@ echo " upload -- Send the compiled sketch to the board using Ino Tool"
@ echo " serial -- Enter IPython session with serial opened"
@ echo " bu -- build & upload"
@ echo " bu -- build & upload firmware (with Arturo)"
@ echo " bus -- build & upload & serial"
@ echo ""
@ echo " sync-rtc -- Synchronizes the board's clock with the system's"
......@@ -64,7 +65,11 @@ uninstall: undeploy-logger clean-venv clean-ino
apt-install:
./tools/install.sh
setup: apt-install venv
arturo-install:
chmod +x tools/arturo-install.sh
./tools/arturo-install.sh
setup: apt-install venv arturo-install
venv:
@ echo "-------------------------------------------------------"
......@@ -76,30 +81,13 @@ venv:
${VENV}/bin/pip install -r logger/requirements.pip
@ echo "-------------------------------------------------------"
@ echo "Virtualenv is ready at ${VENV}!"
@ echo " "
@ echo " "~/Downloads/arduino-1.0.1
@ echo "TOTAL SIZE: "
@ du -sh ${VENV}
clean-venv:
rm -rf ${VENV}
build:
mkdir -p ${INODIR}
mkdir -p ${INODIR}/src/ ${INODIR}/lib/
cp -rf meteorolog/. ${INODIR}/src/
ino list-models
@ 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 build -m $${MODEL_CONF:-${MODEL}}
upload:
@ 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 "MODEL = $(MODEL)"
cd ${INODIR}/ && ino upload -m $(MODEL)
serial:
${VENV}/bin/ipython -i logger/init_serial.py
......@@ -107,12 +95,12 @@ bu:
mkdir -p ${INODIR}
mkdir -p ${INODIR}/src/ ${INODIR}/lib/
cp -rf meteorolog/. ${INODIR}/src/
ino list-models
ano list-models ${ARTURO_ARDUINO_FLAG}
@ 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 build -m $${MODEL_CONF:-${MODEL}} && ino upload -m $${MODEL_CONF:-${MODEL}}
cd ${INODIR}/ && ano build ${ARTURO_ARDUINO_FLAG} -m $${MODEL_CONF:-${MODEL}} && ano upload -m $${MODEL_CONF:-${MODEL}} ${ARTURO_ARDUINO_FLAG}
bus: build upload serial
......
......@@ -317,7 +317,7 @@ class Meteorologger:
port_index = 0
while True:
serial_port = self.SERIAL_PORTS[port_index]
serial_port = self.CFG['ARDUINO']['SERIAL_PORTS'][port_index]
try:
print("\n" + "="*60)
print("Attempting serial connection at {}".format(serial_port))
......@@ -332,7 +332,7 @@ class Meteorologger:
except:
print("Unable do establish the connection.")
if port_index < len(self.SERIAL_PORTS) - 1:
if port_index < len(self.CFG['ARDUINO']['SERIAL_PORTS'])-1:
port_index += 1
else:
port_index = 0
......
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
......@@ -3,7 +3,8 @@ 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"
PIP2=`dpkg -L python-pip | grep /usr/bin/pip | tail -1`
echo "PIP2=$PIP2"
sudo $PIP3 install -v virtualenv
sudo $PIP2 install -v ino
#PIP2=`dpkg -L python-pip | grep /usr/bin/pip | tail -1`
#echo "PIP2=$PIP2"
#sudo $PIP2 install -v ino
# cd tools/arturo && python setup.py install
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