From 8b9d0c431957ded4f0db9ed05f53c1b4ab97e9c4 Mon Sep 17 00:00:00 2001 From: interfect Date: Wed, 24 Sep 2025 09:46:58 -0400 Subject: [PATCH] Make sleep longer and universal This should fix #575 and also fix #576. --- meshtastic/stream_interface.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/meshtastic/stream_interface.py b/meshtastic/stream_interface.py index a45c0676..281e0ead 100644 --- a/meshtastic/stream_interface.py +++ b/meshtastic/stream_interface.py @@ -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) def _readBytes(self, length) -> Optional[bytes]: """Read an array of bytes from our stream"""