fixes in sea cfg files

- json_file must be a string, not a list
- rel_path is no longer to be converted to a list
This commit is contained in:
l_samenv 2023-05-10 16:36:32 +02:00
parent 8039351395
commit 1ce43a567b
21 changed files with 30 additions and 30 deletions

View File

@ -15,7 +15,7 @@ Mod('ts',
'secop_psi.sea.SeaReadable', '',
io='sea_stick',
sea_object='tt',
json_file=['ma6.config.json'],
json_file='ma6.config.json',
rel_paths=['ts'],
)

View File

@ -13,6 +13,6 @@ Mod('ts',
'frappy_psi.sea.SeaReadable', '',
io='sea_stick',
sea_object='tt',
json_file=['ill1.config.json'],
json_file='ill1.config.json',
rel_paths=['ts'],
)

View File

@ -15,6 +15,6 @@ Mod('ts',
'secop_psi.sea.SeaReadable', '',
io='sea_stick',
sea_object='tt',
json_file=['ill3.config.json'],
json_file='ill3.config.json',
rel_paths=['ts'],
)

View File

@ -13,6 +13,6 @@ Mod('ts',
'frappy_psi.sea.SeaReadable', '',
io='sea_stick',
sea_object='tt',
json_file=['ill4.config.json'],
json_file='ill4.config.json',
rel_paths=['ts'],
)

View File

@ -13,6 +13,6 @@ Mod('ts',
'frappy_psi.sea.SeaReadable', '',
io='sea_stick',
sea_object='tt',
json_file=['ill5.config.json'],
json_file='ill5.config.json',
rel_paths=['ts'],
)

View File

@ -13,6 +13,6 @@ Mod('ts',
'frappy_psi.sea.SeaReadable', '',
io='sea_stick',
sea_object='tt',
json_file=['ill5.config.json'],
json_file='ill5.config.json',
rel_paths=['ts'],
)

View File

@ -13,6 +13,6 @@ Mod('ts',
'frappy_psi.sea.SeaReadable', '',
io='sea_stick',
sea_object='tt',
json_file=['ma02.config.json'],
json_file='ma02.config.json',
rel_paths=['ts'],
)

View File

@ -13,6 +13,6 @@ Mod('ts',
'frappy_psi.sea.SeaReadable', '',
io='sea_stick',
sea_object='tt',
json_file=['ma10.config.json'],
json_file='ma10.config.json',
rel_paths=['ts'],
)

View File

@ -13,6 +13,6 @@ Mod('ts',
'frappy_psi.sea.SeaReadable', '',
io='sea_stick',
sea_object='tt',
json_file=['ma11.config.json'],
json_file='ma11.config.json',
rel_paths=['ts'],
)

View File

@ -13,6 +13,6 @@ Mod('ts',
'frappy_psi.sea.SeaReadable', '',
io='sea_stick',
sea_object='tt',
json_file=['ma6.config.json'],
json_file='ma6.config.json',
rel_paths=['ts'],
)

View File

@ -13,6 +13,6 @@ Mod('ts',
'frappy_psi.sea.SeaReadable', '',
io='sea_stick',
sea_object='tt',
json_file=['ma7.config.json'],
json_file='ma7.config.json',
rel_paths=['ts'],
)

View File

@ -15,6 +15,6 @@ Mod('ts',
'secop_psi.sea.SeaReadable', '',
io='sea_stick',
sea_object='tt',
json_file=['ill1.config.json'],
json_file='ill1.config.json',
rel_paths=['ts'],
)

View File

@ -13,6 +13,6 @@ Mod('ts',
'frappy_psi.sea.SeaReadable', '',
io='sea_stick',
sea_object='tt',
json_file=['ori3.config.json'],
json_file='ori3.config.json',
rel_paths=['ts'],
)

View File

@ -13,6 +13,6 @@ Mod('ts',
'frappy_psi.sea.SeaReadable', '',
io='sea_stick',
sea_object='tt',
json_file=['ori4.config.json'],
json_file='ori4.config.json',
rel_paths=['ts'],
)

View File

@ -13,6 +13,6 @@ Mod('ts',
'frappy_psi.sea.SeaReadable', '',
io='sea_stick',
sea_object='tt',
json_file=['ori6.config.json'],
json_file='ori6.config.json',
rel_paths=['ts'],
)

View File

@ -15,6 +15,6 @@ Mod('ts',
'secop_psi.sea.SeaReadable', '',
io='sea_stick',
sea_object='tt',
json_file=['ma7.config.json'],
json_file='ma7.config.json',
rel_paths=['ts'],
)

View File

@ -19,6 +19,6 @@ Mod('ts',
'frappy_psi.sea.SeaReadable', '',
io='sea_stick',
sea_object='tt',
json_file=['ori4.config.json'],
json_file='ori4.config.json',
rel_paths=['ts'],
)

View File

@ -21,7 +21,7 @@ Mod('warmup',
Mod('ts',
'secop_psi.sea.SeaReadable', '',
sea_object='tt',
json_file=['ori4.config.json'],
json_file='ori4.config.json',
rel_paths=['ts'],
io='sea_stick',
)

View File

@ -15,6 +15,6 @@ Mod('ts',
'secop_psi.sea.SeaReadable', '',
io='sea_stick',
sea_object='tt',
json_file=['variox.config.json'],
json_file='variox.config.json',
rel_paths=['ts'],
)

View File

@ -43,8 +43,7 @@ class PhytronIO(StringIO):
_, _, reply = super().communicate('\x02' + command).partition('\x02')
if reply[0] == '\x06': # ACK
break
raise CommunicationFailedError('missing ACK %r (cmd: %r)'
% (reply, command))
raise CommunicationFailedError(f'missing ACK {reply!r} (cmd: {command!r})')
except Exception as e:
if itry < ntry - 1:
warn = e
@ -76,7 +75,7 @@ class Motor(HasOffset, PersistentMixin, HasIO, Drivable):
target_min = Limit()
target_max = Limit()
alive_time = PersistentParam('alive time for detecting restarts',
FloatRange(), default=0) # export=False
FloatRange(), default=0, export=False)
ioClass = PhytronIO
fast_poll = 0.1
@ -86,19 +85,19 @@ class Motor(HasOffset, PersistentMixin, HasIO, Drivable):
_reset_needed = False
def get(self, cmd):
return self.communicate('%x%s%s' % (self.address, self.axis, cmd))
return self.communicate(f'{self.address:x}{self.axis}{cmd}')
def set(self, cmd, value):
# make sure e format is not used, max 8 characters
strvalue = '%.6g' % value
strvalue = f'{value:.6g}'
if 'e' in strvalue:
if abs(value) <= 1: # very small number
strvalue = '%.7f' % value
strvalue = f'{value:.7f}'
elif abs(value) < 99999999: # big number
strvalue = '%.0f' % value
strvalue = f'{value:.0f}'
else:
raise ValueError('number (%g) must not have more than 8 digits' % value)
self.communicate('%x%s%s%s' % (self.address, self.axis, cmd, strvalue))
raise ValueError(f'number ({value}) must not have more than 8 digits')
self.communicate(f'{self.address:x}{self.axis}{cmd}{strvalue}')
def set_get(self, cmd, value, query):
self.set(cmd, value)
@ -126,7 +125,7 @@ class Motor(HasOffset, PersistentMixin, HasIO, Drivable):
enc = self.read_encoder()
else:
enc = pos
status = self.communicate('%xSE' % self.address)
status = self.communicate(f'{self.address:x}SE')
status = status[0:4] if self.axis == 'X' else status[4:8]
self.log.debug('run %s enc %s end %s', status[1], status[2], status[3])
status = self.get('=H')
@ -163,6 +162,7 @@ class Motor(HasOffset, PersistentMixin, HasIO, Drivable):
self._mismatch_count = 0
self.status = IDLE, ''
self.value = pos
self.read_encoder() # let encoder quickly match value
self.saveParameters()
self.setFastPoll(False)
return pos

View File

@ -451,7 +451,7 @@ class SeaModule(Module):
descr['params'].pop(0)
else:
# filter by relative paths
rel_paths = rel_paths.split()
# rel_paths = rel_paths.split()
result = []
is_running = None
for rpath in rel_paths: