Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions meshtastic/stream_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,15 @@ def _writeBytes(self, b: bytes) -> None:
if self.stream: # ignore writes when stream is closed
self.stream.write(b)
self.stream.flush()
# win11 might need a bit more time, too
if self.is_windows11:
time.sleep(1.0)
else:
# we sleep here to give the TBeam a chance to work
time.sleep(0.1)
# Wait for the node to handle the packet and avoid filling
# its buffer and dropping packets oldest-first (#575).
# Windows 11 might need this to be at least 1 second (#265).
# 2 seconds is reported to work on Windows and Linux, with
# a couple of node types.
# When config restore can handle and recover from dropped
# packets, or rate-limit based on acknowledgements, we can
# remove this.
time.sleep(2.0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a very heavy change since it'll apply to all writes on serial and TCP both, and not just configuration. Would it work to increase the sleeps in the handling for --configure specifically (and perhaps --export-config too if needed), rather than adding a forced delay to all interactions with the radio?


def _readBytes(self, length) -> Optional[bytes]:
"""Read an array of bytes from our stream"""
Expand Down