Compare commits

...

2 Commits

2 changed files with 9 additions and 3 deletions

View File

@ -15,9 +15,9 @@ if __name__ == "__main__":
# Right LED Matrix location: "1-3.3" # Right LED Matrix location: "1-3.3"
# Set up monitors and serial for left LED Matrix # Set up monitors and serial for left LED Matrix
min_background_brightness = 8 min_background_brightness = 12
max_background_brightness = 35 max_background_brightness = 35
min_foreground_brightness = 30 min_foreground_brightness = 24
max_foreground_brightness = 160 max_foreground_brightness = 160
cpu_monitor = CPUMonitor() cpu_monitor = CPUMonitor()

View File

@ -129,6 +129,12 @@ def get_monitor_brightness():
if os.name == 'nt': if os.name == 'nt':
return wmi.WMI(namespace='wmi').WmiMonitorBrightness()[0].CurrentBrightness / 100.0 return wmi.WMI(namespace='wmi').WmiMonitorBrightness()[0].CurrentBrightness / 100.0
else: 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 return int(open('/sys/class/backlight/amdgpu_bl1/brightness', 'r').read()) / 255.0
except Exception as e: except Exception as e:
return 1.0 return 1.0
if __name__ == "__main__":
print(get_monitor_brightness())