Implemented communication atm broadband module.

This commit is contained in:
jupfi 2023-12-07 17:15:28 +01:00
parent 84c1afa3e6
commit 7a10b2499c
3 changed files with 18 additions and 3 deletions

View file

@ -25,6 +25,8 @@ class BroadbandController(ModuleController):
key (str): Name of the signal. key (str): Name of the signal.
value (object): Value 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: if key == "measurement_data" and self.module.model.current_broadband_measurement is not None:
logger.debug("Received single measurement.") logger.debug("Received single measurement.")
self.module.model.current_broadband_measurement.add_measurement(value) self.module.model.current_broadband_measurement.add_measurement(value)
@ -36,6 +38,11 @@ class BroadbandController(ModuleController):
elif key == "LUT_finished": elif key == "LUT_finished":
self.received_LUT(value) 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: def received_LUT(self, LUT : Measurement) -> None:
"""This slot is called when the LUT data is received from the nqrduck module. """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 # First set the frequency of the spectrometer
self.module.nqrduck_signal.emit("set_frequency", str(frequency)) self.module.nqrduck_signal.emit("set_frequency", str(frequency))
# If there is a LUT available, send the tune and match values as signal # If there is a LUT available, send the tune and match values as signal
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.nqrduck_signal.emit("start_measurement", None)
self.module.model.waiting_for_tune_and_match = False

View file

@ -23,6 +23,7 @@ class BroadbandModel(ModuleModel):
self.stop_frequency = self.MAX_FREQUENCY self.stop_frequency = self.MAX_FREQUENCY
self.DEFAULT_FREQUENCY_STEP = self.DEFAULT_FREQUENCY_STEP self.DEFAULT_FREQUENCY_STEP = self.DEFAULT_FREQUENCY_STEP
self.current_broadband_measurement = None self.current_broadband_measurement = None
self.waiting_for_tune_and_match = False
@property @property
def start_frequency(self): def start_frequency(self):

View file

@ -237,7 +237,7 @@ class BroadbandView(ModuleView):
self._ui_form.start_frequencyField.setEnabled(False) self._ui_form.start_frequencyField.setEnabled(False)
self._ui_form.stop_frequencyField.setEnabled(False) self._ui_form.stop_frequencyField.setEnabled(False)
self._ui_form.frequencystepEdit.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: else:
self._ui_form.start_frequencyField.setEnabled(True) self._ui_form.start_frequencyField.setEnabled(True)
self._ui_form.stop_frequencyField.setEnabled(True) self._ui_form.stop_frequencyField.setEnabled(True)