Skip to content

Commit

Permalink
Round position on write, prevent false returning not busy (#5)
Browse files Browse the repository at this point in the history
* Round position on write, prevent false returning not busy

* changelog

---------

Co-authored-by: Blaise Thompson <[email protected]>
  • Loading branch information
ksunden and untzag authored Sep 15, 2023
1 parent bd958e1 commit ecf4be2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).

## [Unreleased]

### Fixed
- round position on write
- prevent case where busy would always be false

## [2022.5.0]

### Fixed
Expand Down
7 changes: 5 additions & 2 deletions yaqd_acton/_acton_2150i.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def direct_serial_write(self, message):

def _set_position(self, position):
self._busy = True
self.ser.write(f"{position} GOTO\r".encode())
self.ser.write(f"{round(position, 1)} GOTO\r".encode())

def set_turret(self, identifier):
self._busy = True
Expand All @@ -57,7 +57,10 @@ async def update_state(self):
await asyncio.sleep(1)
continue
# assess busy state
if math.isclose(now, self._state["position"]):
if abs(now - self._state["destination"]) > 0.2:
self._busy = True
self._state["position"] = now
elif math.isclose(now, self._state["position"]):
self._busy = False
await self._busy_sig.wait()
else:
Expand Down

0 comments on commit ecf4be2

Please sign in to comment.