From 795167b337f0ddf7217e4dc158a08a757295aa56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gon=C3=A7alo=20Negrier=20Duarte?= Date: Sun, 13 Oct 2024 13:27:09 +0100 Subject: [PATCH] chore: revert back to int in fan_speed * TODO: fix convertion from PWM <-> RPM MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gonçalo Negrier Duarte --- python/legion_linux/legion_linux/legion.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/python/legion_linux/legion_linux/legion.py b/python/legion_linux/legion_linux/legion.py index 78cb165..85da4ea 100755 --- a/python/legion_linux/legion_linux/legion.py +++ b/python/legion_linux/legion_linux/legion.py @@ -42,8 +42,8 @@ def get_dmesg(only_tail=False, filter_log=True): @dataclass(order=True) class FanCurveEntry: - fan1_speed: float # fan speed in rpm - fan2_speed: float # fan speed in rpm + fan1_speed: int # fan speed in rpm + fan2_speed: int # fan speed in rpm cpu_lower_temp: int cpu_upper_temp: int gpu_lower_temp: int @@ -793,7 +793,7 @@ def _write_file(file_path, value): def _write_file_or(file_path, value): if os.path.exists(file_path): FanCurveIO._write_file(file_path, value) - + def get_fan_1_max_rpm(self): file_path = self.hwmon_path + self.fan1_max return int(self._read_file(file_path)) @@ -813,10 +813,10 @@ def set_fan_2_speed_pwm(self, point_id, value): self._write_file(file_path, value) def set_fan_1_speed_rpm(self, point_id, value): - return self.set_fan_1_speed_pwm(point_id, round(value/self.get_fan_1_max_rpm()*255.0)) + return self.set_fan_1_speed_pwm(point_id, round(value/self.get_fan_1_max_rpm()*255)) def set_fan_2_speed_rpm(self, point_id, value): - return self.set_fan_2_speed_pwm(point_id, round(value/self.get_fan_2_max_rpm()*255.0)) + return self.set_fan_2_speed_pwm(point_id, round(value/self.get_fan_2_max_rpm()*255)) def set_lower_cpu_temperature(self, point_id, value): point_id = self._validate_point_id(point_id) @@ -869,10 +869,10 @@ def get_fan_2_speed_pwm(self, point_id): return self._read_file(file_path) def get_fan_1_speed_rpm(self, point_id): - return round(self.get_fan_1_speed_pwm(point_id)/255.0*self.get_fan_1_max_rpm(), ndigits=2) + return round(self.get_fan_1_speed_pwm(point_id)/255*self.get_fan_1_max_rpm()) def get_fan_2_speed_rpm(self, point_id): - return round(self.get_fan_2_speed_pwm(point_id)/255.0*self.get_fan_2_max_rpm(), ndigits=2) + return round(self.get_fan_2_speed_pwm(point_id)/255*self.get_fan_2_max_rpm()) def get_lower_cpu_temperature(self, point_id): point_id = self._validate_point_id(point_id)