screenpanel: improve update_temp
This commit is contained in:
parent
99cecc151e
commit
3a7bccca69
@ -165,20 +165,13 @@ class ScreenPanel:
|
|||||||
return name
|
return name
|
||||||
|
|
||||||
def update_temp(self, dev, temp, target, power, lines=1):
|
def update_temp(self, dev, temp, target, power, lines=1):
|
||||||
if temp is None:
|
new_label_text = f"{temp or 0:.1f}"
|
||||||
return
|
if self._printer.device_has_target(dev) and target:
|
||||||
|
|
||||||
show_target = bool(target)
|
|
||||||
if dev in self.devices and not self.devices[dev]["can_target"]:
|
|
||||||
show_target = False
|
|
||||||
|
|
||||||
show_power = show_target and self._show_heater_power and power
|
|
||||||
|
|
||||||
new_label_text = f"{temp:.0f}"
|
|
||||||
if show_target:
|
|
||||||
new_label_text += f"/{target:.0f}"
|
new_label_text += f"/{target:.0f}"
|
||||||
if dev not in self.devices:
|
if dev not in self.devices:
|
||||||
new_label_text += "°"
|
new_label_text += "°"
|
||||||
|
|
||||||
|
show_power = self._show_heater_power and power
|
||||||
if show_power:
|
if show_power:
|
||||||
if lines == 2:
|
if lines == 2:
|
||||||
# The label should wrap, but it doesn't work
|
# The label should wrap, but it doesn't work
|
||||||
|
Loading…
x
Reference in New Issue
Block a user