diff --git a/src/calng/CalibrationManager.py b/src/calng/CalibrationManager.py index 39ae148256b152f7115b20dca11dbade6c34f982..7fc7cd61dceb10ad09ca8d952053a609f9818d4f 100644 --- a/src/calng/CalibrationManager.py +++ b/src/calng/CalibrationManager.py @@ -611,22 +611,15 @@ class CalibrationManager(DeviceClientBase, Device): if path not in managed_paths: del managed_hash[path] - # Check for current values of managed keys on DAQ devices and - # update schema correspondingly. - if self._daq_device_ids: - daq_vals = await self._get_shared_keys( - self._daq_device_ids, ManagedKeysNode.DAQ_KEYS.keys()) - - for orig_key, managed_key in ManagedKeysNode.DAQ_KEYS.items(): - managed_hash[managed_key, 'defaultValue'] = daq_vals[orig_key] - - # Check for current values of managed keys on correction - # devices and update schema correspondingly. - corr_vals = await self._get_shared_keys( + # Retrieve any previous values already on running devices in + # order to update the defaultValue attribute in the schema just + # before injection. + prev_vals = await self._get_shared_keys( self._correction_device_ids, managed_keys) - for key, value in corr_vals.items(): - managed_hash[key, 'defaultValue'] = value + if self._daq_device_ids: + prev_vals.update(await self._get_shared_keys( + self._daq_device_ids, ManagedKeysNode.DAQ_KEYS.keys())) # Retrieve the attributes on the current managed node. The # original implementation of toSchemaAndAttrs in the Node's @@ -695,6 +688,12 @@ class CalibrationManager(DeviceClientBase, Device): descr.accessMode = AccessMode.RECONFIGURABLE descr.allowedStates = [State.ACTIVE] + try: + # If there's been a previous value before + # injection, use it. + descr.defaultValue = prev_vals[full_key] + except KeyError: + pass else: self.logger.warn(f'Encountered unknown descriptor type ' f'{type(descr)}')