main temp: fix issue with names with special characters

using special characters in names it's still not recommended!!!
This commit is contained in:
Alfredo Monclus 2024-05-17 23:01:15 -03:00
parent d24c8f078a
commit fe9d4257f2

View File

@ -49,10 +49,19 @@ class Printer:
self.tools.append(x)
self.tools = sorted(self.tools)
self.extrudercount += 1
if x.startswith('extruder_stepper'):
continue
self.data[x] = {
"temperature": 0,
"target": 0
}
if x == 'heater_bed' \
or x.startswith('heater_generic ') \
or x.startswith('temperature_sensor ') \
or x.startswith('temperature_fan '):
self.data[x] = {"temperature": 0}
if not x.startswith('temperature_sensor '):
self.data[x]["target"] = 0
# Support for hiding devices by name
name = x.split()[1] if len(x.split()) > 1 else x
if not name.startswith("_"):
@ -318,10 +327,10 @@ class Printer:
return list(self.tempstore)
def device_has_target(self, device):
return "target" in self.data[device]
return device in self.data and "target" in self.data[device]
def device_has_power(self, device):
return "power" in self.data[device]
return device in self.data and "power" in self.data[device]
def get_temp_store(self, device, section=False, results=0):
if device not in self.tempstore: