Initial support for SBv3 and MockStage
This commit is contained in:
parent
068ce9e751
commit
ff534e6a51
10 changed files with 966 additions and 29 deletions
|
|
@ -13,7 +13,8 @@ from openflexure_microscope.api.utilities import list_routes
|
|||
|
||||
from openflexure_microscope import Microscope
|
||||
from openflexure_microscope.camera.pi import StreamingCamera
|
||||
from openflexure_microscope.stage.openflexure import Stage
|
||||
from openflexure_microscope.stage.sanga import SangaStage
|
||||
from openflexure_microscope.stage.mock import MockStage
|
||||
|
||||
import atexit
|
||||
import logging
|
||||
|
|
@ -71,11 +72,12 @@ def attach_microscope():
|
|||
|
||||
logging.debug("Creating stage object...")
|
||||
try:
|
||||
api_stage = Stage("/dev/ttyUSB0")
|
||||
except SerialException as e:
|
||||
api_camera.close()
|
||||
raise e
|
||||
else:
|
||||
api_stage = SangaStage()
|
||||
except (SerialException, OSError) as e:
|
||||
logging.error(e)
|
||||
logging.warning("No valid stage hardware found. Falling back to mock stage!")
|
||||
api_stage = MockStage()
|
||||
finally:
|
||||
logging.debug("Attaching devices to microscope...")
|
||||
api_microscope.attach(
|
||||
api_camera,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
from flask import jsonify
|
||||
from flask import jsonify, escape
|
||||
from werkzeug.exceptions import default_exceptions
|
||||
from werkzeug.exceptions import HTTPException
|
||||
|
||||
|
|
@ -21,7 +21,7 @@ class JSONExceptionHandler(object):
|
|||
|
||||
response = {
|
||||
'status_code': status_code,
|
||||
'message': message
|
||||
'message': escape(message)
|
||||
}
|
||||
return jsonify(response), status_code
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue