Skip to content
Merged
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
7 changes: 3 additions & 4 deletions meshtastic/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,9 @@
self.sleepInterval: float = 0.1
self.expireTimeout: int = maxSecs

def reset(self) -> None:
def reset(self, expireTimeout=None):
"""Restart the waitForSet timer"""
self.expireTime = time.time() + self.expireTimeout
self.expireTime = time.time() + (self.expireTimeout if expireTimeout is None else expireTimeout)

def waitForSet(self, target, attrs=()) -> bool:
"""Block until the specified attributes are set. Returns True if config has been received."""
Expand All @@ -225,8 +225,7 @@

def waitForTraceRoute(self, waitFactor, acknowledgment, attr="receivedTraceRoute") -> bool:
"""Block until traceroute response is received. Returns True if traceroute response has been received."""
self.expireTimeout *= waitFactor
self.reset()
self.reset(self.expireTimeout * waitFactor)

Check warning on line 228 in meshtastic/util.py

View check run for this annotation

Codecov / codecov/patch

meshtastic/util.py#L228

Added line #L228 was not covered by tests
while time.time() < self.expireTime:
if getattr(acknowledgment, attr, None):
acknowledgment.reset()
Expand Down
Loading