mirror of
https://github.com/ivan-usov-org/bec.git
synced 2025-04-22 02:20:02 +02:00
fix: fixed bug in device limit update
This commit is contained in:
parent
f5e0629811
commit
c347a84ad1
@ -2,9 +2,8 @@ from __future__ import annotations
|
||||
|
||||
import traceback
|
||||
from typing import TYPE_CHECKING
|
||||
from bec_lib import messages
|
||||
|
||||
from bec_lib import BECStatus, DeviceConfigError, MessageEndpoints, bec_logger
|
||||
from bec_lib import BECStatus, DeviceConfigError, MessageEndpoints, bec_logger, messages
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from devicemanager import DeviceManagerDS
|
||||
@ -88,6 +87,16 @@ class ConfigUpdateHandler:
|
||||
self.device_manager.update_config(device.obj, old_config)
|
||||
raise DeviceConfigError(f"Error during object update. {exc}")
|
||||
|
||||
if "limits" in dev_config["deviceConfig"]:
|
||||
limits = {
|
||||
"low": device.obj.low_limit_travel.get(),
|
||||
"high": device.obj.high_limit_travel.get(),
|
||||
}
|
||||
self.device_manager.producer.set_and_publish(
|
||||
MessageEndpoints.device_limits(device.name),
|
||||
messages.DeviceMessage(signals=limits).dumps(),
|
||||
)
|
||||
|
||||
if "enabled" in dev_config:
|
||||
device._config["enabled"] = dev_config["enabled"]
|
||||
if dev_config["enabled"]:
|
||||
|
@ -167,8 +167,10 @@ class DeviceManagerDS(DeviceManagerBase):
|
||||
# first handle the ophyd exceptions...
|
||||
if config_key == "limits":
|
||||
if hasattr(obj, "low_limit_travel") and hasattr(obj, "high_limit_travel"):
|
||||
obj.low_limit_travel.set(config_value[0])
|
||||
obj.high_limit_travel.set(config_value[1])
|
||||
low_limit_status = obj.low_limit_travel.set(config_value[0])
|
||||
high_limit_status = obj.high_limit_travel.set(config_value[1])
|
||||
low_limit_status.wait()
|
||||
high_limit_status.wait()
|
||||
continue
|
||||
if config_key == "labels":
|
||||
if not config_value:
|
||||
|
Loading…
x
Reference in New Issue
Block a user