Commit f6fbb75d authored by Guillaume Seguin's avatar Guillaume Seguin

Pass parsed gcoder line to sendcb

parent 36688d2f
......@@ -563,14 +563,16 @@ class printcore():
if self.printer:
self.sent.append(command)
# run the command through the analyzer
try: self.analyzer.append(command, store = False)
gline = None
try:
gline = self.analyzer.append(command, store = False)
except:
logging.warning(_("Could not analyze command %s:") % command +
"\n" + traceback.format_exc())
if self.loud:
logging.info("SENT: %s" % command)
if self.sendcb:
try: self.sendcb(command)
try: self.sendcb(command, gline)
except: pass
try:
self.printer.write(str(command + "\n"))
......
......@@ -277,11 +277,10 @@ class PronterWindow(MainWindow, pronsole.pronsole):
if self.filename:
self.printbtn.Enable()
def sentcb(self, line):
gline = gcoder.Line(line)
split_raw = gcoder.split(gline)
gcoder.parse_coordinates(gline, split_raw, imperial = False)
if gline.is_move:
def sentcb(self, line, gline):
if not gline:
pass
elif gline.is_move:
if gline.z is not None:
layer = gline.z
if layer != self.curlayer:
......@@ -289,14 +288,12 @@ class PronterWindow(MainWindow, pronsole.pronsole):
wx.CallAfter(self.gviz.clearhilights)
wx.CallAfter(self.gviz.setlayer, layer)
elif gline.command in ["M104", "M109"]:
gcoder.parse_coordinates(gline, split_raw, imperial = False, force = True)
gline_s = gcoder.S(gline)
if gline_s is not None:
temp = gline_s
if self.display_gauges: wx.CallAfter(self.hottgauge.SetTarget, temp)
if self.display_graph: wx.CallAfter(self.graph.SetExtruder0TargetTemperature, temp)
elif gline.command in ["M140", "M190"]:
gline.parse_coordinates(gline, split_raw, imperial = False, force = True)
gline_s = gcoder.S(gline)
if gline_s is not None:
temp = gline_s
......@@ -305,8 +302,6 @@ class PronterWindow(MainWindow, pronsole.pronsole):
elif gline.command.startswith("T"):
tool = gline.command[1:]
if hasattr(self, "extrudersel"): wx.CallAfter(self.extrudersel.SetValue, tool)
else:
return
self.sentlines.put_nowait(line)
def is_excluded_move(self, gline):
......
......@@ -285,7 +285,7 @@ class Prontserve(pronsole.pronsole, EventEmitter):
if l!="ok" and not l.startswith("ok T") and not l.startswith("T:"):
self.async(self._receive_printer_error, l)
def sendcb(self, l):
def sendcb(self, l, gl):
# Monitor the sent commands for new extruder target temperatures
if ("M109" in l) or ("M104" in l) or ("M140" in l) or ("M190" in l):
temp = float(re.search('S([0-9]+)', l).group(1))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment