Commit 244350fe authored by Kliment Yanev's avatar Kliment Yanev

Merge branch 'master' into experimental

parents 97af7725 f7e14bf7
#!/usr/bin/env python
from serial import Serial
from threading import Thread
from select import error as SelectError
import time
import sys
......@@ -76,7 +77,15 @@ class printcore():
while(True):
if(not self.printer or not self.printer.isOpen):
break
line=self.printer.readline()
try:
line=self.printer.readline()
except SelectError, e:
if 'Bad file descriptor' in e.args[1]:
print "Can't read from printer (disconnected?)."
break
else:
raise
if(len(line)>1):
self.log+=[line]
if self.recvcb is not None:
......
......@@ -94,7 +94,7 @@ def estimate_duration(g):
feedrate = 0
X_last_position = 0
Y_last_position = 0
for i in g:
for i.split(";")[0] in g:
if "G1" in i and ("X" in i or "Y" in i or "F" in i or "E" in i):
parts = i.split(" ")
X = get_coordinate_value("X", parts[1:])
......@@ -812,14 +812,14 @@ class pronsole(cmd.Cmd):
print "! os.listdir('.')"
def default(self,l):
if(l[0]=='M' or l[0]=="G"):
if(l[0]=='M' or l[0]=="G" or l[0]=='T'):
if(self.p and self.p.online):
print "SENDING:"+l
self.p.send_now(l)
else:
print "Printer is not online."
return
if(l[0]=='m' or l[0]=="g"):
if(l[0]=='m' or l[0]=="g" or l[0]=='t'):
if(self.p and self.p.online):
print "SENDING:"+l.upper()
self.p.send_now(l.upper())
......
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