From 56b8562cb013a106ec2c23eda1b1f7e6866ec6b8 Mon Sep 17 00:00:00 2001 From: miro Date: Fri, 16 Aug 2024 15:21:15 +0100 Subject: [PATCH] fix value range --- ovos_gui_plugin_shell_companion/brightness.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ovos_gui_plugin_shell_companion/brightness.py b/ovos_gui_plugin_shell_companion/brightness.py index 179627e..f890d0b 100644 --- a/ovos_gui_plugin_shell_companion/brightness.py +++ b/ovos_gui_plugin_shell_companion/brightness.py @@ -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( @@ -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