Skip to content

Commit

Permalink
Merge pull request #1237 from volconst/empty-temp-graph
Browse files Browse the repository at this point in the history
Fix Empty temp graph #1234
  • Loading branch information
volconst authored Jan 18, 2022
2 parents faade5b + 0c40c1a commit 86d2126
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 38 deletions.
2 changes: 1 addition & 1 deletion printrun/pronsole.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
except:
READLINE = False # neither readline module is available

tempreading_exp = re.compile("(^T:| T:)")
tempreading_exp = re.compile('\\bT\d*:')

REPORT_NONE = 0
REPORT_POS = 1
Expand Down
55 changes: 25 additions & 30 deletions printrun/pronterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -1865,36 +1865,31 @@ def layer_change_cb(self, newlayer):
def update_tempdisplay(self):
try:
temps = parse_temperature_report(self.tempreadings)
if "T0" in temps and temps["T0"][0]:
hotend_temp = float(temps["T0"][0])
elif "T" in temps and temps["T"][0]:
hotend_temp = float(temps["T"][0])
else:
hotend_temp = None
if hotend_temp is not None:
if self.display_graph: wx.CallAfter(self.graph.SetExtruder0Temperature, hotend_temp)
if self.display_gauges: wx.CallAfter(self.hottgauge.SetValue, hotend_temp)
setpoint = None
if "T0" in temps and temps["T0"][1]: setpoint = float(temps["T0"][1])
elif temps["T"][1]: setpoint = float(temps["T"][1])
if setpoint is not None:
if self.display_graph: wx.CallAfter(self.graph.SetExtruder0TargetTemperature, setpoint)
if self.display_gauges: wx.CallAfter(self.hottgauge.SetTarget, setpoint)
if "T1" in temps:
hotend_temp = float(temps["T1"][0])
if self.display_graph: wx.CallAfter(self.graph.SetExtruder1Temperature, hotend_temp)
setpoint = temps["T1"][1]
if setpoint and self.display_graph:
wx.CallAfter(self.graph.SetExtruder1TargetTemperature, float(setpoint))
bed_temp = float(temps["B"][0]) if "B" in temps and temps["B"][0] else None
if bed_temp is not None:
if self.display_graph: wx.CallAfter(self.graph.SetBedTemperature, bed_temp)
if self.display_gauges: wx.CallAfter(self.bedtgauge.SetValue, bed_temp)
setpoint = temps["B"][1]
if setpoint:
setpoint = float(setpoint)
if self.display_graph: wx.CallAfter(self.graph.SetBedTargetTemperature, setpoint)
if self.display_gauges: wx.CallAfter(self.bedtgauge.SetTarget, setpoint)

for name in 'T', 'T0', 'T1', 'B':
if name not in temps:
continue
current = float(temps[name][0])
target = float(temps[name][1]) if temps[name][1] else None
if name == 'T':
name = 'T0'
if self.display_graph:
prefix = 'Set' + name.replace('T', 'Extruder').replace('B', 'Bed')
wx.CallAfter(getattr(self.graph, prefix + 'Temperature'), current)
if target is not None:
wx.CallAfter(getattr(self.graph, prefix + 'TargetTemperature'), target)
if self.display_gauges:
if name[0] == 'T':
if name[1] == str(self.current_tool):
def update(c, t):
self.hottgauge.SetValue(c)
self.hottgauge.SetTarget(t or 0)
self.hottgauge.title = _('Heater%s:') % (str(self.current_tool) if self.settings.extruders > 1 else '')
wx.CallAfter(update, current, target)
else:
wx.CallAfter(self.bedtgauge.SetValue, current)
if target is not None:
wx.CallAfter(self.bedtgauge.SetTarget, target)
except:
self.logError(traceback.format_exc())

Expand Down
13 changes: 6 additions & 7 deletions testtools/mock-printer.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
#!/usr/bin/env python3
# Test network communication without networked 3d printer
# Usage:
# bash1$ ./mock-printer.py
# bash2$ ./pronsole
# pronsole> connect localhost:8080
# ...> load sliced.gcode
# ...> print
# ...> etc...
# bash1$ ./testtools/mock-printer.py
# bash2$ ./pronterface.py
# Enter localhost:8080 in Port, press Connect, Load file, Print
import socket
with socket.socket() as s:
s.bind(('127.0.0.1', 8080))
Expand All @@ -22,7 +19,9 @@
break
print(msg)
if msg == b'M105\n':
c.sendall(('ok T:%d\n'%(20 + temp)).encode('ascii'))
# c.sendall(('ok T:%d\n'%(20 + temp)).encode('ascii'))
# test multiple extruders, see #1234
c.sendall('ok T0:24.06 /34.00 B:23.45 /0.00 T1:44.28 /54 @:0 B@:0 @0:0 @1:0\n'.encode('ascii'))
temp = (temp + 1)%30
else:
c.sendall(b'ok\n')
Expand Down

0 comments on commit 86d2126

Please sign in to comment.