From aab7b7f797b92da4b7ba6c7e7fcaaa7304226302 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Thu, 23 Feb 2017 17:17:38 +0100 Subject: [PATCH] Timelapse: ignore both z-hop flanks but allow z-hop to next layer Former implementation tested for z-hop rising flank and anything that is falling. That however causes issues with z-hop directly followed by layer change (diff is not z-hop size but negative, image hence not captured). Instead of testing for positive flank == z-hop and any negative flank, we now test for absolute value == z-hop. Solves #1777 --- 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 67c9407f..acf8ec4d 100644 --- a/src/octoprint/timelapse.py +++ b/src/octoprint/timelapse.py @@ -627,10 +627,10 @@ class ZTimelapse(Timelapse): def _on_z_change(self, event, payload): if self._retraction_zhop != 0 and payload["old"] is not None and payload["new"] is not None: - # check if height difference equals z-hop or is negative, if so don't take a picture - diff = round(payload["new"] - payload["old"], 3) + # check if height difference equals z-hop, if so don't take a picture + diff = round(abs(payload["new"] - payload["old"]), 3) zhop = round(self._retraction_zhop, 3) - if diff == zhop or diff <= 0: + if diff == zhop: return self.capture_image()