From 980d27ebfc80d6e3543871bead6f91cc0085a2d0 Mon Sep 17 00:00:00 2001 From: Astro Date: Fri, 18 Dec 2020 15:44:11 +0100 Subject: [PATCH] pytec: remove client-side interval calculation --- pytec/plot.py | 26 +++++++++++--------------- pytec/pytec/client.py | 1 - 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/pytec/plot.py b/pytec/plot.py index 600fcda..55b9195 100644 --- a/pytec/plot.py +++ b/pytec/plot.py @@ -44,26 +44,22 @@ series = { series_lock = Lock() quit = False -last_packet_time = None def recv_data(tec): global last_packet_time for data in tec.report_mode(): - if data['channel'] == 0: - series_lock.acquire() - try: - time = data['time'] / 1000.0 - if last_packet_time: - data['interval'] = time - last_packet_time - last_packet_time = time + ch0 = data[0] + series_lock.acquire() + try: + time = ch0['time'] / 1000.0 - for k, s in series.items(): - if k in data: - v = data[k] - if type(v) is float: - s.append(time, v) - finally: - series_lock.release() + for k, s in series.items(): + if k in ch0: + v = ch0[k] + if type(v) is float: + s.append(time, v) + finally: + series_lock.release() if quit: break diff --git a/pytec/pytec/client.py b/pytec/pytec/client.py index 32f1bef..3de98bb 100644 --- a/pytec/pytec/client.py +++ b/pytec/pytec/client.py @@ -164,4 +164,3 @@ class Client: def load_config(self): """Load current configuration from EEPROM""" self._command("load") -