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
|
||||
else:
|
||||
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())
|
||||
|
||||
|
|
|
@ -637,7 +637,11 @@ class MachineCom(object):
|
|||
self._sendCommand("M105")
|
||||
tempRequestTimeout = time.time() + 5
|
||||
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:
|
||||
self._commandQueue.put("M105")
|
||||
tempRequestTimeout = time.time() + 5
|
||||
|
@ -647,13 +651,9 @@ class MachineCom(object):
|
|||
self._commandQueue.put("M27")
|
||||
sdStatusRequestTimeout = time.time() + 1
|
||||
|
||||
if not self._commandQueue.empty():
|
||||
if 'ok' in line and not self._commandQueue.empty():
|
||||
self._sendCommand(self._commandQueue.get())
|
||||
else:
|
||||
if line == '' and time.time() > timeout:
|
||||
self._log("Communication timeout during printing, forcing a line")
|
||||
line = 'ok'
|
||||
|
||||
if 'ok' in line:
|
||||
timeout = time.time() + 5
|
||||
if not self._commandQueue.empty():
|
||||
|
|
Loading…
Reference in New Issue