Commit e3af95cd authored by Guillaume Seguin's avatar Guillaume Seguin

Improve temperature report detection

parent 07d66212
...@@ -26,6 +26,7 @@ import argparse ...@@ -26,6 +26,7 @@ import argparse
import locale import locale
import logging import logging
import traceback import traceback
import re
from . import printcore from . import printcore
from printrun.printrun_utils import install_locale, run_command, \ from printrun.printrun_utils import install_locale, run_command, \
...@@ -51,6 +52,8 @@ try: ...@@ -51,6 +52,8 @@ try:
except: except:
READLINE = False # neither readline module is available READLINE = False # neither readline module is available
tempreading_exp = re.compile("(^T:| T:)")
def dosify(name): def dosify(name):
return os.path.split(name)[1].split(".")[0][:8] + ".g" return os.path.split(name)[1].split(".")[0][:8] + ".g"
...@@ -1124,7 +1127,7 @@ class pronsole(cmd.Cmd): ...@@ -1124,7 +1127,7 @@ class pronsole(cmd.Cmd):
return [i for i in self.sdfiles if i.startswith(text)] return [i for i in self.sdfiles if i.startswith(text)]
def recvcb(self, l): def recvcb(self, l):
if "T:" in l: if tempreading_exp.findall(l):
self.tempreadings = l self.tempreadings = l
self.status.update_tempreading(l) self.status.update_tempreading(l)
tstring = l.rstrip() tstring = l.rstrip()
......
...@@ -59,6 +59,8 @@ from pronsole import dosify, wxSetting, HiddenSetting, StringSetting, SpinSettin ...@@ -59,6 +59,8 @@ from pronsole import dosify, wxSetting, HiddenSetting, StringSetting, SpinSettin
from printrun import gcoder from printrun import gcoder
tempreport_exp = re.compile("([TB]\d*):([-+]?\d*\.?\d*)(?: ?\/)?([-+]?\d*\.?\d*)") tempreport_exp = re.compile("([TB]\d*):([-+]?\d*\.?\d*)(?: ?\/)?([-+]?\d*\.?\d*)")
tempreading_exp = re.compile("(^T:| T:)")
extruderreading_exp = re.compile("(^E:| E:)")
def parse_temperature_report(report): def parse_temperature_report(report):
matches = tempreport_exp.findall(report) matches = tempreport_exp.findall(report)
...@@ -1458,7 +1460,7 @@ Printrun. If not, see <http://www.gnu.org/licenses/>.""" ...@@ -1458,7 +1460,7 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
self.userm114 -= 1 self.userm114 -= 1
else: else:
isreport = True isreport = True
if "ok T:" in l or ("T:" in l and "E:" in l): if "ok T:" in l or (tempreading_exp.findall(l) and extruderreading_exp.findall(l)):
self.tempreport = l self.tempreport = l
wx.CallAfter(self.tempdisp.SetLabel, self.tempreport.strip().replace("ok ", "")) wx.CallAfter(self.tempdisp.SetLabel, self.tempreport.strip().replace("ok ", ""))
self.update_tempdisplay() self.update_tempdisplay()
......
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