heater: Return heaters with a gcode_id from new get_gcode_sensors()

The gcode.py code should not peek into the heater classes to obtain
the gcode_id.  Instead, introduce a new get_gcode_sensors() so that
the gcode.py code does not need to.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2019-02-25 20:30:37 -05:00
parent bb4fab5570
commit c54c81dc2a
2 changed files with 11 additions and 9 deletions

View file

@ -373,9 +373,9 @@ class GCodeParser:
# Tn:XXX /YYY B:XXX /YYY
out = []
if self.heaters is not None:
for heater in self.heaters.get_all_heaters():
cur, target = heater.get_temp(eventtime)
out.append("%s:%.1f /%.1f" % (heater.gcode_id, cur, target))
for gcode_id, sensor in sorted(self.heaters.get_gcode_sensors()):
cur, target = sensor.get_temp(eventtime)
out.append("%s:%.1f /%.1f" % (gcode_id, cur, target))
if not out:
return "T:0"
return " ".join(out)