Skip to content

Commit

Permalink
Merge pull request #196 from houkhouk/fix/rem_pyluos_poll
Browse files Browse the repository at this point in the history
remove pyluos limitation to send messages without receiving a gate me…
  • Loading branch information
nicolas-rabault authored Jun 19, 2024
2 parents 9e64152 + 4e75582 commit 584518b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 0 additions & 4 deletions pyluos/io/serial_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,6 @@ def extract_line(s):
while self._running:
to_read = self._serial.in_waiting

if to_read == 0:
time.sleep(self.period)
continue

s = self._serial.read(to_read)
buff = buff + s

Expand Down
6 changes: 4 additions & 2 deletions pyluos/io/ws.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def is_ready(self):

def recv(self):
try:
data = self._msg.get(True, 1)
data = self._msg.get(block = False)
except queue.Empty:
data = None
return data
Expand All @@ -73,7 +73,7 @@ def write(self, data):

def close(self):
self._running = False
self._poll_loop.join()
self._poll_loop.join(timeout = 1)
self._ws.close()

def _poll(self):
Expand All @@ -94,6 +94,8 @@ def extract_line(s):

while self._running:
s = self._ws.recv()
if isinstance(s, str):
return
buff = buff + s
while self._running:
line, buff = extract_line(buff)
Expand Down

0 comments on commit 584518b

Please sign in to comment.