Global Brightness Override reimpl

This commit is contained in:
Jason Wen
2026-01-03 18:46:49 -05:00
parent 459863a9bb
commit 53522da4f8
2 changed files with 11 additions and 0 deletions

View File

@@ -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)

View File

@@ -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