Commit f367f0e5 authored by Guillaume Seguin's avatar Guillaume Seguin

Cleanup

parent 5a8e3474
...@@ -140,7 +140,7 @@ class printcore(): ...@@ -140,7 +140,7 @@ class printcore():
if self.recvcb: if self.recvcb:
try: self.recvcb(line) try: self.recvcb(line)
except: pass except: pass
if self.loud: print "RECV: ",line.rstrip() if self.loud: print "RECV: ", line.rstrip()
if line.startswith('DEBUG_'): if line.startswith('DEBUG_'):
continue continue
if line.startswith(tuple(self.greetings)) or line.startswith('ok'): if line.startswith(tuple(self.greetings)) or line.startswith('ok'):
...@@ -152,7 +152,6 @@ class printcore(): ...@@ -152,7 +152,6 @@ class printcore():
self.online = True self.online = True
if line.startswith('ok'): if line.startswith('ok'):
#self.resendfrom=-1 #self.resendfrom=-1
#put temp handling here
if "T:" in line and self.tempcb is not None: if "T:" in line and self.tempcb is not None:
#callback for temp, status, whatever #callback for temp, status, whatever
try: self.tempcb(line) try: self.tempcb(line)
...@@ -164,7 +163,7 @@ class printcore(): ...@@ -164,7 +163,7 @@ class printcore():
except: pass except: pass
if line.lower().startswith("resend") or line.startswith("rs"): if line.lower().startswith("resend") or line.startswith("rs"):
try: try:
toresend = int(line.replace("N:"," ").replace("N"," ").replace(":"," ").split()[-1]) toresend = int(line.replace("N:", " ").replace("N", " ").replace(":", " ").split()[-1])
except: except:
if line.startswith("rs"): if line.startswith("rs"):
toresend = int(line.split()[1]) toresend = int(line.split()[1])
...@@ -172,8 +171,8 @@ class printcore(): ...@@ -172,8 +171,8 @@ class printcore():
self.clear = True self.clear = True
self.clear = True self.clear = True
def _checksum(self,command): def _checksum(self, command):
return reduce(lambda x,y:x^y, map(ord,command)) return reduce(lambda x,y:x^y, map(ord, command))
def startprint(self,data): def startprint(self,data):
"""Start a print, data is an array of gcode commands. """Start a print, data is an array of gcode commands.
...@@ -183,15 +182,15 @@ class printcore(): ...@@ -183,15 +182,15 @@ class printcore():
""" """
if self.printing or not self.online or not self.printer: if self.printing or not self.online or not self.printer:
return False return False
self.printing=True self.printing = True
self.mainqueue=[]+data self.mainqueue = [] + data
self.lineno=0 self.lineno = 0
self.queueindex=0 self.queueindex = 0
self.resendfrom=-1 self.resendfrom = -1
self._send("M110",-1, True) self._send("M110", -1, True)
if len(data)==0: if len(data) == 0:
return True return True
self.clear=False self.clear = False
self.print_thread = Thread(target = self._print) self.print_thread = Thread(target = self._print)
self.print_thread.start() self.print_thread.start()
return True return True
......
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