Skip to content

Commit ca446b8

Browse files
committed
not get ble connection interval as it may block forever
1 parent 725d4c4 commit ca446b8

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

keyboard/__init__.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -189,11 +189,12 @@ def check(self):
189189
self.backlight.set_bt_led(None)
190190
for c in self.ble.connections:
191191
try:
192-
if c.connection_interval > 11.25:
193-
c.connection_interval = 11.25
194-
except _bleio.BluetoothError:
195-
self.log("failed to set ble connection interval")
196-
self.log('ble connection interval {}'.format(c.connection_interval))
192+
# 11.25 ms is the min connection interval for most systems
193+
c.connection_interval = 11.25
194+
except Exception:
195+
print("Failed to set ble connection interval")
196+
# Avoid getting connection_interval, as it may block forever
197+
# self.log('ble connection interval {}'.format(c.connection_interval))
197198
elif time.time() > self.adv_timeout:
198199
self.stop_advertising()
199200

0 commit comments

Comments
 (0)