Commit 4ab81175 authored by kliment's avatar kliment

Add skeinforge settings support. Make printing non-modal. Experimental pausing.

parent 7fd5c664
......@@ -19,6 +19,7 @@ class printcore():
self.queueindex=0
self.lineno=0
self.resendfrom=-1
self.paused=False
self.sentlines={}
self.log=[]
self.sent=[]
......@@ -62,7 +63,7 @@ class printcore():
"""This function acts on messages from the firmware
"""
self.clear=True
time.sleep(1)
time.sleep(0.5)
self.send_now("M105")
while(True):
if(not self.printer or not self.printer.isOpen):
......@@ -124,12 +125,14 @@ class printcore():
def pause(self):
"""Pauses the print, saving the current position.
"""
self.paused=True
self.printing=False
time.sleep(1)
def resume(self):
"""Resumes a paused print.
"""
self.paused=False
self.printing=True
Thread(target=self._print).start()
......@@ -194,6 +197,8 @@ class printcore():
self.queueindex+=1
else:
self.printing=False
self.clear=True
if(not self.paused):
self.queueindex=0
self.lineno=0
self._send("M110",-1, True)
......
......@@ -291,17 +291,39 @@ class pronsole(cmd.Cmd):
print "Not connected to printer."
return
print("Printing "+self.filename)
print("Press Ctrl-C to interrupt print (you can resume it with the resume command)")
print("You can monitor the print with the monitor command.")
self.p.startprint(self.f)
#self.p.pause()
#self.paused=True
#self.do_resume(None)
def do_pause(self,l):
if self.sdprinting:
self.p.send_now("M25")
else:
if(not self.p.printing):
print "Not printing, cannot pause."
return
self.p.pause()
self.p.connect()# This seems to work, but is not a good solution.
self.paused=True
self.do_resume(None)
#self.do_resume(None)
def help_pause(self,l):
print "Pauses a running print"
def do_resume(self,l):
if not self.paused:
print "Not paused, unable to resume. Start a print first."
return
self.paused=False
if self.sdprinting:
self.p.send_now("M24")
return
else:
self.p.resume()
return
try:
self.p.resume()
#print self.p.printing
......@@ -652,6 +674,9 @@ class pronsole(cmd.Cmd):
if(self.sdprinting):
self.p.send_now("M27")
print (self.tempreadings.replace("\r","").replace("T","Hotend").replace("B","Bed").replace("\n","").replace("ok ",""))
if(self.p.printing):
print "Print progress: ", 100*float(self.p.queueindex)/len(self.p.mainqueue), "%"
if(self.sdprinting):
print "SD print progress: ", self.percentdone,"%"
time.sleep(interval)
......@@ -669,6 +694,10 @@ class pronsole(cmd.Cmd):
if len(l)==0:
print "No file name given."
return
settings=0
if(l[0]=="set"):
settings=1
else:
print "Skeining file:"+l[0]
if not(os.path.exists(l[0])):
print "File not found!"
......@@ -681,6 +710,10 @@ class pronsole(cmd.Cmd):
pass
try:
from skeinforge.skeinforge_application.skeinforge_utilities import skeinforge_craft
from skeinforge.skeinforge_application import skeinforge
if(settings):
skeinforge.main()
else:
if(len(l)>1):
if(l[1] == "view"):
skeinforge_craft.writeOutput(l[0],True)
......@@ -707,6 +740,7 @@ class pronsole(cmd.Cmd):
print "Creates a gcode file from an stl model using skeinforge (with tab-completion)"
print "skein filename.stl - create gcode file"
print "skein filename.stl view - create gcode file and view using skeiniso"
print "skein set - adjust skeinforge settings"
interp=pronsole()
......
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