Added filter selection support.

TODO: Read current filter from rig.
merge-requests/2/head
Elliott Liggett 2021-02-13 10:02:45 -08:00
rodzic 27815a7994
commit 5d3c386c87
6 zmienionych plików z 68 dodań i 16 usunięć

Wyświetl plik

@ -445,16 +445,26 @@ QByteArray rigCommander::makeFreqPayload(double freq)
}
void rigCommander::setMode(char mode)
void rigCommander::setMode(unsigned char mode, unsigned char modeFilter)
{
QByteArray payload;
if((mode >=0) && (mode < 0x22 + 1))
if(mode < 0x22 + 1)
{
// mode command | filter
// 0x01 | Filter 01 automatically
// 0x04 | user-specififed 01, 02, 03 | note, is "read the current mode" on older rigs
// 0x06 | "default" filter is auto
payload.setRawData("\x06", 1); // cmd 06 needs filter specified
//payload.setRawData("\x04", 1); // cmd 04 will apply the default filter, but it seems to always pick FIL 02
payload.append(mode);
payload.append("\x03"); // wide band
if(rigCaps.model==model706)
{
payload.append("\x01"); // "normal" on IC-706
} else {
payload.append(modeFilter);
}
prepDataAndSend(payload);
}
}
@ -1124,6 +1134,11 @@ void rigCommander::determineRigCaps()
rigCaps.hasDV = false;
rigCaps.hasATU = false;
rigCaps.spectSeqMax = 0;
rigCaps.spectAmpMax = 0;
rigCaps.spectLenMax = 0;
rigCaps.hasTransmit = true;
switch(model){
@ -1195,6 +1210,14 @@ void rigCommander::determineRigCaps()
rigCaps.hasDV = true;
rigCaps.hasATU = true;
break;
case model706:
rigCaps.modelName = QString("IC-706");
rigCaps.hasSpectrum = false;
rigCaps.hasLan = false;
rigCaps.hasEthernet = false;
rigCaps.hasWiFi = false;
rigCaps.hasATU = true;
break;
default:
rigCaps.modelName = QString("IC-RigID: 0x%1").arg(rigCaps.model, 0, 16);
rigCaps.hasSpectrum = false;

Wyświetl plik

@ -44,7 +44,7 @@ public slots:
void getScopeEdge();
void getScopeMode();
void setFrequency(double freq);
void setMode(char mode);
void setMode(unsigned char mode, unsigned char modeFilter);
void getFrequency();
void getBandStackReg(char band, char regCode);
void getMode();

Wyświetl plik

@ -21,6 +21,7 @@ enum model_kind {
model7850 = 0x8E,
model9700 = 0xA2,
model705 = 0xA4,
model706 = 0x58,
modelUnknown = 0xFF
};

Wyświetl plik

@ -24,6 +24,8 @@ wfmain::wfmain(const QString serialPortCL, const QString hostCL, QWidget *parent
this->hostCL = hostCL;
cal = new calibrationWindow();
sat = new satelliteSetup();
haveRigCaps = false;
@ -222,7 +224,7 @@ wfmain::wfmain(const QString serialPortCL, const QString hostCL, QWidget *parent
ui->modeFilterCombo->addItem("1", 1);
ui->modeFilterCombo->addItem("2", 2);
ui->modeFilterCombo->addItem("3", 3);
ui->modeFilterCombo->addItem("Setup...", 10);
ui->modeFilterCombo->addItem("Setup...", 99);
@ -281,7 +283,7 @@ wfmain::wfmain(const QString serialPortCL, const QString hostCL, QWidget *parent
connect(this, SIGNAL(getScopeSpan()), rig, SLOT(getScopeSpan()));
connect(this, SIGNAL(setScopeFixedEdge(double,double,unsigned char)), rig, SLOT(setSpectrumBounds(double,double,unsigned char)));
connect(this, SIGNAL(setMode(char)), rig, SLOT(setMode(char)));
connect(this, SIGNAL(setMode(unsigned char, unsigned char)), rig, SLOT(setMode(unsigned char, unsigned char)));
connect(this, SIGNAL(getRfGain()), rig, SLOT(getRfGain()));
connect(this, SIGNAL(getAfGain()), rig, SLOT(getAfGain()));
connect(this, SIGNAL(setRfGain(unsigned char)), rig, SLOT(setRfGain(unsigned char)));
@ -1857,9 +1859,16 @@ void wfmain::on_modeSelectCombo_activated(int index)
unsigned char newMode = static_cast<unsigned char>(ui->modeSelectCombo->itemData(index).toUInt());
currentModeIndex = newMode;
qDebug() << __func__ << " at index " << index << " has newMode: " << newMode;
emit setMode(newMode);
int filterSelection = ui->modeFilterCombo->currentData().toInt();
if(filterSelection == 99)
{
// oops, we forgot to reset the combo box
} else {
qDebug() << __func__ << " at index " << index << " has newMode: " << newMode;
emit setMode(newMode, filterSelection);
}
}
//void wfmain::on_freqDial_actionTriggered(int action)
@ -1954,7 +1963,8 @@ void wfmain::receiveBandStackReg(float freq, char mode, bool dataOn)
// read the band stack and apply by sending out commands
setFrequency(freq);
setMode(mode); // make sure this is what you think it is
int filterSelection = ui->modeFilterCombo->currentData().toInt();
setMode(mode, (unsigned char)filterSelection); // make sure this is what you think it is
// setDataMode(dataOn); // signal out
if(dataOn)
@ -2396,13 +2406,24 @@ void wfmain::on_sqlSlider_valueChanged(int value)
void wfmain::on_modeFilterCombo_activated(int index)
{
//TODO:
if(index >2)
int filterSelection = ui->modeFilterCombo->itemData(index).toInt();
if(filterSelection == 99)
{
//filterSetup->show();
// TODO:
// Bump the filter selected back to F1, F2, or F3
// possibly track the filter in the class. Would make this easier.
// filterSetup.show();
//
} else {
unsigned char newMode = static_cast<unsigned char>(ui->modeSelectCombo->currentData().toUInt());
currentModeIndex = newMode; // we track this for other functions
emit setMode(newMode, (unsigned char)filterSelection);
}
// emit setFilterSel((unsigned char)index);
}
// --- DEBUG FUNCTION ---
@ -2417,7 +2438,8 @@ void wfmain::on_debugBtn_clicked()
//qDebug() << "Debug: finding rigs attached. Let's see if this works. ";
//rig->findRigs();
// cal->show();
emit getMode();
// emit getMode();
sat->show();
}

Wyświetl plik

@ -17,6 +17,7 @@
#include "rigidentities.h"
#include "calibrationwindow.h"
#include "satellitesetup.h"
#include <qcustomplot.h>
#include <qserialportinfo.h>
@ -39,7 +40,7 @@ signals:
void getFrequency();
void setFrequency(double freq);
void getMode();
void setMode(char modeIndex);
void setMode(unsigned char modeIndex, unsigned char modeFilter);
void setDataMode(bool dataOn);
void getDataMode();
void getPTT();
@ -443,6 +444,7 @@ private:
bool haveRigCaps;
calibrationWindow *cal;
satelliteSetup *sat;
void bandStackBtnClick();
bool waitingForBandStackRtn;

Wyświetl plik

@ -233,7 +233,11 @@
</widget>
</item>
<item>
<widget class="QComboBox" name="tuningStepCombo"/>
<widget class="QComboBox" name="tuningStepCombo">
<property name="toolTip">
<string>Tuning Step Selection possibly. Or not...</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="tuneLockChk">