diff --git a/robots/little_john/telemetry/code/monitor/version1/main.py b/robots/little_john/telemetry/code/monitor/version1/main.py index ae527fb..4348c0e 100755 --- a/robots/little_john/telemetry/code/monitor/version1/main.py +++ b/robots/little_john/telemetry/code/monitor/version1/main.py @@ -40,7 +40,7 @@ else: os='Other' logging.info('OS = ' + os) -testseries = Series(points=150, title="Sine wave demo", xname="Time (s)", yname="100sin(t)") +testseries = Series(points=150, ylimits=(9, 1024), title="Sine wave demo", xname="Time (s)", yname="100sin(t)") plots = [] plots.append(Plot(testseries)) @@ -56,7 +56,7 @@ def pollSerial(elapsed): for n, value in enumerate(values): values[n] = float(value) #logging.info("Recieved data: " + str(values)) - testseries.addpoint(values) + testseries.addpoint([time.time()-starttime] + values) def fakePollSerial(elapsed): """This function immitates the behaviour of pollSerial, for testing purposes""" @@ -66,6 +66,6 @@ def fakePollSerial(elapsed): testseries.addpoint(values) # Pyglet looks after the main event loop, but this ensures that data keeps being read in -pyglet.clock.schedule_interval(fakePollSerial, 0.04) +pyglet.clock.schedule_interval(pollSerial, 0.04) pyglet.app.run() diff --git a/robots/little_john/telemetry/code/monitor/version1/series.py b/robots/little_john/telemetry/code/monitor/version1/series.py index a19e990..dcbf017 100644 --- a/robots/little_john/telemetry/code/monitor/version1/series.py +++ b/robots/little_john/telemetry/code/monitor/version1/series.py @@ -5,7 +5,7 @@ import logging class Series: - def __init__(self, points=100, title="Series title", xname="x-axis name", yname="y-axis name"): + def __init__(self, points=100, xlimits=(0, 100), ylimits=(0, 100), title="Series title", xname="x-axis name", yname="y-axis name"): """Set up an object to store a 2D data series""" # Proposal: # In order to neatly handle multiple lines on the same graph @@ -20,8 +20,8 @@ class Series: self.title = title self.xname = xname self.yname = yname - self.xlimits = (0, 100) - self.ylimits = (-100, 100) + self.xlimits = xlimits + self.ylimits = ylimits self.data = [] self.points = points -- libgit2 0.21.2