We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 69b25ca + 3876f9b commit 3450f8fCopy full SHA for 3450f8f
cflib/utils/power_switch.py
@@ -39,13 +39,16 @@ def __init__(self, uri):
39
self.uri = uri
40
uri_augmented = uri+'?safelink=0&autoping=0&ackfilter=0'
41
self.link = cflib.crtp.get_link_driver(uri_augmented)
42
- # Switch to legacy mode, if uri options are not available
43
- if not self.link:
+ # Switch to legacy mode, if uri options are not available or old Python backend is used
+ if not self.link or self.link.get_name() == 'radio':
44
uri_parts = cflib.crtp.RadioDriver.parse_uri(uri)
45
self.devid = uri_parts[0]
46
self.channel = uri_parts[1]
47
self.datarate = uri_parts[2]
48
self.address = uri_parts[3]
49
+ if self.link:
50
+ self.link.close()
51
+ self.link = None
52
53
def platform_power_down(self):
54
""" Power down the platform, both NRF and STM MCUs.
0 commit comments