From 745e15c709c0eba4379d9428ce0344a266bd5c7d Mon Sep 17 00:00:00 2001 From: Markus Zolliker Date: Mon, 2 Jun 2025 11:00:26 +0200 Subject: [PATCH] SEA: another fix: make sure the value parameter comes first --- cfg/main/ori4_cfg.py | 13 +++++++++++-- frappy_psi/sea.py | 24 ++++++++++++++---------- 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/cfg/main/ori4_cfg.py b/cfg/main/ori4_cfg.py index f553e2d..954559b 100644 --- a/cfg/main/ori4_cfg.py +++ b/cfg/main/ori4_cfg.py @@ -9,12 +9,21 @@ Mod('sea_main', service='main', ) +#Mod('tt', +# 'frappy_psi.sea.SeaDrivable', '', +# io='sea_main', +# meaning=['temperature_regulation', 27], +# sea_object='tt', +# rel_paths=['.', 'tm', 'set', 'dblctrl'], +#) + Mod('tt', - 'frappy_psi.sea.SeaDrivable', '', + 'frappy_psi.sea.LscDrivable', '', io='sea_main', meaning=['temperature_regulation', 27], sea_object='tt', - rel_paths=['.', 'tm', 'set', 'dblctrl'], + sensor_path='tm', + set_path='set', ) Mod('cc', diff --git a/frappy_psi/sea.py b/frappy_psi/sea.py index d9d24e6..5790bdc 100644 --- a/frappy_psi/sea.py +++ b/frappy_psi/sea.py @@ -557,10 +557,16 @@ class SeaModule(Module): else: cls.paramFilter(result, paramdesc) cfgdict.pop('rel_paths', None) - params = sum(result.values(), []) + # take top parameters - we do not want them first + top = result.pop('.', None) + params = [] + for key, plist in result.items(): + params.extend(plist) # the first value contains the main value + if top: + params.extend(top) # no we can add top parameters + top = None if is_running: # take this at end params.append(is_running) - main_value = params[0] if issubclass(cls, Readable): if 'key' in main_value: @@ -712,15 +718,13 @@ class SeaModule(Module): def paramFilter(cls, result, paramdesc): sub = paramdesc['path'].split('/', 1) sublist = result.get(sub[0]) - if len(sub) == 1: # direct kid - toplist = result.get('.') - if toplist is not None: - if 'kids' in paramdesc: - # do not take main node of a tree - return False - sublist = toplist if sublist is None: - return False + sublist = result.get('.') + if sublist is None: + return False + if len(sub) == 1 and 'kids' in paramdesc: # direct kid + # do not take main node of a tree + return False sublist.append(paramdesc) return True