File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -65,6 +65,12 @@ Usage Example
65
65
66
66
from adafruit_ble.advertising.standard import ProvideServicesAdvertisement
67
67
from adafruit_ble_magic_light import MagicLightService
68
+
69
+ # CircuitPython <5 uses it's own ConnectionError type. So, is it if available. Otherwise,
70
+ # the built in ConnectionError is used.
71
+ connection_error = ConnectionError
72
+ if hasattr (_bleio, " ConnectionError" ):
73
+ connection_error = _bleio.ConnectionError
68
74
69
75
def find_connection ():
70
76
for connection in radio.connections:
@@ -100,7 +106,7 @@ Usage Example
100
106
active_connection = radio.connect(scan)
101
107
try :
102
108
pixels = active_connection[MagicLightService]
103
- except _bleio.ConnectionError :
109
+ except connection_error :
104
110
print (" disconnected" )
105
111
continue
106
112
break
You can’t perform that action at this time.
0 commit comments