From a89d03b794e51fabaf89a86501e08181dbddd344 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= <6774676+eumiro@users.noreply.github.com> Date: Fri, 22 Jan 2021 13:04:52 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=AA=20Compare=20the=20difference,=20no?= =?UTF-8?q?t=20rounded=20values?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit round(1.0004, 3) != round(1.0006, 3) but still abs(1.0004 - 1.0006) < 0.001 --- src/octoprint/timelapse.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/octoprint/timelapse.py b/src/octoprint/timelapse.py index 930af3921..637a78859 100644 --- a/src/octoprint/timelapse.py +++ b/src/octoprint/timelapse.py @@ -843,9 +843,9 @@ class ZTimelapse(Timelapse): and payload["old"] is not None and payload["new"] is not None ): - diff = round(abs(payload["new"] - payload["old"]), 3) - zhop = round(self._retraction_zhop, 3) - if diff == zhop: + diff = abs(payload["new"] - payload["old"]) + zhop = self._retraction_zhop + if abs(diff - zhop) < 0.001: return # check if last picture has been less than min_delay ago, if so don't take a picture (anti vase mode...)