diff --git a/src/nqrduck_autotm/controller.py b/src/nqrduck_autotm/controller.py index a1a0ba3..04ddd48 100644 --- a/src/nqrduck_autotm/controller.py +++ b/src/nqrduck_autotm/controller.py @@ -49,9 +49,9 @@ class AutoTMController(ModuleController): stop_frequency (str): The stop frequency in MHz. """ - FREQUENCY_STEP = 50000 # Hz + N_POINTS = 400 MIN_FREQUENCY = 35e6 # Hz - MAX_FREQUENCY = 300e6 # Hz + MAX_FREQUENCY = 200e6 # Hz try: start_frequence = start_frequency.replace(",", ".") @@ -85,17 +85,18 @@ class AutoTMController(ModuleController): self.module.view.add_info_text(error) return + frequency_step = (stop_frequency - start_frequency) / N_POINTS logger.debug( "Starting frequency sweep from %s to %s with step size %s", start_frequency, stop_frequency, - FREQUENCY_STEP, + frequency_step, ) # We create the frequency sweep spinner dialog self.module.model.clear_data_points() self.module.view.create_frequency_sweep_spinner_dialog() # Print the command 'fff' to the serial connection - command = "f%sf%sf%s" % (start_frequency, stop_frequency, FREQUENCY_STEP) + command = "f%sf%sf%s" % (start_frequency, stop_frequency, frequency_step) self.send_command(command) def on_ready_read(self) -> None: @@ -434,5 +435,12 @@ class AutoTMController(ModuleController): except AttributeError: logger.error("Could not send command. No device connected.") self.module.view.add_error_text("Could not send command. No device connected.") + + def homing(self) -> None: + """ This method is used to send the command 'h' to the atm system. + This command is used to home the stepper motors of the atm system. + """ + logger.debug("Homing") + self.send_command("h") diff --git a/src/nqrduck_autotm/view.py b/src/nqrduck_autotm/view.py index f0b51f7..2160193 100644 --- a/src/nqrduck_autotm/view.py +++ b/src/nqrduck_autotm/view.py @@ -34,6 +34,9 @@ class AutoTMView(ModuleView): self._ui_form = Ui_Form() self._ui_form.setupUi(self) self.widget = widget + + self.frequency_sweep_spinner = self.FrequencySweepSpinner() + self.frequency_sweep_spinner.hide() # Disable the connectButton while no devices are selected self._ui_form.connectButton.setDisabled(True) @@ -85,6 +88,9 @@ class AutoTMView(ModuleView): # On clicking of the switchATMButton call the switch_atm method self._ui_form.switchATMButton.clicked.connect(self.module.controller.switch_to_atm) + + # On clicking of the homingButton call the homing method + self._ui_form.homingButton.clicked.connect(self.module.controller.homing) # Connect the measurement finished signal to the plot_measurement slot self.module.model.measurement_finished.connect(self.plot_measurement)