SEA: another fix: make sure the value parameter comes first

This commit is contained in:
zolliker 2025-06-02 11:00:26 +02:00
parent 62adec4874
commit 745e15c709
2 changed files with 25 additions and 12 deletions

View File

@ -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',

View File

@ -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