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,13 +117,14 @@ 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
|
||||||
if not args.get("skip_auto_exposure"):
|
with microscope.camera.lock:
|
||||||
adjust_shutter_and_gain_from_raw(picamera)
|
if not args.get("skip_auto_exposure"):
|
||||||
adjust_white_balance_from_raw(picamera)
|
adjust_shutter_and_gain_from_raw(picamera)
|
||||||
lst = lst_from_camera(picamera)
|
adjust_white_balance_from_raw(picamera)
|
||||||
with pause_stream(microscope.camera) as scamera:
|
lst = lst_from_camera(picamera)
|
||||||
scamera.picamera.lens_shading_table = lst
|
with pause_stream(microscope.camera) as scamera:
|
||||||
microscope.save_settings()
|
scamera.picamera.lens_shading_table = lst
|
||||||
|
microscope.save_settings()
|
||||||
|
|
||||||
|
|
||||||
class FlattenLSTView(ActionView):
|
class FlattenLSTView(ActionView):
|
||||||
|
|
@ -179,10 +180,12 @@ 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
|
||||||
adjust_shutter_and_gain_from_raw(
|
|
||||||
camera, **args # I'm relying on the schema to fill in missing values
|
with camera.lock:
|
||||||
)
|
adjust_shutter_and_gain_from_raw(
|
||||||
|
camera.picamera, **args # I'm relying on the schema to fill in missing values
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class AutoWhiteBalanceFromRawView(ActionView):
|
class AutoWhiteBalanceFromRawView(ActionView):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue