simplified repack() logic

This commit is contained in:
2021-09-09 14:16:57 +02:00
parent 78591549a9
commit 718c59b3c5

View File

@ -27,7 +27,7 @@ class BSCache:
with source(channels=configs, receive_timeout=-1) as src: with source(channels=configs, receive_timeout=-1) as src:
while running.is_set(): while running.is_set():
msg = src.receive() msg = src.receive()
data = repack(channels, msg) data = repack(msg)
if data: if data:
yield data yield data
@ -82,11 +82,11 @@ def make_channel_config(name, modulo, offset):
def repack(channels, message): def repack(message):
data = message.data.data data = message.data.data
pulse_id = message.data.pulse_id pulse_id = message.data.pulse_id
res = {n: data[n].value for n in channels} res = {n: v.value for n, v in data.items()}
# res = {k: v for k, v in res.items() if v is not None} # res = {k: v for k, v in res.items() if v is not None}
#TODO: should this be a ValueError? #TODO: should this be a ValueError?