improve config guess
This commit is contained in:
@ -355,7 +355,8 @@ class FrappyConfig(Device):
|
|||||||
stickarg = stick
|
stickarg = stick
|
||||||
|
|
||||||
need_change, changes, fm = to_consider = self.to_consider()
|
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 args:
|
||||||
if main is not None:
|
if main is not None:
|
||||||
raise TypeError('got multiple values for main')
|
raise TypeError('got multiple values for main')
|
||||||
@ -370,7 +371,8 @@ class FrappyConfig(Device):
|
|||||||
elif stick is None: # auto stick
|
elif stick is None: # auto stick
|
||||||
if main == '':
|
if main == '':
|
||||||
stick = '' # remove stick with 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'
|
stickcfg = main + 'stick'
|
||||||
if fm.is_cfg(config.instrument, 'stick', stickcfg):
|
if fm.is_cfg(config.instrument, 'stick', stickcfg):
|
||||||
# if a default stick is available, start this also
|
# if a default stick is available, start this also
|
||||||
@ -391,7 +393,7 @@ class FrappyConfig(Device):
|
|||||||
else:
|
else:
|
||||||
self.show_state(False, to_consider)
|
self.show_state(False, to_consider)
|
||||||
return
|
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)
|
session.log.warning('%r is plugged to the cryostat control rack', confirmed)
|
||||||
cmd = all_info({'main': main, 'stick': stickarg, 'addons': addons}, '')[:-1] + ', force=True)'
|
cmd = all_info({'main': main, 'stick': stickarg, 'addons': addons}, '')[:-1] + ', force=True)'
|
||||||
session.log.warning(f'if you are sure, use: %s', cmd)
|
session.log.warning(f'if you are sure, use: %s', cmd)
|
||||||
|
Reference in New Issue
Block a user