From fa504141388177fc0e44f668225522a672eb3023 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Wed, 10 Feb 2021 21:22:38 -0800 Subject: [PATCH] Added UI elements with some supporting code: squelch and calibration window. --- calibrationwindow.cpp | 24 ++++ calibrationwindow.h | 30 +++++ calibrationwindow.ui | 268 ++++++++++++++++++++++++++++++++++++++++++ rigcommander.cpp | 5 + rigcommander.h | 1 + wfmain.cpp | 18 ++- wfmain.h | 6 + wfmain.ui | 36 ++++++ wfview.pro | 9 +- 9 files changed, 389 insertions(+), 8 deletions(-) create mode 100644 calibrationwindow.cpp create mode 100644 calibrationwindow.h create mode 100644 calibrationwindow.ui diff --git a/calibrationwindow.cpp b/calibrationwindow.cpp new file mode 100644 index 0000000..d13294e --- /dev/null +++ b/calibrationwindow.cpp @@ -0,0 +1,24 @@ +#include "calibrationwindow.h" +#include "ui_calibrationwindow.h" + +calibrationWindow::calibrationWindow(QWidget *parent) : + QDialog(parent), + ui(new Ui::calibrationWindow) +{ + ui->setupUi(this); +} + +calibrationWindow::~calibrationWindow() +{ + delete ui; +} + +void calibrationWindow::handleCurrentFreq(double tunedFreq) +{ + +} + +void calibrationWindow::handleSpectrumPeak(double peakFreq) +{ + +} diff --git a/calibrationwindow.h b/calibrationwindow.h new file mode 100644 index 0000000..cbef2f3 --- /dev/null +++ b/calibrationwindow.h @@ -0,0 +1,30 @@ +#ifndef CALIBRATIONWINDOW_H +#define CALIBRATIONWINDOW_H + +#include + +namespace Ui { +class calibrationWindow; +} + +class calibrationWindow : public QDialog +{ + Q_OBJECT + +public: + explicit calibrationWindow(QWidget *parent = 0); + ~calibrationWindow(); + +public slots: + void handleSpectrumPeak(double peakFreq); + void handleCurrentFreq(double tunedFreq); + +signals: + void requestSpectrumPeak(double peakFreq); + void requestCurrentFreq(double tunedFreq); + +private: + Ui::calibrationWindow *ui; +}; + +#endif // CALIBRATIONWINDOW_H diff --git a/calibrationwindow.ui b/calibrationwindow.ui new file mode 100644 index 0000000..efc3aaf --- /dev/null +++ b/calibrationwindow.ui @@ -0,0 +1,268 @@ + + + calibrationWindow + + + + 0 + 0 + 400 + 300 + + + + Dialog + + + + + 9 + 9 + 381 + 281 + + + + + + + + + IC-9700 + + + + + + + Reference Adjustment + + + + + + + + + + + + + Peak + + + + + + + 446.000125 + + + + + + + + + + + Tune + + + + + + + 446.00000 + + + + + + + + + + + Delta + + + + + + + -0.125 + + + + + + + + + + + + + + + Course + + + + + + + Fine + + + + + + + + + 10 + + + + + + + + + Qt::Horizontal + + + + + + + Qt::Horizontal + + + + + + + + + 10 + + + 10 + + + + + 255 + + + + + + + 255 + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + 10 + + + + + Save + + + + + + + Load + + + + + + + Slot: + + + + + + + + 1 + + + + + 2 + + + + + 3 + + + + + 4 + + + + + 5 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Read Current Rig Calibration + + + + + + + + + diff --git a/rigcommander.cpp b/rigcommander.cpp index 002dcc4..3ce882e 100644 --- a/rigcommander.cpp +++ b/rigcommander.cpp @@ -843,6 +843,11 @@ void rigCommander::getSql() prepDataAndSend(payload); } +void rigCommander::setSquelch(unsigned char level) +{ + sendLevelCmd(0x03, level); +} + void rigCommander::setRfGain(unsigned char level) { sendLevelCmd(0x02, level); diff --git a/rigcommander.h b/rigcommander.h index 34ba7bd..056dc59 100644 --- a/rigcommander.h +++ b/rigcommander.h @@ -55,6 +55,7 @@ public slots: void getRfGain(); void getAfGain(); void getSql(); + void setSquelch(unsigned char level); void setRfGain(unsigned char level); void setAfGain(unsigned char level); void startATU(); diff --git a/wfmain.cpp b/wfmain.cpp index 8858888..2b57692 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -23,6 +23,8 @@ wfmain::wfmain(const QString serialPortCL, const QString hostCL, QWidget *parent this->serialPortCL = serialPortCL; this->hostCL = hostCL; + cal = new calibrationWindow(); + haveRigCaps = false; ui->bandStkLastUsedBtn->setVisible(false); @@ -277,6 +279,7 @@ wfmain::wfmain(const QString serialPortCL, const QString hostCL, QWidget *parent connect(rig, SIGNAL(haveAfGain(unsigned char)), this, SLOT(receiveAfGain(unsigned char))); connect(this, SIGNAL(getSql()), rig, SLOT(getSql())); connect(rig, SIGNAL(haveSql(unsigned char)), this, SLOT(receiveSql(unsigned char))); + connect(this, SIGNAL(setSql(unsigned char)), rig, SLOT(setSquelch(unsigned char))); connect(this, SIGNAL(startATU()), rig, SLOT(startATU())); connect(this, SIGNAL(setATU(bool)), rig, SLOT(setATU(bool))); connect(this, SIGNAL(getATUStatus()), rig, SLOT(getATUStatus())); @@ -1099,7 +1102,7 @@ void wfmain:: getInitialRigState() cmdOutQue.append(cmdGetRxGain); cmdOutQue.append(cmdGetAfGain); - // cmdOutQue.append(cmdGetSql); // implimented but not used + cmdOutQue.append(cmdGetSql); // implimented but not used // TODO: // get TX level // get Scope reference Level @@ -2148,9 +2151,8 @@ void wfmain::receiveAfGain(unsigned char level) void wfmain::receiveSql(unsigned char level) { - // TODO: Maybe add squelch control - // qDebug() << "Receive SQL level of " << (int)level << " = " << 100*level/255.0 << "%"; - // ui->sqlSlider->setValue(level); // No SQL control so far + qDebug() << "Receive SQL level of " << (int)level << " = " << 100*level/255.0 << "%"; + ui->sqlSlider->setValue(level); (void)level; } @@ -2367,6 +2369,12 @@ void wfmain::on_connectBtn_clicked() } } +void wfmain::on_sqlSlider_valueChanged(int value) +{ + emit setSql((unsigned char)value); +} + + // --- DEBUG FUNCTION --- void wfmain::on_debugBtn_clicked() { @@ -2378,7 +2386,7 @@ void wfmain::on_debugBtn_clicked() //emit getScopeSpan(); // in khz, only in "center" mode //qDebug() << "Debug: finding rigs attached. Let's see if this works. "; //rig->findRigs(); + cal->show(); } - diff --git a/wfmain.h b/wfmain.h index 0e27923..9d5ffe7 100644 --- a/wfmain.h +++ b/wfmain.h @@ -15,6 +15,7 @@ #include "rigcommander.h" #include "freqmemory.h" #include "rigidentities.h" +#include "calibrationwindow.h" #include #include @@ -49,6 +50,7 @@ signals: void getDebug(); void setRfGain(unsigned char level); void setAfGain(unsigned char level); + void setSql(unsigned char level); void startATU(); void setATU(bool atuEnabled); void getATUStatus(); @@ -277,6 +279,8 @@ private slots: void on_scopeEnableWFBtn_clicked(bool checked); + void on_sqlSlider_valueChanged(int value); + private: Ui::wfmain *ui; QSettings settings; @@ -433,6 +437,8 @@ private: rigCapabilities rigCaps; bool haveRigCaps; + calibrationWindow *cal; + void bandStackBtnClick(); bool waitingForBandStackRtn; char bandStkBand; diff --git a/wfmain.ui b/wfmain.ui index 10c60ca..bdfa957 100644 --- a/wfmain.ui +++ b/wfmain.ui @@ -291,6 +291,42 @@ + + + + 0 + + + + + + 16777215 + 60 + + + + 255 + + + Qt::Vertical + + + + + + + + 16777215 + 15 + + + + SQ + + + + + diff --git a/wfview.pro b/wfview.pro index cfd89d0..3020361 100644 --- a/wfview.pro +++ b/wfview.pro @@ -81,7 +81,8 @@ SOURCES += main.cpp\ rigidentities.cpp \ udphandler.cpp \ logcategories.cpp \ - rxaudiohandler.cpp + rxaudiohandler.cpp \ + calibrationwindow.cpp HEADERS += wfmain.h \ commhandler.h \ @@ -90,8 +91,10 @@ HEADERS += wfmain.h \ rigidentities.h \ udphandler.h \ logcategories.h \ - rxaudiohandler.h + rxaudiohandler.h \ + calibrationwindow.h -FORMS += wfmain.ui +FORMS += wfmain.ui \ + calibrationwindow.ui