🔪 Compare the difference, not rounded values

round(1.0004, 3) != round(1.0006, 3) but still abs(1.0004 - 1.0006) < 0.001
This commit is contained in:
Miroslav Šedivý committed 2021-01-22 13:40:44 +01:00
1 parent 7810a622a9
commit a89d03b794
1 file changed
+3 -3
+3 -3
View File
@@ -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...)