From ac36374ac85ff4b14fd34bfc597960803cbe6621 Mon Sep 17 00:00:00 2001 From: vegano1 Date: Mon, 5 Aug 2024 12:11:10 -0400 Subject: [PATCH] cleanup --- .../drivers/absorbance_reader/async_byonoy.py | 4 +--- .../opentrons/drivers/absorbance_reader/driver.py | 3 --- .../hardware_control/backends/ot3controller.py | 7 ++++--- .../hardware_control/backends/subsystem_manager.py | 14 +++++++------- api/src/opentrons/hardware_control/poller.py | 2 -- 5 files changed, 12 insertions(+), 18 deletions(-) diff --git a/api/src/opentrons/drivers/absorbance_reader/async_byonoy.py b/api/src/opentrons/drivers/absorbance_reader/async_byonoy.py index b623fa4a667..a75e89cfcc8 100644 --- a/api/src/opentrons/drivers/absorbance_reader/async_byonoy.py +++ b/api/src/opentrons/drivers/absorbance_reader/async_byonoy.py @@ -178,8 +178,6 @@ async def update_firmware(self, firmware_file_path: str) -> Tuple[bool, str]: handle = self._verify_device_handle() if not os.path.exists(firmware_file_path): return False, f"Firmware file not found: {firmware_file_path}" - # TODO: verify if this needs to run in this context or executor thread - # err = self._interface.byonoy_update_device(handle, firmware_file_path) err = await self._loop.run_in_executor( executor=self._executor, func=partial( @@ -287,7 +285,7 @@ def _initialize(self, wavelength: int) -> None: self._initialize_measurement(conf) async def initialize(self, wavelength: int) -> None: - """???""" + """Initialize the device so we can start reading samples from it.""" await self._loop.run_in_executor( executor=self._executor, func=partial(self._initialize, wavelength) ) diff --git a/api/src/opentrons/drivers/absorbance_reader/driver.py b/api/src/opentrons/drivers/absorbance_reader/driver.py index ab20622c0a8..63935ac0267 100644 --- a/api/src/opentrons/drivers/absorbance_reader/driver.py +++ b/api/src/opentrons/drivers/absorbance_reader/driver.py @@ -35,9 +35,6 @@ def __init__(self, connection: AsyncByonoyType) -> None: async def connect(self) -> None: """Connect to absorbance reader""" await self._connection.open() - # The Absorbance reader needs to initialize after opening a connection - # This takes about 10 seconds, so lets wait 15 to be safe. - # await asyncio.sleep(15) async def disconnect(self) -> None: """Disconnect from absorbance reader""" diff --git a/api/src/opentrons/hardware_control/backends/ot3controller.py b/api/src/opentrons/hardware_control/backends/ot3controller.py index 007d6f7eabc..386e6a36159 100644 --- a/api/src/opentrons/hardware_control/backends/ot3controller.py +++ b/api/src/opentrons/hardware_control/backends/ot3controller.py @@ -494,9 +494,9 @@ def update_feature_flags(self, feature_flags: HardwareFeatureFlags) -> None: async def update_motor_status(self) -> None: """Retreieve motor and encoder status and position from all present nodes""" motor_nodes = self._motor_nodes() - if motor_nodes: - response = await get_motor_position(self._messenger, motor_nodes) - self._handle_motor_status_response(response) + assert len(motor_nodes) + response = await get_motor_position(self._messenger, motor_nodes) + self._handle_motor_status_response(response) async def update_motor_estimation(self, axes: Sequence[Axis]) -> None: """Update motor position estimation for commanded nodes, and update cache of data.""" @@ -1142,6 +1142,7 @@ async def _handle_watch_event(self) -> None: return if event is not None: flags = aionotify.Flags.parse(event.flags) + log.debug(f"aionotify: {flags} {event.name}") if "ot_module" in event.name: event_name = event.name event_description = AionotifyEvent.build(event_name, flags) diff --git a/api/src/opentrons/hardware_control/backends/subsystem_manager.py b/api/src/opentrons/hardware_control/backends/subsystem_manager.py index 8a60feb9193..1cc663ae99f 100644 --- a/api/src/opentrons/hardware_control/backends/subsystem_manager.py +++ b/api/src/opentrons/hardware_control/backends/subsystem_manager.py @@ -150,13 +150,13 @@ def subsystems_to_update(self) -> List[SubSystem]: return [target_to_subsystem(t) for t in self._updates_required.keys()] async def start(self) -> None: - # await self._probe_network_and_cache_fw_updates( - # self._expected_core_targets, True - # ) - # self._tool_detection_task = asyncio.create_task( - # self._tool_detection_task_main() - # ) - # await self.refresh() + await self._probe_network_and_cache_fw_updates( + self._expected_core_targets, True + ) + self._tool_detection_task = asyncio.create_task( + self._tool_detection_task_main() + ) + await self.refresh() log.info(f"Subsystem manager started with devices {self.device_info}") async def refresh(self) -> None: diff --git a/api/src/opentrons/hardware_control/poller.py b/api/src/opentrons/hardware_control/poller.py index 992b0d7c057..f0dc4c2dfc2 100644 --- a/api/src/opentrons/hardware_control/poller.py +++ b/api/src/opentrons/hardware_control/poller.py @@ -113,8 +113,6 @@ async def _poll_once(self) -> None: self._reader.on_error(e) for waiter in previous_waiters: Poller._set_waiter_complete(waiter, e) - # NOTE: For debugging - await self.stop() else: for waiter in previous_waiters: Poller._set_waiter_complete(waiter)