Enabling Completely Wireless

You can use SplitType.BLE and HIDModes.BLE at the same time
This commit is contained in:
yswallow 2022-03-11 18:09:10 +09:00 committed by Kyle Brown
parent 9539f2dc74
commit 1a7d1d53f6

View File

@ -167,7 +167,7 @@ class Split(Module):
def before_matrix_scan(self, keyboard): def before_matrix_scan(self, keyboard):
if self.split_type == SplitType.BLE: if self.split_type == SplitType.BLE:
self._check_all_connections() self._check_all_connections(keyboard)
self._receive_ble(keyboard) self._receive_ble(keyboard)
elif self.split_type == SplitType.UART: elif self.split_type == SplitType.UART:
if self._is_target or self.data_pin2: if self._is_target or self.data_pin2:
@ -215,13 +215,16 @@ class Split(Module):
self._uart_connection.connection_interval = 11.25 self._uart_connection.connection_interval = 11.25
self._psave_enable = False self._psave_enable = False
def _check_all_connections(self): def _check_all_connections(self, keyboard):
'''Validates the correct number of BLE connections''' '''Validates the correct number of BLE connections'''
self._previous_connection_count = self._connection_count self._previous_connection_count = self._connection_count
self._connection_count = len(self._ble.connections) self._connection_count = len(self._ble.connections)
if self._is_target: if self._is_target:
if self._advertising or not self._check_if_split_connected(): if self._advertising or not self._check_if_split_connected():
self._target_advertise() self._target_advertise()
elif self._connection_count < 2 and keyboard.hid_type == HIDModes.BLE:
keyboard._hid_helper.start_advertising()
elif not self._is_target and self._connection_count < 1: elif not self._is_target and self._connection_count < 1:
self._initiator_scan() self._initiator_scan()