diff --git a/src/nqrduck_broadband/controller.py b/src/nqrduck_broadband/controller.py index 33364b8..25a3e6f 100644 --- a/src/nqrduck_broadband/controller.py +++ b/src/nqrduck_broadband/controller.py @@ -25,6 +25,8 @@ class BroadbandController(ModuleController): key (str): Name of the signal. value (object): Value of the signal. """ + logger.debug(self.module.model.waiting_for_tune_and_match) + if key == "measurement_data" and self.module.model.current_broadband_measurement is not None: logger.debug("Received single measurement.") self.module.model.current_broadband_measurement.add_measurement(value) @@ -36,6 +38,11 @@ class BroadbandController(ModuleController): elif key == "LUT_finished": self.received_LUT(value) + elif key == "confirm_tune_and_match" and self.module.model.waiting_for_tune_and_match: + logger.debug("Confirmed tune and match.") + self.module.nqrduck_signal.emit("start_measurement", None) + self.module.model.waiting_for_tune_and_match = False + def received_LUT(self, LUT : Measurement) -> None: """This slot is called when the LUT data is received from the nqrduck module. @@ -155,5 +162,12 @@ class BroadbandController(ModuleController): # First set the frequency of the spectrometer self.module.nqrduck_signal.emit("set_frequency", str(frequency)) # If there is a LUT available, send the tune and match values as signal - - self.module.nqrduck_signal.emit("start_measurement", None) \ No newline at end of file + if self.module.model.LUT is not None: + self.module.model.waiting_for_tune_and_match = True + # We need the entry number of the LUT for the current frequency + + self.module.nqrduck_signal.emit("set_tune_and_match", frequency * 1e-6) + QApplication.processEvents() + else: + self.module.nqrduck_signal.emit("start_measurement", None) + self.module.model.waiting_for_tune_and_match = False \ No newline at end of file diff --git a/src/nqrduck_broadband/model.py b/src/nqrduck_broadband/model.py index d985825..9d41ee9 100644 --- a/src/nqrduck_broadband/model.py +++ b/src/nqrduck_broadband/model.py @@ -23,6 +23,7 @@ class BroadbandModel(ModuleModel): self.stop_frequency = self.MAX_FREQUENCY self.DEFAULT_FREQUENCY_STEP = self.DEFAULT_FREQUENCY_STEP self.current_broadband_measurement = None + self.waiting_for_tune_and_match = False @property def start_frequency(self): diff --git a/src/nqrduck_broadband/view.py b/src/nqrduck_broadband/view.py index 248cacb..3d4aa27 100644 --- a/src/nqrduck_broadband/view.py +++ b/src/nqrduck_broadband/view.py @@ -237,7 +237,7 @@ class BroadbandView(ModuleView): self._ui_form.start_frequencyField.setEnabled(False) self._ui_form.stop_frequencyField.setEnabled(False) self._ui_form.frequencystepEdit.setEnabled(False) - self._ui_form.activeLUTLabel.setText("Test") + self._ui_form.activeLUTLabel.setText(self.module.model.LUT.TYPE) else: self._ui_form.start_frequencyField.setEnabled(True) self._ui_form.stop_frequencyField.setEnabled(True)