diff --git a/meshtastic/node.py b/meshtastic/node.py index e6bd3ca6..18d86887 100644 --- a/meshtastic/node.py +++ b/meshtastic/node.py @@ -448,7 +448,12 @@ def get_ringtone(self): self._sendAdmin( p1, wantResponse=True, onResponse=self.onResponseRequestRingtone ) - while self.gotResponse is False: + start_time = time.time() + timeout = 2 + while not self.gotResponse: + if time.time() - start_time > timeout: + logging.warning("Timeout waiting for ringtone plugin response") + return None time.sleep(0.1) logging.debug(f"self.ringtone:{self.ringtone}") @@ -521,7 +526,13 @@ def get_canned_message(self): wantResponse=True, onResponse=self.onResponseRequestCannedMessagePluginMessageMessages, ) - while self.gotResponse is False: + + start_time = time.time() + timeout = 2 + while not self.gotResponse: + if time.time() - start_time > timeout: + logging.warning("Timeout waiting for canned message plugin response") + return None time.sleep(0.1) logging.debug(