diff --git a/robots/little_john/telemetry/code/monitor/graph_plotter_rewrite.py b/robots/little_john/telemetry/code/monitor/graph_plotter_rewrite.py index 6a88260..728ff3f 100755 --- a/robots/little_john/telemetry/code/monitor/graph_plotter_rewrite.py +++ b/robots/little_john/telemetry/code/monitor/graph_plotter_rewrite.py @@ -1,4 +1,5 @@ #!/usr/bin/env python3 +# Note that this should mostly work with python2, if necessary # Tool to draw live graphs of data coming in from serial port # Written as a telemetry tool by: @@ -6,32 +7,31 @@ # This code is incomplete, and is missing core features -import pyglet #import math #import time #import serial + +import pyglet import numpy import os import platform import sys import easygui import logging -from serialselect import selectserial +from serialselect import selectserial from colours import * -logging.basicConfig(format='%(levelname)s:\t%(message)s', - level=logging.DEBUG) +logging.basicConfig(format='%(levelname)s:\t%(message)s', level=logging.DEBUG) logging.info("Logging system active") datafeed = selectserial() if datafeed == None: - message = "Failed to open serial port" - logging.critical(message) + logging.critical("Failed to open serial port") sys.exit() -if platform.system()=='Windows': #easier than passing vars +if platform.system()=='Windows': os='Windows' else: os='Other' @@ -168,7 +168,7 @@ def pollSerial(elapsed): if os=='Windows': values = datafeed.readline().strip().split(b", ") else: - values = datafeed.readline().strip()#.split(', ') + values = datafeed.readline().strip() values = str(values).split(", ") testseries.addpoint(values) diff --git a/robots/little_john/telemetry/code/monitor/serialselect.py b/robots/little_john/telemetry/code/monitor/serialselect.py index e45b36e..63786a9 100644 --- a/robots/little_john/telemetry/code/monitor/serialselect.py +++ b/robots/little_john/telemetry/code/monitor/serialselect.py @@ -3,6 +3,7 @@ # The UoN Robot Wars Project, 2018 def selectserial(): + """Cross-platform function to find appropriate serial ports, query the user if necessary, and open one of them""" import platform import serial import os -- libgit2 0.21.2