Commit 5d6e6b88 authored by Nelso Jost's avatar Nelso Jost

FIX: Option for using Ino Tool or Arturo for build & upload firmware

parent bc2280e9
......@@ -2,8 +2,8 @@ PYVER := 3
VENV := .venv
INODIR := .ino
ARDUINO_PATH := ~/Downloads/arduino-1.6.5
ARTURO_ARDUINO_FLAG := #-d ${ARDUINO_PATH}
INO_OR_ANO := ino
ARDUINO_PATH := #-d ~/Downloads/arduino-1.6.5
all: help
......@@ -63,13 +63,19 @@ install: setup bu deploy-logger
uninstall: undeploy-logger clean-venv clean-ino
apt-install:
./tools/install.sh
./tools/apt-install.sh
arturo-install:
ano-install:
chmod +x tools/arturo-install.sh
./tools/arturo-install.sh
setup: apt-install venv arturo-install
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
setup: apt-install venv ${INO_OR_ANO}-install
venv:
@ echo "-------------------------------------------------------"
......@@ -92,17 +98,18 @@ 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/
ano list-models ${ARTURO_ARDUINO_FLAG}
${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}/ && ano build ${ARTURO_ARDUINO_FLAG} -m $${MODEL_CONF:-${MODEL}} && ano upload -m $${MODEL_CONF:-${MODEL}} ${ARTURO_ARDUINO_FLAG}
cd ${INODIR}/ && ${INO_OR_ANO} build ${ARDUINO_PATH} -m $${MODEL_CONF:-${MODEL}} && ${INO_OR_ANO} upload -m $${MODEL_CONF:-${MODEL}} ${ARDUINO_PATH}
bus: build upload serial
bus: bu serial
sync-rtc:
${VENV}/bin/python${PYVER} run.py --syncrtc
......
......@@ -326,7 +326,7 @@ class Meteorologger:
timeout=self.SERIAL_READ_TIMEOUT,
xonxoff=True)
print("Done! Check object 'ser'")
print("\nDone! Check object 'ser'")
return ser
except:
......
......@@ -5,14 +5,19 @@ from app import Meteorologger
ser = Meteorologger().get_serial()
def send(command_str):
def send(command_str, response_wait=0):
'''
Send the string 'command_str' to the serial port and return the response.
'''
ser.write(bytes(command_str, encoding='utf-8'))
time.sleep(1.5)
time.sleep(response_wait)
try:
raw = ser.readline()
raw = ser.readall()
return raw.decode('ascii').strip()
except:
print("Unable do decode raw line read:\n{}".format(raw))
print("\nExecuting send('help') ... waiting for board response ...")
s = send('help')
s = send('help')
print('\n' + s)
......@@ -69,6 +69,14 @@ String execute_command(String s)
{
return get_short_nicknames_str_list();
}
else if (command == "help")
{
String s = "";
return s + String("read,A1,A2,...,An\n") + \
String("setrtc,Y,M,D,H,M,S\n") + \
String("listNicknames\n") + \
String("listShortNicknames\n");
}
else
{
return String("<invalid_command:'") + s + String("'>");
......
......@@ -7,4 +7,3 @@ sudo $PIP3 install -v virtualenv
#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