mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-08-21 00:03:45 +08:00
Turn up brightness a little when UI crashes (#20142)
* implement ui check and brightness set in thermald * fix bugs * only set once * duh * forgot factor for tici old-commit-hash: 4c243da0194b8fcefb3c7cba3472fa983ccd7052
This commit is contained in:
@@ -101,3 +101,7 @@ class HardwareBase:
|
||||
@abstractmethod
|
||||
def get_thermal_config(self):
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def set_screen_brightness(self, percentage):
|
||||
pass
|
||||
|
||||
@@ -348,3 +348,7 @@ class Android(HardwareBase):
|
||||
|
||||
def get_thermal_config(self):
|
||||
return ThermalConfig(cpu=((5, 7, 10, 12), 10), gpu=((16,), 10), mem=(2, 10), bat=(29, 1000), ambient=(25, 1))
|
||||
|
||||
def set_screen_brightness(self, percentage):
|
||||
with open("/sys/class/leds/lcd-backlight/brightness", "w") as f:
|
||||
f.write(str(int(percentage * 2.55)))
|
||||
|
||||
@@ -76,3 +76,6 @@ class Pc(HardwareBase):
|
||||
|
||||
def get_thermal_config(self):
|
||||
return ThermalConfig(cpu=((None,), 1), gpu=((None,), 1), mem=(None, 1), bat=(None, 1), ambient=(None, 1))
|
||||
|
||||
def set_screen_brightness(self, percentage):
|
||||
pass
|
||||
|
||||
@@ -183,3 +183,7 @@ class Tici(HardwareBase):
|
||||
|
||||
def get_thermal_config(self):
|
||||
return ThermalConfig(cpu=((1, 2, 3, 4, 5, 6, 7, 8), 1000), gpu=((48,49), 1000), mem=(15, 1000), bat=(None, 1), ambient=(70, 1000))
|
||||
|
||||
def set_screen_brightness(self, percentage):
|
||||
with open("/sys/class/backlight/panel0-backlight/brightness", "w") as f:
|
||||
f.write(str(percentage * 10.23))
|
||||
|
||||
Reference in New Issue
Block a user