Minor tweaks on the thermal page

This commit is contained in:
Stephen Horvath
2025-03-18 19:23:36 +10:00
parent 4cb09d81a4
commit 5c1bf1c630

View File

@@ -21,13 +21,17 @@ class YAFI(Adw.Application):
content.remove(content_child) content.remove(content_child)
content.append(page) content.append(page)
def _update_thermals(self, fan_rpm, temp_items): def _update_thermals(self, fan_rpm, temp_items, fan_rpm_target):
ec_fans = ec_commands.memmap.get_fans(self.cros_ec) ec_fans = ec_commands.memmap.get_fans(self.cros_ec)
fan_rpm.set_subtitle(f"{ec_fans[0]} RPM") fan_rpm.set_subtitle(f"{ec_fans[0]} RPM")
ec_temp_sensors = ec_commands.memmap.get_temps(self.cros_ec) ec_temp_sensors = ec_commands.memmap.get_temps(self.cros_ec)
for i, item in enumerate(temp_items): # The temp sensors disappear sometimes, so we need to handle that
item.set_subtitle(f"{ec_temp_sensors[i]}°C") for i in range(min(len(temp_items), len(ec_temp_sensors))):
temp_items[i].set_subtitle(f"{ec_temp_sensors[i]}°C")
ec_target_rpm = ec_commands.pwm.pwm_get_fan_rpm(self.cros_ec)
fan_rpm_target.set_subtitle(f"{ec_target_rpm} RPM")
return self.current_page == 0 return self.current_page == 0
@@ -85,10 +89,10 @@ class YAFI(Adw.Application):
temperatures.append(new_row) temperatures.append(new_row)
temp_items.append(new_row) temp_items.append(new_row)
self._update_thermals(fan_rpm, temp_items) self._update_thermals(fan_rpm, temp_items, fan_set_rpm)
# Schedule _update_thermals to run every second # Schedule _update_thermals to run every second
GLib.timeout_add_seconds(1, self._update_thermals, fan_rpm, temp_items) GLib.timeout_add_seconds(1, self._update_thermals, fan_rpm, temp_items, fan_set_rpm)
def _leds_page(self, builder): def _leds_page(self, builder):
# Load the leds.ui file # Load the leds.ui file