From d1ea364e88a1666d306906b6e8bc18b9fa0ce74c Mon Sep 17 00:00:00 2001 From: Hannes Verschore Date: Mon, 16 Dec 2024 23:32:55 +0100 Subject: [PATCH 1/2] Fix restart method in radiodriver.py. Restart doesn't work anymore, since _RadioDriverThread expects a rate_limit. Fixing this by saving the rate_limit and reusing it here. --- cflib/crtp/radiodriver.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cflib/crtp/radiodriver.py b/cflib/crtp/radiodriver.py index 52095ad0..f46a9588 100644 --- a/cflib/crtp/radiodriver.py +++ b/cflib/crtp/radiodriver.py @@ -260,6 +260,7 @@ def connect(self, uri, link_quality_callback, link_error_callback): devid, channel, datarate, address, rate_limit = self.parse_uri(uri) self.uri = uri + self.rate_limit = rate_limit if self._radio is None: self._radio = RadioManager.open(devid) @@ -383,7 +384,8 @@ def restart(self): self.out_queue, self.link_quality_callback, self.link_error_callback, - self) + self, + self.rate_limit) self._thread.start() def close(self): From 6eea1ed0e7d0d02aef4e44cc1676b6034efeeebf Mon Sep 17 00:00:00 2001 From: Tove Date: Wed, 8 Jan 2025 13:41:18 +0100 Subject: [PATCH 2/2] Initialize rate_limit Initialize rate_limit to None, for good practice --- cflib/crtp/radiodriver.py | 1 + 1 file changed, 1 insertion(+) diff --git a/cflib/crtp/radiodriver.py b/cflib/crtp/radiodriver.py index f46a9588..7e8ad3a5 100644 --- a/cflib/crtp/radiodriver.py +++ b/cflib/crtp/radiodriver.py @@ -246,6 +246,7 @@ def __init__(self): self.out_queue = None self._thread = None self.needs_resending = True + self.rate_limit = None def connect(self, uri, link_quality_callback, link_error_callback): """