Fix TypeError when HDD temperature data contains None values

This commit is contained in:
Joan
2026-01-21 18:34:25 +01:00
parent be20740f98
commit 5bbee94765

View File

@@ -371,7 +371,7 @@ class Matrix64Display(SampleBase):
graphics.DrawLine(canvas, 28, 0, 28, 25, line_color) graphics.DrawLine(canvas, 28, 0, 28, 25, line_color)
if self.hdd_temps and len(self.hdd_temps) > 1: if self.hdd_temps and len(self.hdd_temps) > 1:
temps = [str(int(t[0])) for t in self.hdd_temps[1:] if t] temps = [str(int(t[0])) for t in self.hdd_temps[1:] if t and t[0] is not None]
if len(temps) >= 2: if len(temps) >= 2:
graphics.DrawText(canvas, data_font, 34, 8, hdd_color, " ".join(temps[:2])) graphics.DrawText(canvas, data_font, 34, 8, hdd_color, " ".join(temps[:2]))
if len(temps) >= 4: if len(temps) >= 4:
@@ -411,7 +411,7 @@ class Matrix64Display(SampleBase):
graphics.DrawLine(canvas, 0, 10, 63, 10, line_color) graphics.DrawLine(canvas, 0, 10, 63, 10, line_color)
if self.hdd_temps and len(self.hdd_temps) > 1: if self.hdd_temps and len(self.hdd_temps) > 1:
temps = [(i+1, int(t[0])) for i, t in enumerate(self.hdd_temps[1:7]) if t] temps = [(i+1, int(t[0])) for i, t in enumerate(self.hdd_temps[1:7]) if t and t[0] is not None]
y = 22 y = 22
for idx, (num, temp_val) in enumerate(temps[:3]): for idx, (num, temp_val) in enumerate(temps[:3]):