Merge branch 'uniax' into wip

Conflicts:
	cfg/uniax.cfg
	secop/core.py
	secop_psi/trinamic.py
This commit is contained in:
2021-09-21 16:52:15 +02:00
11 changed files with 480 additions and 35 deletions

View File

@@ -251,7 +251,9 @@ class AsynSerial(AsynConn):
if not fullname.startswith(name):
raise ConfigError('illegal parity: %s' % parity)
options['parity'] = name[0]
if 'timeout' not in options:
if 'timeout' in options:
options['timeout'] = float(self.timeout)
else:
options['timeout'] = self.timeout
try:
self.connection = Serial(dev, **options)

View File

@@ -425,6 +425,8 @@ class Module(HasAccessibles):
def announceUpdate(self, pname, value=None, err=None, timestamp=None):
"""announce a changed value or readerror"""
pobj = self.parameters[pname]
timestamp = timestamp or time.time()
changed = pobj.value != value or timestamp > (pobj.timestamp or 0) + 1
if value is not None:
pobj.value = value # store the value even in case of error
if err:
@@ -437,7 +439,9 @@ class Module(HasAccessibles):
pobj.value = pobj.datatype(value)
except Exception as e:
err = secop_error(e)
pobj.timestamp = timestamp or time.time()
if not changed:
return # experimental: do not update unchanged values within 1 sec
pobj.timestamp = timestamp
pobj.readerror = err
if pobj.export:
self.DISPATCHER.announce_update(self.name, pname, pobj)

View File

@@ -88,7 +88,7 @@ class PersistentMixin(HasAccessibles):
try:
with open(self.persistentFile, 'r') as f:
self.persistentData = json.load(f)
except FileNotFoundError:
except Exception:
self.persistentData = {}
writeDict = {}
for pname in self.parameters: