Made progress calculation more resilient, do not hit printer with commands like a freight train during warm up
parent
6ce7fed96d
commit
fa584d59c5
|
@ -416,7 +416,10 @@ class Printer():
|
||||||
newProgress = 0.0
|
newProgress = 0.0
|
||||||
else:
|
else:
|
||||||
newLine = self._comm.getPrintPos()
|
newLine = self._comm.getPrintPos()
|
||||||
newProgress = float(newLine) / float(len(self._gcodeList))
|
if self._gcodeList is not None:
|
||||||
|
newProgress = float(newLine) / float(len(self._gcodeList))
|
||||||
|
else:
|
||||||
|
newProgress = 0.0
|
||||||
|
|
||||||
self._setProgressData(newProgress, newLine, self._comm.getPrintTime(), self._comm.getPrintTimeRemainingEstimate())
|
self._setProgressData(newProgress, newLine, self._comm.getPrintTime(), self._comm.getPrintTimeRemainingEstimate())
|
||||||
|
|
||||||
|
|
|
@ -637,7 +637,11 @@ class MachineCom(object):
|
||||||
self._sendCommand("M105")
|
self._sendCommand("M105")
|
||||||
tempRequestTimeout = time.time() + 5
|
tempRequestTimeout = time.time() + 5
|
||||||
elif self._state == self.STATE_PRINTING:
|
elif self._state == self.STATE_PRINTING:
|
||||||
# Even when printing request the temperture every 5 seconds.
|
if line == '' and time.time() > timeout:
|
||||||
|
self._log("Communication timeout during printing, forcing a line")
|
||||||
|
line = 'ok'
|
||||||
|
|
||||||
|
# Even when printing request the temperature every 5 seconds.
|
||||||
if time.time() > tempRequestTimeout:
|
if time.time() > tempRequestTimeout:
|
||||||
self._commandQueue.put("M105")
|
self._commandQueue.put("M105")
|
||||||
tempRequestTimeout = time.time() + 5
|
tempRequestTimeout = time.time() + 5
|
||||||
|
@ -647,13 +651,9 @@ class MachineCom(object):
|
||||||
self._commandQueue.put("M27")
|
self._commandQueue.put("M27")
|
||||||
sdStatusRequestTimeout = time.time() + 1
|
sdStatusRequestTimeout = time.time() + 1
|
||||||
|
|
||||||
if not self._commandQueue.empty():
|
if 'ok' in line and not self._commandQueue.empty():
|
||||||
self._sendCommand(self._commandQueue.get())
|
self._sendCommand(self._commandQueue.get())
|
||||||
else:
|
else:
|
||||||
if line == '' and time.time() > timeout:
|
|
||||||
self._log("Communication timeout during printing, forcing a line")
|
|
||||||
line = 'ok'
|
|
||||||
|
|
||||||
if 'ok' in line:
|
if 'ok' in line:
|
||||||
timeout = time.time() + 5
|
timeout = time.time() + 5
|
||||||
if not self._commandQueue.empty():
|
if not self._commandQueue.empty():
|
||||||
|
|
Loading…
Reference in New Issue