Skip to content

Commit

Permalink
stage: prior: add a position polling timer
Browse files Browse the repository at this point in the history
  • Loading branch information
ianohara committed Feb 3, 2025
1 parent 67507d8 commit 41d5349
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions software/squid/stage/prior.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,16 @@ def __init__(self, sn: str, baudrate: int = 115200, stage_config: StageConfig =

self.set_baudrate(baudrate)

self._pos_polling_timer: Optional[threading.Timer] = None

self._initialize()

def _ensure_pos_polling_timer(self):
if self._pos_polling_timer and self._pos_polling_timer.is_alive():
return
self._log.info("Starting position polling timer.")
self._pos_polling_timer = threading.Timer(0.25, self._get_pos_poll_stage)

def set_baudrate(self, baud: int):
allowed_baudrates = {9600: "96", 19200: "19", 38400: "38", 115200: "115"}
if baud not in allowed_baudrates:
Expand Down

0 comments on commit 41d5349

Please sign in to comment.