Skip to content
Snippets Groups Projects
Commit 5567f57a authored by Christoph Schmidt's avatar Christoph Schmidt
Browse files

Works now with the CaptDevice. Updated to Version 0.1.3. Minor changes. The...

Works now with the CaptDevice. Updated to Version 0.1.3. Minor changes. The LaserController now waits for the CaptDevice to finish the setup.
parent 813e3b0a
No related branches found
No related tags found
No related merge requests found
......@@ -20,7 +20,8 @@ if __name__ == "__main__":
app = QApplication.instance()
conf_capt_dev = captdev.Config()
#conf.load("config.yaml")
conf_capt_dev.load("CaptDeviceConfig.yaml")
conf_capt_dev.autosave()
start_capture_flag = Value('i', 0)
capt_dev_model = captdev.Model(conf_capt_dev)
......
[project]
name = "lasercontrol"
version = "0.1.2"
version = "0.1.3"
authors = [
{ name="Christoph Schmidt", email="cschmidt.fs@gmail.com" },
]
......
......@@ -9,6 +9,7 @@ from LaserControl.model.LaserControlModel import LaserControlModel
import CaptDeviceControl as captdev
class LaserControlController:
def __init__(self, model: LaserControlModel, start_capture_flag: Value = None):
......@@ -76,9 +77,9 @@ class LaserControlController:
self.kill_thread = False
def connect_capture_device(self, device: captdev.Controller):
self.logger.info("***********************************************Connecting to capture device..***********************************")
self.logger.info(
"***********************************************Connecting to capture device..***********************************")
self.mp_laser_controller.mp_read_laser_settings(self.model.port)
if isinstance(device, captdev.Controller):
self.model.capturing_device = device
......@@ -86,13 +87,10 @@ class LaserControlController:
lambda x: type(self.model).capturing_device_connected.fset(self.model, x)
)
def connect_device(self):
self.logger.info("Connecting to laser...")
self.mp_laser_controller.mp_read_laser_settings(self.model.port)
def _move_to_wavelength_finished(self, wavelength: float):
self.logger.info(f"Move to wavelength finished. Current wavelength: {wavelength}")
......@@ -106,7 +104,6 @@ class LaserControlController:
def _laser_movement_finished(self, is_finished: bool):
pass
# def _monitor_laser_state(self):
# while not self.kill_thread:
# self.model.connected = bool(self._laser_connected_flag.value)
......@@ -137,8 +134,25 @@ class LaserControlController:
# self.capt_device.clear_data()
# Reset the flag
# self.capt_device.model.capturing_finished = False
self.logger.info(f"Starting wavelength sweep from {start_wavelength} to {stop_wavelength}")
if self.model.capturing_device is not None:
self.model.capturing_device.reset_capture()
if not self.model.capturing_device.model.device_information.device_connected:
self.model.capturing_device.open_device()
self.model.capturing_device.ready_for_recording_changed.connect(
lambda ready: self.start_wavelength_sweep_emitted(start_wavelength, stop_wavelength, ready=ready)
)
self.logger.info("Capturing device is connected.")
if self.model.capturing_device.model.capturing_information.ready_for_recording:
self.start_wavelength_sweep_emitted(start_wavelength, stop_wavelength)
else:
self.start_wavelength_sweep_emitted(start_wavelength, stop_wavelength)
def start_wavelength_sweep_emitted(self, start_wavelength: float = None, stop_wavelength: float = None, ready=True):
if ready:
if start_wavelength is None:
start_wavelength = self.model.sweep_start_wavelength
if stop_wavelength is None:
......
......@@ -122,7 +122,7 @@ class MPLaserDevice(cmp.CProcess):
self.laser_finished_flag.value = finished
return self.laser_finished_flag.value
@cmp.CProcess.register_signal(postfix="_finsihed")
@cmp.CProcess.register_signal(postfix="_finished")
def move_to_wavelength(self, usb_port: str = None, wavelength: float = None, capture: bool = False,
con: LaserCon = None, *args, **kwargs):
# laser_moving_flag.value = False
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment