From 9c069ef372dd20665e3de4b4e41ee084687abfe9 Mon Sep 17 00:00:00 2001 From: Richard Bowman Date: Thu, 4 Feb 2021 20:31:20 +0000 Subject: [PATCH] Allow MissingStage to be explicitly selected You can now set the stage type to "MissingStage" in microscope_configuration.json to stop the server looking for the stage. A warning is logged to make it obvious what's happening. --- openflexure_microscope/microscope.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/openflexure_microscope/microscope.py b/openflexure_microscope/microscope.py index f4404af9..da546b60 100644 --- a/openflexure_microscope/microscope.py +++ b/openflexure_microscope/microscope.py @@ -169,6 +169,14 @@ class Microscope: except Exception as e: # pylint: disable=W0703 logging.error(e) logging.warning("No compatible Sangaboard hardware found.") + elif stage_type in ("MissingStage",): + logging.warning( + "The stage is set to MissingStage in " + "configuration, which disables any physical stage." + ) + self.stage = MissingStage() + configuration["stage"]["type"] = "MissingStage" + self.configuration_file.save(configuration) else: logging.warning("The stage type is incorrectly defined.")