kopia lustrzana https://gitlab.com/eliggett/wfview
Squashed CIV bug. Added preliminary scope mode functions (not working
yet).merge-requests/1/merge
rodzic
24a51074d6
commit
55b0e15afd
|
@ -119,6 +119,21 @@ void rigCommander::setSpectrumBounds()
|
|||
|
||||
}
|
||||
|
||||
void rigCommander::getScopeMode()
|
||||
{
|
||||
// center or fixed
|
||||
QByteArray payload;
|
||||
payload.setRawData("\x27\x14", 2);
|
||||
prepDataAndSend(payload);
|
||||
}
|
||||
|
||||
void rigCommander::getScopeEdge()
|
||||
{
|
||||
QByteArray payload;
|
||||
payload.setRawData("\x27\x16", 2);
|
||||
prepDataAndSend(payload);
|
||||
}
|
||||
|
||||
void rigCommander::setScopeEdge(char edge)
|
||||
{
|
||||
// 1 2 or 3
|
||||
|
@ -131,6 +146,13 @@ void rigCommander::setScopeEdge(char edge)
|
|||
prepDataAndSend(payload);
|
||||
}
|
||||
|
||||
void rigCommander::getScopeSpan()
|
||||
{
|
||||
QByteArray payload;
|
||||
payload.setRawData("\x27\x15", 2);
|
||||
prepDataAndSend(payload);
|
||||
}
|
||||
|
||||
void rigCommander::setScopeSpan(char span)
|
||||
{
|
||||
// See ICD, page 165, "19-12".
|
||||
|
@ -178,7 +200,7 @@ void rigCommander::setScopeSpan(char span)
|
|||
|
||||
payload.append( makeFreqPayload(freq));
|
||||
payload.append("\x00");
|
||||
printHex(payload, false, true);
|
||||
// printHex(payload, false, true);
|
||||
prepDataAndSend(payload);
|
||||
}
|
||||
|
||||
|
@ -194,6 +216,13 @@ void rigCommander::setSpectrumCenteredMode(bool centerEnable)
|
|||
prepDataAndSend(specModePayload);
|
||||
}
|
||||
|
||||
void rigCommander::getSpectrumCenterMode()
|
||||
{
|
||||
QByteArray specModePayload;
|
||||
specModePayload.setRawData("\x27\x14", 2);
|
||||
prepDataAndSend(specModePayload);
|
||||
}
|
||||
|
||||
void rigCommander::setFrequency(double freq)
|
||||
{
|
||||
QByteArray freqPayload = makeFreqPayload(freq);
|
||||
|
@ -502,7 +531,8 @@ void rigCommander::parseCommand()
|
|||
// scope data
|
||||
//qDebug() << "Have scope data";
|
||||
//printHex(payloadIn, false, true);
|
||||
parseSpectrum();
|
||||
parseWFData();
|
||||
//parseSpectrum();
|
||||
break;
|
||||
case '\x1A':
|
||||
if(payloadIn[01] == '\x05')
|
||||
|
@ -737,6 +767,61 @@ void rigCommander::parseDetailedRegisters1A05()
|
|||
// It seems a lot of misc stuff is under this command and subcommand.
|
||||
}
|
||||
|
||||
void rigCommander::parseWFData()
|
||||
{
|
||||
float freqSpan = 0.0;
|
||||
|
||||
switch(payloadIn[1])
|
||||
{
|
||||
case 0:
|
||||
// Chunk of spectrum
|
||||
parseSpectrum();
|
||||
break;
|
||||
case 0x10:
|
||||
// confirming scope is on
|
||||
break;
|
||||
case 0x11:
|
||||
// confirming output enabled/disabled of wf data.
|
||||
break;
|
||||
case 0x14:
|
||||
// fixed or center
|
||||
emit haveSpectrumFixedMode((bool)payloadIn[2]);
|
||||
qDebug() << "received 0x14 command fix/center";
|
||||
printHex(payloadIn, false, true);
|
||||
// [1] 0x14
|
||||
// [2] 0x00 (center), 0x01 (fixed)
|
||||
break;
|
||||
case 0x15:
|
||||
// read span in center mode
|
||||
// [1] 0x15
|
||||
// [2] to [8] is span encoded as a frequency
|
||||
freqSpan = parseFrequency(payloadIn, 8);
|
||||
qDebug() << "Received 0x15 center span data: for frequency " << freqSpan;
|
||||
printHex(payloadIn, false, true);
|
||||
break;
|
||||
case 0x16:
|
||||
// read edge mode center in edge mode
|
||||
emit haveScopeEdge((char)payloadIn[2]);
|
||||
qDebug() << "Received 0x16 edge in center mode:";
|
||||
printHex(payloadIn, false, true);
|
||||
// [1] 0x16
|
||||
// [2] 0x01, 0x02, 0x03: Edge 1,2,3
|
||||
break;
|
||||
case 0x19:
|
||||
// scope reference level
|
||||
// [1] 0x19
|
||||
// [2] 0x00
|
||||
// [3] 10dB digit, 1dB digit
|
||||
// [4] 0.1dB digit, 0
|
||||
// [5] 0x00 = +, 0x01 = -
|
||||
break;
|
||||
default:
|
||||
qDebug() << "Unknown waveform data received: ";
|
||||
printHex(payloadIn, false, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void rigCommander::parseSpectrum()
|
||||
{
|
||||
// Here is what to expect:
|
||||
|
|
|
@ -31,8 +31,12 @@ public slots:
|
|||
void disableSpectrumDisplay();
|
||||
void setSpectrumBounds();
|
||||
void setSpectrumCenteredMode(bool centerEnable); // centered or band-wise
|
||||
void getSpectrumCenterMode();
|
||||
void setScopeSpan(char span);
|
||||
void getScopeSpan();
|
||||
void setScopeEdge(char edge);
|
||||
void getScopeEdge();
|
||||
void getScopeMode();
|
||||
void setFrequency(double freq);
|
||||
void setMode(char mode);
|
||||
void getFrequency();
|
||||
|
@ -62,6 +66,9 @@ signals:
|
|||
void haveDataMode(bool dataModeEnabled);
|
||||
void haveBandStackReg(float freq, char mode, bool dataOn);
|
||||
void haveSpectrumBounds();
|
||||
void haveScopeSpan(char span);
|
||||
void haveSpectrumFixedMode(bool fixedEnabled);
|
||||
void haveScopeEdge(char edge);
|
||||
void haveRfGain(unsigned char level);
|
||||
void haveAfGain(unsigned char level);
|
||||
void haveSql(unsigned char level);
|
||||
|
@ -83,6 +90,7 @@ private:
|
|||
QByteArray makeFreqPayload(double frequency);
|
||||
void parseMode();
|
||||
void parseSpectrum();
|
||||
void parseWFData();
|
||||
void parseDetailedRegisters1A05();
|
||||
void parseRegisters1A();
|
||||
void parseBandStackReg();
|
||||
|
|
24
wfmain.cpp
24
wfmain.cpp
|
@ -40,7 +40,6 @@ wfmain::wfmain(QWidget *parent) :
|
|||
setDefPrefs(); // other default options
|
||||
loadSettings(); // Look for saved preferences
|
||||
|
||||
prefs.serialPortRadio = QString("auto");
|
||||
// if setting for serial port is "auto" then...
|
||||
if(prefs.serialPortRadio == QString("auto"))
|
||||
{
|
||||
|
@ -124,6 +123,7 @@ wfmain::wfmain(QWidget *parent) :
|
|||
connect(rig, SIGNAL(havePTTStatus(bool)), this, SLOT(receivePTTstatus(bool)));
|
||||
connect(rig, SIGNAL(haveBandStackReg(float,char,bool)), this, SLOT(receiveBandStackReg(float,char,bool)));
|
||||
connect(this, SIGNAL(getDebug()), rig, SLOT(getDebug()));
|
||||
|
||||
connect(this, SIGNAL(spectOutputDisable()), rig, SLOT(disableSpectOutput()));
|
||||
connect(this, SIGNAL(spectOutputEnable()), rig, SLOT(enableSpectOutput()));
|
||||
connect(this, SIGNAL(scopeDisplayDisable()), rig, SLOT(disableSpectrumDisplay()));
|
||||
|
@ -135,6 +135,10 @@ wfmain::wfmain(QWidget *parent) :
|
|||
connect(this, SIGNAL(setScopeCenterMode(bool)), rig, SLOT(setSpectrumCenteredMode(bool)));
|
||||
connect(this, SIGNAL(setScopeEdge(char)), rig, SLOT(setScopeEdge(char)));
|
||||
connect(this, SIGNAL(setScopeSpan(char)), rig, SLOT(setScopeSpan(char)));
|
||||
connect(this, SIGNAL(getScopeMode()), rig, SLOT(getScopeMode()));
|
||||
connect(this, SIGNAL(getScopeEdge()), rig, SLOT(getScopeEdge()));
|
||||
connect(this, SIGNAL(getScopeSpan()), rig, SLOT(getScopeSpan()));
|
||||
|
||||
connect(this, SIGNAL(setMode(char)), rig, SLOT(setMode(char)));
|
||||
connect(this, SIGNAL(getRfGain()), rig, SLOT(getRfGain()));
|
||||
connect(this, SIGNAL(getAfGain()), rig, SLOT(getAfGain()));
|
||||
|
@ -246,9 +250,7 @@ void wfmain::loadSettings()
|
|||
|
||||
// Radio and Comms: C-IV addr, port to use
|
||||
settings.beginGroup("Radio");
|
||||
// TODO: Fix this
|
||||
prefs.radioCIVAddr = (unsigned char) settings.value("RigCIVuInt", defPrefs.radioCIVAddr).toChar().toLatin1();
|
||||
|
||||
prefs.radioCIVAddr = (unsigned char) settings.value("RigCIVuInt", defPrefs.radioCIVAddr).toInt();
|
||||
prefs.serialPortRadio = settings.value("SerialPortRadio", defPrefs.serialPortRadio).toString();
|
||||
settings.endGroup();
|
||||
|
||||
|
@ -871,7 +873,7 @@ void wfmain::receiveMode(QString mode)
|
|||
int index;
|
||||
//bool ok;
|
||||
index = modes.indexOf(QRegExp(mode)); // find the number corresponding to the mode
|
||||
qDebug() << "Received mode " << mode << " current mode: " << currentModeIndex << " search index: " << index;
|
||||
// qDebug() << "Received mode " << mode << " current mode: " << currentModeIndex << " search index: " << index;
|
||||
if( currentModeIndex == index)
|
||||
{
|
||||
// do nothing, no need to change the selected mode and fire more events off.
|
||||
|
@ -1424,10 +1426,9 @@ void wfmain::receiveSql(unsigned char level)
|
|||
{
|
||||
// qDebug() << "Receive SQL level of " << (int)level << " = " << 100*level/255.0 << "%";
|
||||
// ui->sqlSlider->setValue(level); // No SQL control so far
|
||||
(void)level;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void wfmain::on_drawTracerChk_toggled(bool checked)
|
||||
{
|
||||
tracer->setVisible(checked);
|
||||
|
@ -1482,4 +1483,11 @@ void wfmain::on_saveSettingsBtn_clicked()
|
|||
saveSettings(); // save memory, UI, and radio settings
|
||||
}
|
||||
|
||||
|
||||
// --- DEBUG FUNCTION ---
|
||||
void wfmain::on_debugBtn_clicked()
|
||||
{
|
||||
// TODO: Remove function on release build
|
||||
// emit getScopeMode();
|
||||
// emit getScopeEdge();
|
||||
// emit getScopeSpan();
|
||||
}
|
||||
|
|
5
wfmain.h
5
wfmain.h
|
@ -54,6 +54,9 @@ signals:
|
|||
void setScopeCenterMode(bool centerEnable);
|
||||
void setScopeSpan(char span);
|
||||
void setScopeEdge(char edge);
|
||||
void getScopeMode();
|
||||
void getScopeEdge();
|
||||
void getScopeSpan();
|
||||
|
||||
private slots:
|
||||
void shortcutF11();
|
||||
|
@ -187,6 +190,8 @@ private slots:
|
|||
void on_saveSettingsBtn_clicked();
|
||||
|
||||
|
||||
void on_debugBtn_clicked();
|
||||
|
||||
private:
|
||||
Ui::wfmain *ui;
|
||||
QSettings settings;
|
||||
|
|
11
wfmain.ui
11
wfmain.ui
|
@ -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">
|
||||
|
@ -1228,6 +1228,13 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="debugBtn">
|
||||
<property name="text">
|
||||
<string>Debug</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<property name="orientation">
|
||||
|
@ -1316,7 +1323,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>630</width>
|
||||
<height>26</height>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
|
|
Ładowanie…
Reference in New Issue