From fb7f77b3a841da333862fce9d5da23e7e6af5263 Mon Sep 17 00:00:00 2001 From: Athemis Date: Fri, 1 Feb 2019 14:50:08 +0100 Subject: [PATCH] fix setting timelapse interval --- phytopi/camera/camera.py | 5 +++-- phytopi/routes.py | 6 +++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/phytopi/camera/camera.py b/phytopi/camera/camera.py index 24aef09..d9bfb89 100644 --- a/phytopi/camera/camera.py +++ b/phytopi/camera/camera.py @@ -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!') diff --git a/phytopi/routes.py b/phytopi/routes.py index d2818fc..dbb4a3d 100644 --- a/phytopi/routes.py +++ b/phytopi/routes.py @@ -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)