Implement hardware locks
This commit is contained in:
parent
a40cb9b9f6
commit
8292ebf7c7
10 changed files with 268 additions and 170 deletions
|
|
@ -19,6 +19,7 @@ except ImportError:
|
|||
from .capture import CaptureObject, capture_from_dict, BASE_CAPTURE_PATH
|
||||
from openflexure_microscope.config import USER_CONFIG_DIR
|
||||
from openflexure_microscope.utilities import entry_by_id
|
||||
from openflexure_microscope.lock import StrictLock
|
||||
|
||||
|
||||
def last_entry(object_list: list):
|
||||
|
|
@ -29,7 +30,6 @@ def last_entry(object_list: list):
|
|||
return None
|
||||
|
||||
|
||||
|
||||
def generate_basename():
|
||||
"""Return a default filename based on the capture datetime"""
|
||||
return datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
|
||||
|
|
@ -87,6 +87,8 @@ class BaseCamera(object):
|
|||
self.thread = None #: Background thread reading frames from camera
|
||||
self.camera = None #: Camera object
|
||||
|
||||
self.lock = StrictLock(timeout=1) #: Strict lock controlling thread access to camera hardware
|
||||
|
||||
self.frame = None #: bytes: Current frame is stored here by background thread
|
||||
self.last_access = 0 #: time: Time of last client access to the camera
|
||||
self.event = CameraEvent()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue