ui: handle backlight notification
This commit is contained in:
parent
72c5860a1e
commit
9c4bbec5e2
|
@ -410,6 +410,14 @@ def _process_feature_notification(device, status, n, feature):
|
|||
else:
|
||||
_log.warn('%s: unknown REPROG_CONTROLS %s', device, n)
|
||||
|
||||
elif feature == _F.BACKLIGHT2:
|
||||
if (n.address == 0x00):
|
||||
level = _unpack('!B', n.data[1:2])[0]
|
||||
from solaar.ui.config_panel import record_setting # prevent circular import
|
||||
setting = next((s for s in device.settings if s.name == _st.Backlight2Level.name), None)
|
||||
if setting:
|
||||
record_setting(device, setting, [level])
|
||||
|
||||
elif feature == _F.REPROG_CONTROLS_V4:
|
||||
if n.address == 0x00:
|
||||
if _log.isEnabledFor(_DEBUG):
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
import traceback
|
||||
|
||||
from logging import DEBUG as _DEBUG
|
||||
from logging import WARNING as _WARNING
|
||||
from logging import getLogger
|
||||
from threading import Timer as _Timer
|
||||
|
@ -724,6 +725,8 @@ def record_setting(device, setting, values):
|
|||
|
||||
|
||||
def _record_setting(device, setting, values):
|
||||
if _log.isEnabledFor(_DEBUG):
|
||||
_log.debug('on %s changing setting %s to %s', device, setting, values)
|
||||
if len(values) > 1:
|
||||
setting.update_key_value(values[0], values[-1])
|
||||
value = {values[0]: values[-1]}
|
||||
|
|
Loading…
Reference in New Issue