Skip to content

Commit

Permalink
Fix issue where _simulateTemps may never reach target temp but instea…
Browse files Browse the repository at this point in the history
…d be stuck within 0.5C(delta)
  • Loading branch information
kantlivelong committed May 5, 2020
1 parent 5596daf commit 3bc4ae1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/octoprint/plugins/virtual_printer/virtual.py
Expand Up @@ -1422,9 +1422,13 @@ def _simulateTemps(self, delta=0.5):
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
Expand Down

0 comments on commit 3bc4ae1

Please sign in to comment.