Added locking to recalibrate functions
When testing the UI I noticed that the different recalibrate routines don't use locks properly, so they try to run concurrently. This commit isn't tested yet...
This commit is contained in:
parent
36284c10be
commit
a9709b14ea
1 changed files with 14 additions and 11 deletions
|
|
@ -117,6 +117,7 @@ class RecalibrateView(ActionView):
|
||||||
microscope = find_microscope()
|
microscope = find_microscope()
|
||||||
logging.info("Starting microscope recalibration...")
|
logging.info("Starting microscope recalibration...")
|
||||||
picamera = microscope.camera.picamera
|
picamera = microscope.camera.picamera
|
||||||
|
with microscope.camera.lock:
|
||||||
if not args.get("skip_auto_exposure"):
|
if not args.get("skip_auto_exposure"):
|
||||||
adjust_shutter_and_gain_from_raw(picamera)
|
adjust_shutter_and_gain_from_raw(picamera)
|
||||||
adjust_white_balance_from_raw(picamera)
|
adjust_white_balance_from_raw(picamera)
|
||||||
|
|
@ -179,9 +180,11 @@ class AutoExposureFromRawView(ActionView):
|
||||||
}
|
}
|
||||||
|
|
||||||
def post(self, args):
|
def post(self, args):
|
||||||
camera = find_component("org.openflexure.microscope").camera.picamera
|
camera = find_component("org.openflexure.microscope").camera
|
||||||
|
|
||||||
|
with camera.lock:
|
||||||
adjust_shutter_and_gain_from_raw(
|
adjust_shutter_and_gain_from_raw(
|
||||||
camera, **args # I'm relying on the schema to fill in missing values
|
camera.picamera, **args # I'm relying on the schema to fill in missing values
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue