fix setting timelapse interval

This commit is contained in:
Alexander Minges 2019-02-01 14:50:08 +01:00
parent 416f6ec2a6
commit fb7f77b3a8
2 changed files with 8 additions and 3 deletions

View file

@ -60,9 +60,10 @@ class CameraWorker(object):
with open(self.fifo, 'w') as fh:
fh.write(cmd)
def start_timelapse(self, interval = 0):
def start_timelapse(self, interval=300):
if self.status == CameraStatus.IDLE:
self.send_cmd('tl {}'.format(str(interval)))
self.send_cmd('tv {}'.format(str(interval)))
self.send_cmd('tl 1')
self.status = CameraStatus.TIMELAPSE
else:
raise CameraActionError('Camera not idle!')

View file

@ -46,8 +46,12 @@ def start_stop_timelapse():
# camera.set_timelapse_interval(timelapse_interval)
if camera.status == CameraStatus.IDLE:
camera.start_timelapse(1200)
btn_text = "Stop"
btn_class = 'btn-danger'
camera.start_timelapse()
elif camera.status == CameraStatus.TIMELAPSE:
btn_text = "Start"
btn_class = 'btn-primary'
camera.stop_timelapse()
return jsonify(btn_text=btn_text, btn_class=btn_class)