Enable stage coordinate zeroing

This commit is contained in:
Joel Collins 2019-11-29 14:09:23 +00:00
parent 2f4959885c
commit 3db99fee2f
6 changed files with 43 additions and 1 deletions

View file

@ -37,6 +37,11 @@ _actions = {
"view_class": stage.MoveStageAPI,
"conditions": True,
},
"zeroStage": {
"rule": "/stage/zero/",
"view_class": stage.ZeroStageAPI,
"conditions": True,
},
"shutdown": {
"rule": "/system/shutdown/",
"view_class": system.ShutdownAPI,

View file

@ -56,3 +56,22 @@ class MoveStageAPI(MicroscopeView):
logging.warning("Unable to move. No stage found.")
return jsonify(self.microscope.status["stage"]["position"])
class ZeroStageAPI(MicroscopeView):
"""
Zero stage coordinates
"""
def post(self):
"""
Set the current position to zero
.. :quickref: Actions; Zero stage
:reqheader Accept: application/json
"""
self.microscope.stage.zero_position()
return jsonify(self.microscope.status["stage"])