Attempt at adding a recover print function
parent
e046dc8016
commit
cda29232e6
|
@ -185,7 +185,7 @@ class printcore():
|
||||||
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, startindex = 0):
|
||||||
"""Start a print, data is an array of gcode commands.
|
"""Start a print, data is an array of gcode commands.
|
||||||
returns True on success, False if already printing.
|
returns True on success, False if already printing.
|
||||||
The print queue will be replaced with the contents of the data array, the next line will be set to 0 and the firmware notified.
|
The print queue will be replaced with the contents of the data array, the next line will be set to 0 and the firmware notified.
|
||||||
|
@ -196,7 +196,7 @@ class printcore():
|
||||||
self.printing = True
|
self.printing = True
|
||||||
self.mainqueue = [] + data
|
self.mainqueue = [] + data
|
||||||
self.lineno = 0
|
self.lineno = 0
|
||||||
self.queueindex = 0
|
self.queueindex = startindex
|
||||||
self.resendfrom = -1
|
self.resendfrom = -1
|
||||||
self._send("M110", -1, True)
|
self._send("M110", -1, True)
|
||||||
if len(data) == 0:
|
if len(data) == 0:
|
||||||
|
|
|
@ -1697,8 +1697,27 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
|
||||||
self.status_thread = threading.Thread(target = self.statuschecker)
|
self.status_thread = threading.Thread(target = self.statuschecker)
|
||||||
self.status_thread.start()
|
self.status_thread.start()
|
||||||
|
|
||||||
|
def recover(self, event):
|
||||||
|
self.extra_print_time = 0
|
||||||
|
if not self.p.online:
|
||||||
|
wx.CallAfter(self.status.SetStatusText,_("Not connected to printer."))
|
||||||
|
return
|
||||||
|
# Reset Z
|
||||||
|
self.p.send_now("G92 Z" + self.predisconnect_layer)
|
||||||
|
# Home X and Y
|
||||||
|
self.p.send_now("G28 X Y")
|
||||||
|
self.on_startprint()
|
||||||
|
self.p.startprint(self.predisconnect_mainqueue)
|
||||||
|
|
||||||
|
def store_predisconnect_state(self):
|
||||||
|
self.predisconnect_mainqueue = self.p.mainqueue
|
||||||
|
self.predisconnect_queueindex = self.p.queueindex
|
||||||
|
self.predisconnect_layer = self.curlayer
|
||||||
|
|
||||||
def disconnect(self,event):
|
def disconnect(self,event):
|
||||||
print _("Disconnected.")
|
print _("Disconnected.")
|
||||||
|
if self.p.printing or self.p.paused or self.paused:
|
||||||
|
self.store_predisconnect_state()
|
||||||
self.p.disconnect()
|
self.p.disconnect()
|
||||||
self.statuscheck = False
|
self.statuscheck = False
|
||||||
self.status_thread.join()
|
self.status_thread.join()
|
||||||
|
|
Loading…
Reference in New Issue