fix(conotroller): cleanup names

This commit is contained in:
2025-12-10 11:27:13 +01:00
committed by Christian Appel
parent ef9568cb46
commit e7e2b5ed97
2 changed files with 8 additions and 8 deletions

View File

@@ -177,7 +177,7 @@ class Controller(OphydObject):
return return
self.device_manager.devices[device_name].read_only = not enabled self.device_manager.devices[device_name].read_only = not enabled
def set_device_enable(self, device_name: str, enabled: bool) -> None: def set_device_enabled(self, device_name: str, enabled: bool) -> None:
""" """
Enable/disable a device. If the device is not configured, a warning is logged. Enable/disable a device. If the device is not configured, a warning is logged.
@@ -202,7 +202,7 @@ class Controller(OphydObject):
if all_disabled: if all_disabled:
self.off(update_config=False) self.off(update_config=False)
def set_all_devices_enable(self, enabled: bool) -> None: def set_all_devices_enabled(self, enabled: bool) -> None:
""" """
Enable or disable all devices registered for the controller. Enable or disable all devices registered for the controller.
@@ -213,7 +213,7 @@ class Controller(OphydObject):
if axis is None: if axis is None:
logger.info("Axis is not assigned, skipping enabling/disabling.") logger.info("Axis is not assigned, skipping enabling/disabling.")
continue continue
self.set_device_enable(axis.name, enabled) self.set_device_enabled(axis.name, enabled)
def _initialize(self): def _initialize(self):
self._connected = False self._connected = False
@@ -289,7 +289,7 @@ class Controller(OphydObject):
self.sock = None self.sock = None
if update_config: if update_config:
# Disable all axes associated with this controller # Disable all axes associated with this controller
self.set_all_devices_enable(False) self.set_all_devices_enabled(False)
else: else:
logger.info("The connection is already closed.") logger.info("The connection is already closed.")

View File

@@ -60,17 +60,17 @@ def test_controller_with_multiple_axes(dm_with_devices):
assert dm_with_devices.devices.get("samx").enabled is False assert dm_with_devices.devices.get("samx").enabled is False
assert dm_with_devices.devices.get("samy").enabled is False assert dm_with_devices.devices.get("samy").enabled is False
assert controller.connected is True assert controller.connected is True
controller.set_all_devices_enable(True) controller.set_all_devices_enabled(True)
assert dm_with_devices.devices.get("samx").enabled is True assert dm_with_devices.devices.get("samx").enabled is True
assert dm_with_devices.devices.get("samy").enabled is True assert dm_with_devices.devices.get("samy").enabled is True
# Disable one axis after another, the last one should turn the controller off # Disable one axis after another, the last one should turn the controller off
controller.set_device_enable("samx", False) controller.set_device_enabled("samx", False)
assert controller.connected is True assert controller.connected is True
assert dm_with_devices.devices.get("samx").enabled is False assert dm_with_devices.devices.get("samx").enabled is False
assert dm_with_devices.devices.get("samy").enabled is True assert dm_with_devices.devices.get("samy").enabled is True
controller.set_device_enable("samy", False) controller.set_device_enabled("samy", False)
assert dm_with_devices.devices.get("samy").enabled is False assert dm_with_devices.devices.get("samy").enabled is False
# Enabling one axis should turn the controller back on # Enabling one axis should turn the controller back on
assert controller.connected is False assert controller.connected is False
controller.set_device_enable("samx", True) controller.set_device_enabled("samx", True)
assert controller.connected is True assert controller.connected is True