splits update

This commit is contained in:
Kyle Brown
2020-11-04 20:00:47 -08:00
parent 8a166ac91f
commit 7a2bed8cdd
2 changed files with 11 additions and 3 deletions

View File

@@ -13,7 +13,7 @@ class BLE_Split(Extension):
'''Enables splitting keyboards wirelessly''' '''Enables splitting keyboards wirelessly'''
def __init__( def __init__(
self, split_flip=True, split_side=None, psave_ms=30, hid_type=HIDModes.BLE self, split_flip=True, split_side=None, uart_interval=30, hid_type=HIDModes.BLE
): ):
self._is_target = True self._is_target = True
self._uart_buffer = [] self._uart_buffer = []
@@ -29,7 +29,7 @@ class BLE_Split(Extension):
self._uart_connection = None self._uart_connection = None
self._advertisment = None self._advertisment = None
self._advertising = False self._advertising = False
self._psave_ms = psave_ms self._uart_interval = uart_interval
self._psave_enable = False self._psave_enable = False
def __repr__(self): def __repr__(self):
@@ -96,7 +96,7 @@ class BLE_Split(Extension):
def on_powersave_enable(self, keyboard): def on_powersave_enable(self, keyboard):
if self._uart_connection and not self._psave_enable: if self._uart_connection and not self._psave_enable:
self._uart_connection.connection_interval = self._psave_ms self._uart_connection.connection_interval = self._uart_interval
self._psave_enable = True self._psave_enable = True
def on_powersave_disable(self, keyboard): def on_powersave_disable(self, keyboard):

View File

@@ -2,6 +2,7 @@ import busio
from kmk.extensions import Extension from kmk.extensions import Extension
from kmk.matrix import intify_coordinate from kmk.matrix import intify_coordinate
from storage import getmount
class SplitType: class SplitType:
@@ -51,6 +52,13 @@ class Split(Extension):
self._is_target = True self._is_target = True
except OSError: except OSError:
self._is_target = False self._is_target = False
l_or_r = str(getmount('/').label)
if l_or_r.endswith('L'):
# If name ends in 'L' assume left and strip from name
self.split_side = 'Left'
elif l_or_r.endswith('R'):
# If name ends in 'R' assume right and strip from name
self.split_side = 'Right'
if self.split_flip and not self._is_target: if self.split_flip and not self._is_target:
keyboard.col_pins = list(reversed(keyboard.col_pins)) keyboard.col_pins = list(reversed(keyboard.col_pins))