diff --git a/witmotion/__init__.py b/witmotion/__init__.py index 8030375..bbcb61a 100644 --- a/witmotion/__init__.py +++ b/witmotion/__init__.py @@ -70,8 +70,6 @@ def __init__(self, path: str = "/dev/ttyUSB0", baudrate: int = 9600): # self.ser.write(b"\x00" * 5) self.should_exit = False - self.rxthread = Thread(target=self._rxloop) - self.rxthread.start() self.subscribers = defaultdict(list) # State we have received @@ -85,6 +83,9 @@ def __init__(self, path: str = "/dev/ttyUSB0", baudrate: int = 9600): self.last_mag = None self.last_q = None + self.rxthread = Thread(target=self._rxloop) + self.rxthread.start() + def close(self) -> None: """ Close IMU connection and stop background monitoring thread..