Skip to content

Commit

Permalink
Check 125k/134k radiobutton when getting lf config
Browse files Browse the repository at this point in the history
  • Loading branch information
wh201906 committed Jun 27, 2023
1 parent d466e55 commit 0738aff
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/module/lf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ void LF::syncWithUI()
ui->LF_LFConf_averagingBox->setChecked(currLFConfig.averaging);
ui->LF_LFConf_thresholdBox->setValue(currLFConfig.triggerThreshold);
ui->LF_LFConf_skipsBox->setValue(currLFConfig.samplesToSkip);
emit LFfreqConfChanged(currLFConfig.divisor, false);
}

void LF::setConfigMap(const QVariantMap& configMap)
Expand Down
2 changes: 1 addition & 1 deletion src/module/lf.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class LF : public QObject
void syncWithUI();
bool getLFConfig_helper(const QVariantMap& map, QString& str, int* result);
signals:

void LFfreqConfChanged(int divisor, bool isCustomized);
};

#endif // LF_H
13 changes: 9 additions & 4 deletions src/ui/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ MainWindow::MainWindow(QWidget *parent):
mifare = new Mifare(ui, util, this);
lf = new LF(ui, util, this);
t55xxTab = new T55xxTab(util);
connect(lf, &LF::LFfreqConfChanged, this, &MainWindow::onLFfreqConfChanged);
connect(t55xxTab, &T55xxTab::setParentGUIState, this, &MainWindow::setState);
ui->funcTab->insertTab(2, t55xxTab, tr("T55xx"));

Expand Down Expand Up @@ -1511,16 +1512,20 @@ void MainWindow::on_LF_LFConf_freqSlider_valueChanged(int value)
onLFfreqConfChanged(value, true);
}

void MainWindow::onLFfreqConfChanged(int value, bool isCustomized)
void MainWindow::onLFfreqConfChanged(int divisor, bool isCustomized)
{
ui->LF_LFConf_freqDivisorBox->blockSignals(true);
ui->LF_LFConf_freqSlider->blockSignals(true);

if(isCustomized)
ui->LF_LFConf_freqOtherButton->setChecked(true);
ui->LF_LFConf_freqLabel->setText(tr("Actural Freq: ") + QString("%1kHz").arg(LF::divisor2Freq(value), 0, 'f', 3));
ui->LF_LFConf_freqDivisorBox->setValue(value);
ui->LF_LFConf_freqSlider->setValue(value);
else if(divisor == 95)
ui->LF_LFConf_freq125kButton->setChecked(true);
else if(divisor == 88)
ui->LF_LFConf_freq134kButton->setChecked(true);
ui->LF_LFConf_freqLabel->setText(tr("Actural Freq: ") + QString("%1kHz").arg(LF::divisor2Freq(divisor), 0, 'f', 3));
ui->LF_LFConf_freqDivisorBox->setValue(divisor);
ui->LF_LFConf_freqSlider->setValue(divisor);

ui->LF_LFConf_freqDivisorBox->blockSignals(false);
ui->LF_LFConf_freqSlider->blockSignals(false);
Expand Down
3 changes: 2 additions & 1 deletion src/ui/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,8 @@ private slots:

void on_Set_UI_CMDFont_setButton_clicked();

void onLFfreqConfChanged(int divisor, bool isCustomized);

private:
Ui::MainWindow* ui;
QButtonGroup* MFCardTypeBtnGroup;
Expand Down Expand Up @@ -268,7 +270,6 @@ private slots:
void addClientPath(const QString& path);
void loadClientPathList();
void saveClientPathList();
void onLFfreqConfChanged(int value, bool isCustomized);
void dockInit();
void loadConfig();
protected:
Expand Down

0 comments on commit 0738aff

Please sign in to comment.