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
This commit is contained in:
Gina Häußge 2017-02-23 17:17:38 +01:00
parent 162e8c50d3
commit aab7b7f797

View file

@ -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()