Timelapse: Remove post roll capturing from timed timelapses

As discussed in #2317 this option was confusing and frustrating too many
people. Instead of an actual capture we'll now just do the same as for
z-based timelapses and use the last image repeatedly.

No, using the live webstream and capturing real time image is NOT an
option and not going to happen here, see the discussion in #2317 on this
as well.
This commit is contained in:
Gina Häußge committed 2018-03-07 14:56:10 +01:00
1 parent f1401d3f1e
commit 1f9c9bed42
4 files changed
+7 -70

No files matched your search

+1 -10
View File
@@ -43,8 +43,7 @@ def _config_for_timelapse(timelapse):
return dict(type="timed",
postRoll=timelapse.post_roll,
fps=timelapse.fps,
interval=timelapse.interval,
capturePostRoll=timelapse.capture_post_roll)
interval=timelapse.interval)
else:
return dict(type="off")
@@ -216,14 +215,6 @@ def setTimelapseConfig():
else:
return make_response("Invalid value for interval: %d" % interval, 400)
if "capturePostRoll" in data:
try:
capturePostRoll = bool(data["capturePostRoll"])
except ValueError:
return make_response("Invalid value for capturePostRoll: %r" % data["capturePostRoll"], 400)
else:
config["options"]["capturePostRoll"] = capturePostRoll
if "retractionZHop" in data:
try:
retractionZHop = float(data["retractionZHop"])
@@ -11,7 +11,6 @@ $(function() {
self.defaultInterval = 10;
self.defaultRetractionZHop = 0;
self.defaultMinDelay = 5.0;
self.defaultCapturePostRoll = true;
self.timelapseType = ko.observable(undefined);
self.timelapseTimedInterval = ko.observable(self.defaultInterval);
@@ -19,7 +18,6 @@ $(function() {
self.timelapseFps = ko.observable(self.defaultFps);
self.timelapseRetractionZHop = ko.observable(self.defaultRetractionZHop);
self.timelapseMinDelay = ko.observable(self.defaultMinDelay);
self.timelapseCapturePostRoll = ko.observable(self.defaultCapturePostRoll);
self.serverConfig = ko.observable();
@@ -76,9 +74,6 @@ $(function() {
self.timelapseMinDelay.subscribe(function() {
self.isDirty(true);
});
self.timelapseCapturePostRoll.subscribe(function() {
self.isDirty(true);
});
self.persist.subscribe(function() {
self.isDirty(true);
});
@@ -176,12 +171,6 @@ $(function() {
self.timelapseTimedInterval(self.defaultInterval);
}
if (config.type === "timed" && config.capturePostRoll !== undefined){
self.timelapseCapturePostRoll(config.capturePostRoll);
} else {
self.timelapseCapturePostRoll(self.defaultCapturePostRoll);
}
if (config.type === "zchange" && config.retractionZHop !== undefined && config.retractionZHop > 0) {
self.timelapseRetractionZHop(config.retractionZHop);
} else {
@@ -386,7 +375,6 @@ $(function() {
if (self.timelapseType() === "timed") {
payload["interval"] = self.timelapseTimedInterval();
payload["capturePostRoll"] = self.timelapseCapturePostRoll();
}
if (self.timelapseType() === "zchange") {
+1 -10
View File
@@ -56,16 +56,7 @@
<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>
</div>
</div>
<div class="control-group" data-bind="visible: timelapseType() == 'timed'">
<div class="controls">
<label class="checkbox">
<input type="checkbox" data-bind="checked: timelapseCapturePostRoll, valueUpdate: 'afterkeydown', enable: !isPrinting() && loginState.isUser()"> {{ _('Capture post roll images') }}
<span class="help-block">{{ _('If this is unchecked, OctoPrint will simply repeat the last frame for the post roll instead of continuing to capture new frames.') }}</span>
</label>
<span class="help-block">{{ _('OctoPrint will use the final picture to add this many seconds to the end of your rendered timelapse.') }}</span>
</div>
</div>
+5 -38
View File
@@ -333,11 +333,7 @@ def configure_timelapse(config=None, persist=False):
if "options" in config and "interval" in config["options"] and config["options"]["interval"] > 0:
interval = config["options"]["interval"]
capture_post_roll = True
if "options" in config and "capturePostRoll" in config["options"] and isinstance(config["options"]["capturePostRoll"], bool):
capture_post_roll = config["options"]["capturePostRoll"]
current = TimedTimelapse(post_roll=postRoll, interval=interval, fps=fps, capture_post_roll=capture_post_roll)
current = TimedTimelapse(post_roll=postRoll, interval=interval, fps=fps)
notify_callbacks(current)
@@ -685,13 +681,11 @@ class ZTimelapse(Timelapse):
class TimedTimelapse(Timelapse):
def __init__(self, interval=1, capture_post_roll=True, post_roll=0, fps=25):
def __init__(self, interval=1, post_roll=0, fps=25):
Timelapse.__init__(self, post_roll=post_roll, fps=fps)
self._interval = interval
if self._interval < 1:
self._interval = 1 # force minimum interval of 1s
self._capture_post_roll = capture_post_roll
self._postroll_captures = 0
self._timer = None
self._logger.debug("TimedTimelapse initialized")
@@ -699,16 +693,11 @@ class TimedTimelapse(Timelapse):
def interval(self):
return self._interval
@property
def capture_post_roll(self):
return self._capture_post_roll
def config_data(self):
return {
"type": "timed",
"options": {
"interval": self._interval,
"capture_post_roll": self._capture_post_roll
"interval": self._interval
}
}
@@ -724,40 +713,18 @@ class TimedTimelapse(Timelapse):
on_finish=self._on_timer_finished)
self._timer.start()
def on_print_done(self, event, payload):
if self._capture_post_roll:
self._postroll_captures = self._post_roll * self._fps
else:
self._postroll_captures = 0
Timelapse.on_print_done(self, event, payload)
def calculate_post_roll(self):
if self._capture_post_roll:
return self._post_roll * self._fps * self._interval
else:
return Timelapse.calculate_post_roll(self)
def process_post_roll(self):
if self._capture_post_roll:
return
# we only use the final image as post roll if we
# are not supposed to capture it
# we only use the final image as post roll
self._copying_postroll()
self.post_roll_finished()
def _timer_active(self):
return self._in_timelapse or self._postroll_captures > 0
return self._in_timelapse
def _timer_task(self):
self.capture_image()
if self._postroll_captures > 0:
self._postroll_captures -= 1
def _on_timer_finished(self):
if self._capture_post_roll:
self.post_roll_finished()
# timer is done, delete it
self._timer = None