Fixed retractionZHop setting for Z timelapses

Solves issue reported in #1148 for 1.3.0rc1
This commit is contained in:
Gina Häußge 2016-11-09 16:30:08 +01:00
parent b74a5db4d8
commit 153ebc3692
2 changed files with 4 additions and 4 deletions

View file

@ -204,15 +204,15 @@ def setTimelapseConfig():
else:
return make_response("Invalid value for interval: %d" % interval)
if "retractionZHop" in request.values:
if "retractionZHop" in data:
config["options"] = {
"retractionZHop": 0
}
try:
retractionZHop = float(request.values["retractionZHop"])
retractionZHop = float(data["retractionZHop"])
except ValueError:
return make_response("Invalid value for retraction Z-Hop: %r" % request.values["retractionZHop"])
return make_response("Invalid value for retraction Z-Hop: %r" % data["retractionZHop"])
else:
if retractionZHop > 0:
config["options"]["retractionZHop"] = retractionZHop

View file

@ -617,7 +617,7 @@ class ZTimelapse(Timelapse):
Timelapse.process_post_roll(self)
def _on_z_change(self, event, payload):
if self._retraction_zhop != 0:
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)
zhop = round(self._retraction_zhop, 3)