Skip to content

Commit

Permalink
m2k/trigger_settings: fix switched trigger mode logic in the Osc.
Browse files Browse the repository at this point in the history
During style changes, the trigger mode determination process was
switched and it no longer worked properly.
An enabled CustomSwitch corresponds to the "Auto" trigger mode, not
otherwise.

Signed-off-by: AlexandraTrifan <[email protected]>
  • Loading branch information
AlexandraTrifan committed Jan 20, 2025
1 parent 4a5cf41 commit 53228fa
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions plugins/m2k/src/old/trigger_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ TriggerSettings::TriggerSettings(M2kAnalogIn *libm2k_adc, QWidget *parent)
connect(trigger_level, SIGNAL(valueChanged(double)), SLOT(onSpinboxTriggerLevelChanged(double)));
connect(trigger_hysteresis, SIGNAL(valueChanged(double)), SLOT(onSpinboxTriggerHystChanged(double)));

connect(ui->btnTrigger, SIGNAL(clicked()), this, SLOT(autoTriggerEnable()));
connect(ui->btnTrigger, &CustomSwitch::toggled, [=](bool toggled) { autoTriggerEnable(); });

// Default GUI settings
ui->cmb_source->setCurrentIndex(0);
Expand Down Expand Up @@ -416,15 +416,15 @@ void TriggerSettings::on_cmb_analog_extern_currentIndexChanged(int index)

void TriggerSettings::autoTriggerDisable()
{
if(!ui->btnTrigger->isChecked()) {
if(ui->btnTrigger->isChecked()) {
writeHwMode(libm2k::ALWAYS);
temporarily_disabled = true;
}
}

void TriggerSettings::autoTriggerEnable()
{
if(!ui->btnTrigger->isChecked()) {
if(ui->btnTrigger->isChecked()) {
if(temporarily_disabled) {
writeHwMode(determineTriggerMode(ui->intern_en->isChecked(), ui->extern_en->isChecked()));

Expand All @@ -440,14 +440,14 @@ bool TriggerSettings::triggerIsArmed() const { return ui->intern_en->isChecked()
void TriggerSettings::on_btnTrigger_toggled(bool checked)
{
trigger_auto_mode = checked;
int mode = checked ? NORMAL : AUTO;
int mode = checked ? AUTO : NORMAL;

Q_EMIT triggerModeChanged(mode);
}

TriggerSettings::TriggerMode TriggerSettings::triggerMode() const
{
return ui->btnTrigger->isChecked() ? NORMAL : AUTO;
return ui->btnTrigger->isChecked() ? AUTO : NORMAL;
}

void TriggerSettings::updateHwVoltLevels(int chnIdx)
Expand Down

0 comments on commit 53228fa

Please sign in to comment.