Fix minute comparison for dumb estimate fallback

Probably solves the core reason that caused #1428 to be
reported in the first place, totally inaccurate early linear
approximations (when nothing better is available) making
it to the user.

It should now display "Calcuting..." until the approximation
stabilizes OR the configured max percentage or max time without
an estimate are reached.
This commit is contained in:
Gina Häußge 2016-08-15 12:08:25 +02:00
parent fe97a8d6bd
commit 11bdc176a0

View file

@ -761,15 +761,16 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
printTimeLeft = dumbTotalPrintTime - cleanedPrintTime
printTimeLeftOrigin = "linear"
elif progress > self._timeEstimationForceDumbFromPercent or \
cleanedPrintTime * 60 >= self._timeEstimationForceDumbAfterMin:
# more than x% or y min printed and still no real estimate, ok, we'll use the dumb variant :/
printTimeLeft = dumbTotalPrintTime - cleanedPrintTime
else:
printTimeLeftOrigin = "linear"
if progress > self._timeEstimationForceDumbFromPercent or \
cleanedPrintTime >= self._timeEstimationForceDumbAfterMin * 60:
# more than x% or y min printed and still no real estimate, ok, we'll use the dumb variant :/
printTimeLeft = dumbTotalPrintTime - cleanedPrintTime
if printTimeLeft < 0:
if printTimeLeft is not None and printTimeLeft < 0:
# shouldn't actually happen, but let's make sure
return None, None
printTimeLeft = None
return printTimeLeft, printTimeLeftOrigin