mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-02-18 16:33:57 +08:00
Global Brightness Override reimpl
This commit is contained in:
@@ -99,6 +99,7 @@ class UIStateSP:
|
||||
self.onroad_brightness = self.params.get("OnroadScreenOffBrightness", return_default=True)
|
||||
self.onroad_brightness_timer_param = self.params.get("OnroadScreenOffTimer", return_default=True)
|
||||
|
||||
self.global_brightness_override = self.params.get("Brightness", return_default=True)
|
||||
self.interactive_timeout = self.params.get("InteractivityTimeout", return_default=True)
|
||||
|
||||
|
||||
|
||||
@@ -259,9 +259,19 @@ class Device(DeviceSP):
|
||||
else:
|
||||
clipped_brightness = ((clipped_brightness + 16.0) / 116.0) ** 3.0
|
||||
|
||||
if gui_app.sunnypilot_ui():
|
||||
if ui_state.global_brightness_override == 1:
|
||||
clipped_brightness = float(np.clip(100.0 * clipped_brightness, 1.0, 100.0))
|
||||
elif ui_state.global_brightness_override == 0:
|
||||
clipped_brightness = float(np.clip(100.0 * clipped_brightness, 10.0, 100.0))
|
||||
|
||||
clipped_brightness = float(np.interp(clipped_brightness, [0, 1], [30, 100]))
|
||||
|
||||
brightness = round(self._brightness_filter.update(clipped_brightness))
|
||||
|
||||
if gui_app.sunnypilot_ui() and ui_state.global_brightness_override not in (0, 1):
|
||||
brightness = ui_state.global_brightness_override
|
||||
|
||||
if not self._awake:
|
||||
brightness = 0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user