Skip to content

Commit

Permalink
cleaning up
Browse files Browse the repository at this point in the history
  • Loading branch information
vegano1 committed Aug 6, 2024
1 parent ac36374 commit 477d385
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions api/src/opentrons/hardware_control/backends/ot3controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
assert len(motor_nodes)
response = await get_motor_position(self._messenger, motor_nodes)
self._handle_motor_status_response(response)
if 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."""
Expand Down
4 changes: 2 additions & 2 deletions api/src/opentrons/hardware_control/module_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ async def unregister_modules(
for mod in mods_at_ports:
for attached_mod in self.available_modules:
if (
attached_mod.port == mod.port
and attached_mod.serial_number == mod.serial
attached_mod.serial_number == mod.serial
or attached_mod.port == mod.port
):
removed_modules.append(attached_mod)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ async def update_device(self, firmware_file_path: str) -> Tuple[bool, str]:
log.debug(f"Updating {self.name}: {self.port} with {firmware_file_path}")
self._updating = True
success, res = await self._driver.update_firmware(firmware_file_path)
self._device_info = await self._driver.get_device_info()
await self._poller.start()
self._updating = False
return success, res
Expand Down
12 changes: 8 additions & 4 deletions api/src/opentrons/hardware_control/modules/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ async def upload_via_avrdude(
"-b{}".format(BAUDRATE),
"-D",
"-Uflash:w:{}:i".format(firmware_file_path),
**kwargs,
stdout=kwargs["stdout"],
stderr=kwargs["stderr"],
)
await proc.wait()

Expand Down Expand Up @@ -193,8 +194,9 @@ async def upload_via_bossa(
"--offset=0x2000",
f"{firmware_file_path}",
]

proc = await asyncio.create_subprocess_exec(*bossa_args, **kwargs)
proc = await asyncio.create_subprocess_exec(
*bossa_args, stdout=kwargs["stdout"], stderr=kwargs["stderr"]
)
stdout, stderr = await proc.communicate()
res = stdout.decode()
if "Verify successful" in res:
Expand Down Expand Up @@ -233,7 +235,9 @@ async def upload_via_dfu(
f"-D{firmware_file_path}",
"-R",
]
proc = await asyncio.create_subprocess_exec(*dfu_args, **kwargs)
proc = await asyncio.create_subprocess_exec(
*dfu_args, stdout=kwargs["stdout"], stderr=kwargs["stderr"]
)
stdout, stderr = await proc.communicate()
res = stdout.decode()

Expand Down
5 changes: 0 additions & 5 deletions api/src/opentrons/hardware_control/poller.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ def __init__(self, reader: Reader, interval: float) -> None:
self._poll_waiters: List["asyncio.Future[None]"] = []
self._poll_forever_task: Optional["asyncio.Task[None]"] = None

@property
def is_running(self) -> bool:
return self._poll_forever_task is not None

async def start(self) -> None:
assert self._poll_forever_task is None, "Poller already started"
self._poll_forever_task = asyncio.create_task(self._poll_forever())
Expand All @@ -56,7 +52,6 @@ async def stop(self) -> None:
await asyncio.gather(task, return_exceptions=True)
for waiter in self._poll_waiters:
waiter.cancel(msg="Module was removed")
self._poll_forever_task = None

async def wait_next_poll(self) -> None:
"""Wait for the next poll to complete.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ async def test_driver_connect_disconnect(

mock_interface.byonoy_open_device.assert_called_once()
assert await driver.is_connected()
assert driver._connection.verify_device_handle()
assert driver._connection._verify_device_handle()
assert driver._connection._device_handle == 1

mock_interface.byonoy_free_device.return_value = MockErrorCode.BYONOY_ERROR_NO_ERROR
Expand Down

0 comments on commit 477d385

Please sign in to comment.