settings: add setting for MR-Key LED

This commit is contained in:
Peter F. Patel-Schneider 2022-02-23 10:05:25 -05:00
parent faf905de9c
commit cb7845471c
1 changed files with 16 additions and 3 deletions

View File

@ -995,7 +995,6 @@ class MKeyLEDs(_BitFieldSetting):
for i in range(8): for i in range(8):
choices_universe[1 << i] = 'M' + str(i + 1) choices_universe[1 << i] = 'M' + str(i + 1)
_labels = {k: (None, _('Lights up the %s key.') % k) for k in choices_universe} _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): class rw_class(_FeatureRW):
def __init__(self, feature): def __init__(self, feature):
@ -1009,10 +1008,23 @@ class MKeyLEDs(_BitFieldSetting):
def build(cls, setting_class, device): def build(cls, setting_class, device):
number = device.feature_request(setting_class.feature, 0x00)[0] number = device.feature_request(setting_class.feature, 0x00)[0]
options = [setting_class.choices_universe[1 << i] for i in range(number)] 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 return cls(options) if options else None
class MRKeyLED(_Setting):
name = 'mr-key-led'
label = _('MR-Key LED')
description = _('Control the MR-Key LED.')
feature = _F.MR
class rw_class(_FeatureRW):
def __init__(self, feature):
super().__init__(feature, write_fnid=0x00)
def read(self, device): # no way to read, so just assume off
return b'\x00'
SETTINGS = [ SETTINGS = [
RegisterHandDetection, # simple RegisterHandDetection, # simple
RegisterSmoothScroll, # simple RegisterSmoothScroll, # simple
@ -1043,7 +1055,8 @@ SETTINGS = [
DivertCrown, # working DivertCrown, # working
CrownSmooth, # working CrownSmooth, # working
DivertGkeys, # working DivertGkeys, # working
MKeyLEDs, MKeyLEDs, # working
MRKeyLED,
Multiplatform, # working Multiplatform, # working
DualPlatform, # simple DualPlatform, # simple
ChangeHost, # working ChangeHost, # working