Skip to content

Commit ef32815

Browse files
authored
v1.0.2
version 1.0.2
2 parents 26132da + b2e95cd commit ef32815

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

pyobs_zaber/zabermodeselector.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,12 @@ async def move_by(self, length, speed=None) -> None:
6262
speed = self.speed
6363

6464
# move
65-
with Connection.open_serial_port(self.port) as connection:
66-
connection.enable_alerts()
67-
device = connection.detect_devices()[0]
65+
async with Connection.open_serial_port_async(self.port) as connection:
66+
await connection.enable_alerts_async()
67+
device = (await connection.detect_devices_async())[0]
6868
# TODO: raise xxx if len(device_list) is not 1 (0 -> no device found, >1 -> try to find correct one)
6969
axis = device.get_axis(1)
70-
axis.move_relative(
70+
await axis.move_relative_async(
7171
length,
7272
self.length_unit,
7373
velocity=speed,
@@ -80,21 +80,21 @@ async def check_position(self) -> float:
8080
"""
8181
Get the current position of the Zaber motor.
8282
"""
83-
with Connection.open_serial_port(self.port) as connection:
84-
connection.enable_alerts()
85-
device = connection.detect_devices()[0]
83+
async with Connection.open_serial_port_async(self.port) as connection:
84+
await connection.enable_alerts_async()
85+
device = (connection.detect_devices_async())[0]
8686
axis = device.get_axis(1)
87-
return axis.get_position(unit=self.length_unit)
87+
return await axis.get_position(unit=self.length_unit)
8888

8989
async def move_to(self, position) -> None:
9090
"""
9191
Move Zaber motor to a given position.
9292
Args:
9393
position: value to which the motor moves
9494
"""
95-
with Connection.open_serial_port(self.port) as connection:
96-
connection.enable_alerts()
97-
device = connection.detect_devices()[0]
95+
async with Connection.open_serial_port(self.port) as connection:
96+
await connection.enable_alerts_async()
97+
device = await connection.detect_devices_async()[0]
9898
axis = device.get_axis(1)
9999
await axis.move_absolute_async(
100100
position,

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "pyobs-zaber"
3-
version = "1.0.1"
3+
version = "1.0.2"
44
description = "pyobs model for Zaber motors"
55
authors = ["Leon Meerwart <[email protected]>"]
66
license = "MIT"

0 commit comments

Comments
 (0)