heater_graph: better max value selection

This commit is contained in:
alfrix 2022-11-14 13:18:58 -03:00
parent f80c2687c5
commit f7cbff3ed8

View File

@ -47,9 +47,15 @@ class HeaterGraph(Gtk.DrawingArea):
for name in self.store if "temperatures" in self.store[name])
def get_max_num(self, data_points=0):
mnum = []
for x in self.store:
mnum.extend(max(self.printer.get_temp_store(x, t, data_points)) for t in self.store[x] if t != "show")
mnum = [0]
for device in self.store:
if self.store[device]['show']:
temp = self.printer.get_temp_store(device, "temperatures", data_points)
if temp:
mnum.append(max(temp))
target = self.printer.get_temp_store(device, "targets", data_points)
if target:
mnum.append(max(target))
return max(mnum)
def draw_graph(self, da, ctx):