forked from M-Labs/thermostat
pytec: remove client-side interval calculation
This commit is contained in:
parent
e9e46b29cf
commit
980d27ebfc
@ -44,26 +44,22 @@ series = {
|
|||||||
series_lock = Lock()
|
series_lock = Lock()
|
||||||
|
|
||||||
quit = False
|
quit = False
|
||||||
last_packet_time = None
|
|
||||||
|
|
||||||
def recv_data(tec):
|
def recv_data(tec):
|
||||||
global last_packet_time
|
global last_packet_time
|
||||||
for data in tec.report_mode():
|
for data in tec.report_mode():
|
||||||
if data['channel'] == 0:
|
ch0 = data[0]
|
||||||
series_lock.acquire()
|
series_lock.acquire()
|
||||||
try:
|
try:
|
||||||
time = data['time'] / 1000.0
|
time = ch0['time'] / 1000.0
|
||||||
if last_packet_time:
|
|
||||||
data['interval'] = time - last_packet_time
|
|
||||||
last_packet_time = time
|
|
||||||
|
|
||||||
for k, s in series.items():
|
for k, s in series.items():
|
||||||
if k in data:
|
if k in ch0:
|
||||||
v = data[k]
|
v = ch0[k]
|
||||||
if type(v) is float:
|
if type(v) is float:
|
||||||
s.append(time, v)
|
s.append(time, v)
|
||||||
finally:
|
finally:
|
||||||
series_lock.release()
|
series_lock.release()
|
||||||
|
|
||||||
if quit:
|
if quit:
|
||||||
break
|
break
|
||||||
|
@ -164,4 +164,3 @@ class Client:
|
|||||||
def load_config(self):
|
def load_config(self):
|
||||||
"""Load current configuration from EEPROM"""
|
"""Load current configuration from EEPROM"""
|
||||||
self._command("load")
|
self._command("load")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user