From be85d07210e65e714a08b89dc37994e6d1dd805e Mon Sep 17 00:00:00 2001 From: Richard Bowman Date: Thu, 23 Apr 2020 11:22:14 +0100 Subject: [PATCH] Attempt to start the stream if it's stopped. --- openflexure_microscope/api/default_extensions/autofocus.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/openflexure_microscope/api/default_extensions/autofocus.py b/openflexure_microscope/api/default_extensions/autofocus.py index d733b81f..54ea3dde 100644 --- a/openflexure_microscope/api/default_extensions/autofocus.py +++ b/openflexure_microscope/api/default_extensions/autofocus.py @@ -50,6 +50,9 @@ class JPEGSharpnessMonitor: def start(self): "Start monitoring sharpness by looking at JPEG size" + if not self.camera.stream_active: + logging.warn("Autofocus sharpness monitor was started but the camera isn't streaming. Attempting to start the stream...") + self.camera.start_stream_recording() self.background_thread = Thread(target=self._measure_jpegs) self.background_thread.start() return self