added FIXED_CHANNELS constant

This commit is contained in:
2023-06-06 11:32:22 +02:00
parent ea8c8dabaf
commit 36cf0d9724

View File

@ -4,6 +4,12 @@ from .bsvar import BSVar
from .prodthread import ProdThread
FIXED_CHANNELS = {
"pid",
"toc"
}
class BSCache:
def __init__(self, timeout=1000, maxsize=100):
@ -51,7 +57,7 @@ class BSCache:
new_chans = {}
for name, kwargs in names.items():
if name not in ["pid", "toc"] and name not in self.channels:
if name not in FIXED_CHANNELS and name not in self.channels:
if not is_available(name):
raise ValueError(f"channel {name} is not available")
cfg = make_channel_config(name, *kwargs)
@ -72,13 +78,13 @@ class BSCache:
next(self)
while not chans.keys() <= self.data.keys():
missing = self.data.keys() - chans.keys() - {"pid", "toc"}
missing = self.data.keys() - chans.keys() - FIXED_CHANNELS
print("dropping data that is missing new channel(s)", sorted(missing))
next(self)
def get_var(self, name, modulo=None, offset=None):
if name not in ["pid", "toc"] and name not in self.channels:
if name not in FIXED_CHANNELS and name not in self.channels:
if not is_available(name):
raise ValueError(f"channel {name} is not available")
cfg = make_channel_config(name, modulo, offset)