Skip to content

Commit

Permalink
fix value range
Browse files Browse the repository at this point in the history
  • Loading branch information
JarbasAl committed Aug 16, 2024
1 parent d5809d2 commit 56b8562
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ovos_gui_plugin_shell_companion/brightness.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ def discover(self):
else:
self.ddcutil_detected_bus = None
LOG.error("Display is not detected by DDCUTIL")
self.device_interface = None
return

if self.ddcutil_detected_bus:
proc_fetch_vcp = subprocess.Popen(
Expand Down Expand Up @@ -134,9 +136,8 @@ def get_brightness(self) -> int:
["cat", "/sys/class/backlight/rpi_backlight/actual_brightness"], stdout=subprocess.PIPE
)
for line in proc_fetch_vcp.stdout:
# TODO - is this 0-100 or 0-255 range ?
brightness_level = line.decode("utf-8").strip()
self._brightness_level = int(brightness_level)
self._brightness_level = int(brightness_level) * 100 / 255 # convert from 0-255 to 0-100 range

return self._brightness_level

Expand Down

0 comments on commit 56b8562

Please sign in to comment.