improved multi-gpu screen brightness measurement
This commit is contained in:
parent
5711f591a3
commit
eb75090b37
@ -15,9 +15,9 @@ if __name__ == "__main__":
|
||||
# Right LED Matrix location: "1-3.3"
|
||||
|
||||
# Set up monitors and serial for left LED Matrix
|
||||
min_background_brightness = 8
|
||||
min_background_brightness = 12
|
||||
max_background_brightness = 35
|
||||
min_foreground_brightness = 30
|
||||
min_foreground_brightness = 24
|
||||
max_foreground_brightness = 160
|
||||
|
||||
cpu_monitor = CPUMonitor()
|
||||
|
@ -129,6 +129,12 @@ def get_monitor_brightness():
|
||||
if os.name == 'nt':
|
||||
return wmi.WMI(namespace='wmi').WmiMonitorBrightness()[0].CurrentBrightness / 100.0
|
||||
else:
|
||||
try: # First try the dGPU brightness
|
||||
return int(open('/sys/class/backlight/amdgpu_bl2/brightness', 'r').read()) / 255.0
|
||||
except: # If that doesn't work, try the iGPU brightness
|
||||
return int(open('/sys/class/backlight/amdgpu_bl1/brightness', 'r').read()) / 255.0
|
||||
except Exception as e:
|
||||
return 1.0
|
||||
|
||||
if __name__ == "__main__":
|
||||
print(get_monitor_brightness())
|
Loading…
Reference in New Issue
Block a user