Set a minimum delay of 1s between snapshots

Followup to #2067
This commit is contained in:
Gina Häußge 2017-10-26 16:38:40 +02:00
parent 09509ca61d
commit bedcbb80be
3 changed files with 8 additions and 8 deletions

View file

@ -241,7 +241,7 @@ def setTimelapseConfig():
except ValueError:
return make_response("Invalid value for minimum delay: %r" % data["minDelay"], 400)
else:
if minDelay >= 0:
if minDelay > 0:
config["options"]["minDelay"] = minDelay
else:
return make_response("Invalid value for minimum delay: %f" % minDelay, 400)

View file

@ -22,7 +22,7 @@
<label class="control-label" for="webcam_timelapse_minDelay">{{ _('Minimum interval') }}</label>
<div class="controls">
<div class="input-append">
<input type="number" class="input-mini" id="webcam_timelapse_minDelay" data-bind="value: timelapseMinDelay, valueUpdate: 'afterkeydown', enable: !isPrinting() && loginState.isUser()">
<input type="number" min="1" class="input-mini" id="webcam_timelapse_minDelay" data-bind="value: timelapseMinDelay, valueUpdate: 'afterkeydown', enable: !isPrinting() && loginState.isUser()">
<span class="add-on">{{ _('sec') }}</span>
</div>
<span class="help-block">{{ _('OctoPrint will rate limit snapshots to this minimum interval. This it to prevent against performance issues with vase mode/continous z prints.') }}</span>
@ -33,7 +33,7 @@
<label class="control-label" for="webcam_timelapse_interval">{{ _('Snapshot interval') }}</label>
<div class="controls">
<div class="input-append">
<input type="number" class="input-mini" id="webcam_timelapse_interval" data-bind="value: timelapseTimedInterval, valueUpdate: 'afterkeydown', enable: !isPrinting() && loginState.isUser()">
<input type="number" min="1" class="input-mini" id="webcam_timelapse_interval" data-bind="value: timelapseTimedInterval, valueUpdate: 'afterkeydown', enable: !isPrinting() && loginState.isUser()">
<span class="add-on">{{ _('sec') }}</span>
</div>
</div>
@ -43,7 +43,7 @@
<label class="control-label" for="webcam_timelapse_fps">{{ _('Timelapse frame rate') }}</label>
<div class="controls">
<div class="input-append">
<input type="number" class="input-mini" id="webcam_timelapse_fps" data-bind="value: timelapseFps, valueUpdate: 'afterkeydown', enable: !isPrinting() && loginState.isUser() && timelapseTypeSelected()">
<input type="number" min="1" class="input-mini" id="webcam_timelapse_fps" data-bind="value: timelapseFps, valueUpdate: 'afterkeydown', enable: !isPrinting() && loginState.isUser() && timelapseTypeSelected()">
<span class="add-on">{{ _('fps') }}</span>
</div>
</div>
@ -53,7 +53,7 @@
<label class="control-label" for="webcam_timelapse_postRoll">{{ _('Timelapse post roll') }}</label>
<div class="controls">
<div class="input-append">
<input type="number" class="input-mini" id="webcam_timelapse_postRoll" data-bind="value: timelapsePostRoll, valueUpdate: 'afterkeydown', enable: !isPrinting() && loginState.isUser() && timelapseTypeSelected()">
<input type="number" min="0" class="input-mini" id="webcam_timelapse_postRoll" data-bind="value: timelapsePostRoll, valueUpdate: 'afterkeydown', enable: !isPrinting() && loginState.isUser() && timelapseTypeSelected()">
<span class="add-on">{{ _('sec') }}</span>
</div>
<span class="help-block">{{ _('OctoPrint will take additional pictures to add this many seconds to the end of your rendered timelapse.') }}</span>
@ -73,7 +73,7 @@
<label class="control-label" for="webcam_timelapse_retractionZHop">{{ _('Retraction Z-Hop') }}</label>
<div class="controls">
<div class="input-append">
<input type="number" class="input-mini" id="webcam_timelapse_retractionZHop" data-bind="value: timelapseRetractionZHop, valueUpdate: 'afterkeydown', enable: !isPrinting() && loginState.isUser()">
<input type="number" min="0.0" class="input-mini" id="webcam_timelapse_retractionZHop" data-bind="value: timelapseRetractionZHop, valueUpdate: 'afterkeydown', enable: !isPrinting() && loginState.isUser()">
<span class="add-on">{{ _('mm') }}</span>
</div>
<span class="help-block">{{ _('Enter the retraction z-hop used in the firmware or the gcode file to trigger snapshots for the timelapse only if a real layer change happens. For this to work properly your retraction z-hop has to be different from your layerheight!') }}</span>

View file

@ -301,11 +301,11 @@ def configure_timelapse(config=None, persist=False):
elif "zchange" == type:
retractionZHop = 0
if "options" in config and "retractionZHop" in config["options"] and config["options"]["retractionZHop"] > 0:
if "options" in config and "retractionZHop" in config["options"] and config["options"]["retractionZHop"] >= 0:
retractionZHop = config["options"]["retractionZHop"]
minDelay = 5
if "options" in config and "minDelay" in config["options"] and config["options"]["minDelay"] >= 0:
if "options" in config and "minDelay" in config["options"] and config["options"]["minDelay"] > 0:
minDelay = config["options"]["minDelay"]
current = ZTimelapse(post_roll=postRoll, retraction_zhop=retractionZHop, min_delay=minDelay, fps=fps)