Skip to content

Commit

Permalink
Fixed retractionZHop setting for Z timelapses
Browse files Browse the repository at this point in the history
Solves issue reported in #1148 for 1.3.0rc1
  • Loading branch information
foosel committed Nov 9, 2016
1 parent b74a5db commit 153ebc3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/octoprint/server/api/timelapse.py
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/octoprint/timelapse.py
Expand Up @@ -617,7 +617,7 @@ def process_post_roll(self):
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)
Expand Down

0 comments on commit 153ebc3

Please sign in to comment.