Create lock even when stage is disconnected
This commit is contained in:
parent
73eda19acc
commit
e6ddeaeb3a
1 changed files with 9 additions and 2 deletions
|
|
@ -1,7 +1,10 @@
|
||||||
from openflexure_stage import OpenFlexureStage
|
from openflexure_stage import OpenFlexureStage
|
||||||
|
from serial import SerialException
|
||||||
|
|
||||||
from openflexure_microscope.lock import StrictLock
|
from openflexure_microscope.lock import StrictLock
|
||||||
|
|
||||||
|
import logging
|
||||||
|
|
||||||
# TODO: Implement lock on movement
|
# TODO: Implement lock on movement
|
||||||
class Stage(OpenFlexureStage):
|
class Stage(OpenFlexureStage):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
|
|
@ -10,8 +13,12 @@ class Stage(OpenFlexureStage):
|
||||||
adding an instance of :py:class:`openflexure_microscope.lock.StrictLock` to regulate access.
|
adding an instance of :py:class:`openflexure_microscope.lock.StrictLock` to regulate access.
|
||||||
"""
|
"""
|
||||||
self.lock = StrictLock(timeout=2) #: :py:class:`openflexure_microscope.lock.StrictLock`: Strict lock controlling thread access to camera hardware
|
self.lock = StrictLock(timeout=2) #: :py:class:`openflexure_microscope.lock.StrictLock`: Strict lock controlling thread access to camera hardware
|
||||||
|
|
||||||
OpenFlexureStage.__init__(self, *args, **kwargs)
|
try:
|
||||||
|
OpenFlexureStage.__init__(self, *args, **kwargs)
|
||||||
|
except SerialException as e:
|
||||||
|
logging.error("No stage found. Aborting stage.")
|
||||||
|
logging.warning("Stage lock can be acquired, but any stage methods will fail and raise exceptions.")
|
||||||
|
|
||||||
def _move_rel_nobacklash(self, *args, **kwargs):
|
def _move_rel_nobacklash(self, *args, **kwargs):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue