From 8d722ad09fe7dd4a6a52a081470969b12850e8e0 Mon Sep 17 00:00:00 2001 From: Markus Zolliker Date: Fri, 27 Sep 2024 15:23:15 +0200 Subject: [PATCH] improve config guess --- devices.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/devices.py b/devices.py index dbb4699..83c9532 100644 --- a/devices.py +++ b/devices.py @@ -355,7 +355,8 @@ class FrappyConfig(Device): stickarg = stick need_change, changes, fm = to_consider = self.to_consider() - confirmed = fm.sea.get_cfg(config.instrument, 'sea', True).split('/', 1)[0] + seacfg = fm.sea.get_cfg(config.instrument, 'sea', True).split('/', 1) + confirmed = seacfg[0] if args: if main is not None: raise TypeError('got multiple values for main') @@ -370,7 +371,8 @@ class FrappyConfig(Device): elif stick is None: # auto stick if main == '': stick = '' # remove stick with main - else: + elif (len(seacfg) < 3 or seacfg[2] == '' # currently no stick + or seacfg[1].lower() != main.lower()): # or main has changed stickcfg = main + 'stick' if fm.is_cfg(config.instrument, 'stick', stickcfg): # if a default stick is available, start this also @@ -391,7 +393,7 @@ class FrappyConfig(Device): else: self.show_state(False, to_consider) return - if confirmed and confirmed != main and main not in (None, 'restart') and not force: + if confirmed and confirmed.lower() != main.lower() and main not in (None, 'restart') and not force: session.log.warning('%r is plugged to the cryostat control rack', confirmed) cmd = all_info({'main': main, 'stick': stickarg, 'addons': addons}, '')[:-1] + ', force=True)' session.log.warning(f'if you are sure, use: %s', cmd)