Added override allowing the user-specified CI-V address to also be used

as the Rig ID (model). This is useful for older radios that do not reply
to Rig ID queries. For radios using the default CI-V address, it should
"just work".
merge-requests/7/head
Elliott Liggett 2021-11-06 23:59:03 -07:00
rodzic 863dd6ba95
commit 88430db9ac
6 zmienionych plików z 63 dodań i 5 usunięć

Wyświetl plik

@ -3952,6 +3952,25 @@ void rigCommander::getRigID()
prepDataAndSend(payload);
}
void rigCommander::setRigID(unsigned char rigID)
{
// This function overrides radio model detection.
// It can be used for radios without Rig ID commands,
// or to force a specific radio model
qInfo(logRig()) << "Sending rig ID to: (int)" << (int)rigID;
lookingForRig = true;
foundRig = false;
this->model = determineRadioModel(rigID);
rigCaps.modelID = rigID;
rigCaps.model = determineRadioModel(rigID);
determineRigCaps();
}
void rigCommander::changeLatency(const quint16 value)
{
emit haveChangeLatency(value);

Wyświetl plik

@ -280,6 +280,7 @@ public slots:
// Rig ID and CIV:
void getRigID();
void findRigs();
void setRigID(unsigned char rigID);
void setCIVAddr(unsigned char civAddr);
// Calibration:

Wyświetl plik

@ -55,6 +55,9 @@ model_kind determineRadioModel(unsigned char rigID)
case model718:
rig = model718;
break;
case model736:
rig = model736;
break;
case model910h:
rig = model910h;
break;

Wyświetl plik

@ -408,6 +408,7 @@ void wfmain::makeRig()
connect(this, SIGNAL(sendCloseComm()), rig, SLOT(closeComm()));
connect(this, SIGNAL(sendChangeLatency(quint16)), rig, SLOT(changeLatency(quint16)));
connect(this, SIGNAL(getRigCIV()), rig, SLOT(findRigs()));
connect(this, SIGNAL(setRigID(unsigned char)), rig, SLOT(setRigID(unsigned char)));
connect(rig, SIGNAL(discoveredRigID(rigCapabilities)), this, SLOT(receiveFoundRigID(rigCapabilities)));
connect(rig, SIGNAL(commReady()), this, SLOT(receiveCommReady()));
@ -532,8 +533,14 @@ void wfmain::receiveCommReady()
// We still query the rigID to find the model, but at least we know the CIV.
qInfo(logSystem()) << "Skipping automatic CIV, using user-supplied value of " << prefs.radioCIVAddr;
showStatusBarText(QString("Using user-supplied radio CI-V address of 0x%1").arg(prefs.radioCIVAddr, 2, 16));
emit getRigID();
getInitialRigState();
if(prefs.CIVisRadioModel)
{
qInfo(logSystem()) << "Skipping Rig ID query, using user-supplied model from CI-V address: " << prefs.radioCIVAddr;
emit setRigID(prefs.radioCIVAddr);
} else {
emit getRigID();
getInitialRigState();
}
}
}
@ -990,6 +997,10 @@ void wfmain::setUIToPrefs()
ui->wfthemeCombo->setCurrentIndex(ui->wfthemeCombo->findData(prefs.wftheme));
colorMap->setGradient(static_cast<QCPColorGradient::GradientPreset>(prefs.wftheme));
ui->useCIVasRigIDChk->blockSignals(true);
ui->useCIVasRigIDChk->setChecked(prefs.CIVisRadioModel);
ui->useCIVasRigIDChk->blockSignals(false);
}
void wfmain::setAudioDevicesUI()
@ -1285,6 +1296,7 @@ void wfmain::setDefPrefs()
defPrefs.wfInterpolate = true;
defPrefs.stylesheetPath = QString("qdarkstyle/style.qss");
defPrefs.radioCIVAddr = 0x00; // previously was 0x94 for 7300.
defPrefs.CIVisRadioModel = false;
defPrefs.serialPortRadio = QString("auto");
defPrefs.serialPortBaud = 115200;
defPrefs.enablePTT = false;
@ -1382,6 +1394,9 @@ void wfmain::loadSettings()
ui->rigCIVManualAddrChk->setChecked(false);
ui->rigCIVaddrHexLine->setEnabled(false);
}
prefs.CIVisRadioModel = (bool)settings->value("CIVisRadioModel", defPrefs.CIVisRadioModel).toBool();
prefs.serialPortRadio = settings->value("SerialPortRadio", defPrefs.serialPortRadio).toString();
int serialIndex = ui->serialDeviceListCombo->findText(prefs.serialPortRadio);
if (serialIndex != -1) {
@ -1640,6 +1655,7 @@ void wfmain::saveSettings()
// Radio and Comms: C-IV addr, port to use
settings->beginGroup("Radio");
settings->setValue("RigCIVuInt", prefs.radioCIVAddr);
settings->setValue("CIVisRadioModel", prefs.CIVisRadioModel);
settings->setValue("SerialPortRadio", prefs.serialPortRadio);
settings->setValue("SerialPortBaud", prefs.serialPortBaud);
settings->setValue("VirtualSerialPort", prefs.virtualSerialPort);
@ -5474,6 +5490,11 @@ void wfmain::on_moreControlsBtn_clicked()
trxadj->show();
}
void wfmain::on_useCIVasRigIDChk_clicked(bool checked)
{
prefs.CIVisRadioModel = checked;
}
// --- DEBUG FUNCTION ---
void wfmain::on_debugBtn_clicked()
{

Wyświetl plik

@ -51,6 +51,7 @@ public:
signals:
// Basic to rig:
void setCIVAddr(unsigned char newRigCIVAddr);
void setRigID(unsigned char rigID);
// Power
void sendPowerOn();
@ -497,6 +498,8 @@ private slots:
void on_moreControlsBtn_clicked();
void on_useCIVasRigIDChk_clicked(bool checked);
private:
Ui::wfmain *ui;
void closeEvent(QCloseEvent *event);
@ -714,6 +717,7 @@ private:
bool wfInterpolate;
QString stylesheetPath;
unsigned char radioCIVAddr;
bool CIVisRadioModel;
QString serialPortRadio;
quint32 serialPortBaud;
bool enablePTT;

Wyświetl plik

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>941</width>
<width>946</width>
<height>582</height>
</rect>
</property>
@ -18,7 +18,7 @@
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
<number>3</number>
</property>
<widget class="QWidget" name="mainTab">
<attribute name="title">
@ -2373,6 +2373,16 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="useCIVasRigIDChk">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Only check for older radios!&lt;/p&gt;&lt;p&gt;This checkbox forces wfview to trust that the CI-V address is also the model number of the radio. This is only useful for older radios that do not reply to our Rig ID requests (0x19 0x00). Do not check this box unless you have an older radio. &lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Use as Model too</string>
</property>
</widget>
</item>
<item>
<spacer name="tuneSpacer">
<property name="orientation">
@ -2830,7 +2840,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>941</width>
<width>946</width>
<height>22</height>
</rect>
</property>