settings: add setting for M-Key LEDs

This commit is contained in:
Peter F. Patel-Schneider 2022-02-23 09:38:08 -05:00
parent 856f40e789
commit faf905de9c
1 changed files with 29 additions and 1 deletions

View File

@ -986,6 +986,33 @@ class Gesture2Params(_LongSettings):
return cls(items, sub_items)
class MKeyLEDs(_BitFieldSetting):
name = 'm-key-leds'
label = _('M-Key LEDs')
description = _('Control the M-Key LEDs.')
feature = _F.MKEYS
choices_universe = _NamedInts()
for i in range(8):
choices_universe[1 << i] = 'M' + str(i + 1)
_labels = {k: (None, _('Lights up the %s key.') % k) for k in choices_universe}
print('MKEYS CHOICES UNIVERSE', choices_universe, _labels)
class rw_class(_FeatureRW):
def __init__(self, feature):
super().__init__(feature, write_fnid=0x10)
def read(self, device): # no way to read, so just assume off
return b'\x00'
class validator_class(_BitFieldV):
@classmethod
def build(cls, setting_class, device):
number = device.feature_request(setting_class.feature, 0x00)[0]
options = [setting_class.choices_universe[1 << i] for i in range(number)]
print('NUMBER OF MKEYS', number, options)
return cls(options) if options else None
SETTINGS = [
RegisterHandDetection, # simple
RegisterSmoothScroll, # simple
@ -1015,7 +1042,8 @@ SETTINGS = [
DisableKeyboardKeys, # working
DivertCrown, # working
CrownSmooth, # working
DivertGkeys,
DivertGkeys, # working
MKeyLEDs,
Multiplatform, # working
DualPlatform, # simple
ChangeHost, # working