diff --git a/software/squid/stage/prior.py b/software/squid/stage/prior.py index e1cfad7d..2b8de75e 100644 --- a/software/squid/stage/prior.py +++ b/software/squid/stage/prior.py @@ -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: