Fix issue where _simulateTemps may never reach target temp but instead be stuck within 0.5C(delta)

This commit is contained in:
Shawn Bruce committed 2020-05-05 12:24:05 -04:00
1 parent 5596daf346
commit 3bc4ae14cc
1 file changed
+6 -2
@@ -1422,9 +1422,13 @@ class VirtualPrinter(object):
self.lastTempAt = monotonic_time()
def simulate(actual, target, ambient):
if target > 0 and abs(actual - target) > delta:
if target > 0:
goal = target
factor = 10
remaining = abs(actual - target)
if remaining > delta:
factor = 10
elif remaining < delta:
factor = remaining
elif not target and abs(actual - ambient) > delta:
goal = ambient
factor = 2