Skip to content

Commit

Permalink
Added polling of position to OmsVME58Motor every 0.5 seconds.
Browse files Browse the repository at this point in the history
  • Loading branch information
burkeds committed Apr 23, 2024
1 parent d1fbcba commit 93ed5aa
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/ophyd_async/tango/device_controllers/omsvme58.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,15 @@ def update_watchers(current_position: float):
try:
await self.position.set(new_position)
await asyncio.sleep(0.1)
counter = 0
while await self._state.get_value() == DevState.MOVING:
# Update the watchers with the current position every 0.5 seconds
if counter % 5 == 0:
current_position = await self.position.get_value()
update_watchers(current_position)
counter = 0
await asyncio.sleep(0.1)
counter += 1
finally:
if self.position.is_cachable():
self.position.clear_sub(update_watchers)
Expand Down

0 comments on commit 93ed5aa

Please sign in to comment.