Porównaj commity

...

13 Commity

Autor SHA1 Wiadomość Data
Phil Taylor f710913950 Debugging and error checking 2024-01-29 18:40:29 +00:00
Phil Taylor de5e00dfcb Try queued connection 2024-01-29 18:31:22 +00:00
Phil Taylor c3a908d4c3 Fix warning 2024-01-29 18:18:45 +00:00
Phil Taylor f4cad49aee Do scope in different way 2024-01-29 18:16:39 +00:00
Phil Taylor 3a63f6ba52 Update wfmain.cpp 2024-01-29 16:13:34 +00:00
Phil Taylor 75ba003f1d Update wfmain.cpp 2024-01-29 16:09:03 +00:00
Phil Taylor f5ee932500 Update wfmain.cpp 2024-01-29 16:06:31 +00:00
Phil Taylor 3ecc0080e6 Update rigcommander.cpp 2024-01-29 14:52:30 +00:00
Phil Taylor 35c97be0e0 Update rigcommander.cpp 2024-01-29 14:47:40 +00:00
Phil Taylor ea43618591 Remove bool toggle 2024-01-29 14:44:30 +00:00
Phil Taylor 291a88d880 Not sure where the crash is happening yet 2024-01-29 14:40:06 +00:00
Phil Taylor d643dd036e More fixes 2024-01-29 14:20:31 +00:00
Phil Taylor 374affe0d2 Try to fix linux crash 2024-01-29 10:43:41 +00:00
8 zmienionych plików z 271 dodań i 221 usunięć

Wyświetl plik

@ -294,6 +294,7 @@ void dxClusterClient::updateSpots()
spots.append(s); spots.append(s);
} }
#else #else
// Iterate through all available VFO frequency ranges and send all relevant spots.
QMap<uchar, rangeValues>::iterator range = freqRanges.begin(); QMap<uchar, rangeValues>::iterator range = freqRanges.begin();
while (range != freqRanges.end()) while (range != freqRanges.end())
{ {

Wyświetl plik

@ -141,7 +141,7 @@ QString debugWindow::getValue(QVariant val)
else if(!strcmp(val.typeName(),"scopeData")) else if(!strcmp(val.typeName(),"scopeData"))
{ {
scopeData s = val.value<scopeData>(); scopeData s = val.value<scopeData>();
value = QString("(V:%0) %1").arg(s.mainSub).arg((s.valid?"Valid":"Invalid")); value = QString("(V:%0) %1").arg(s.vfo).arg((s.valid?"Valid":"Invalid"));
} }
else if (!strcmp(val.typeName(),"antennaInfo")) else if (!strcmp(val.typeName(),"antennaInfo"))
{ {

Wyświetl plik

@ -78,7 +78,7 @@ void loggingWindow::acceptLogText(QPair<QtMsgType,QString> text)
{ {
colour = "green"; colour = "green";
} }
ui->logTextDisplay->appendHtml(QString("<p><span style='color:%0'>%1</span></p>").arg(colour).arg(text.second)); ui->logTextDisplay->appendHtml(QString("<p><span style='color:%0'>%1</span></p>").arg(colour,text.second));
if(vertLogScroll->value() == vertLogScroll->maximum()) if(vertLogScroll->value() == vertLogScroll->maximum())
{ {
horizLogScroll->setValue(horizLogScroll->minimum()); horizLogScroll->setValue(horizLogScroll->minimum());

Wyświetl plik

@ -320,7 +320,7 @@ void rigCommander::prepDataAndSend(QByteArray data)
emit dataForComm(data); emit dataForComm(data);
} }
bool rigCommander::getCommand(funcs func, QByteArray &payload, int value, bool sub) bool rigCommander::getCommand(funcs func, QByteArray &payload, int value, uchar vfo)
{ {
// Value is set to INT_MIN by default as this should be outside any "real" values // Value is set to INT_MIN by default as this should be outside any "real" values
auto it = rigCaps.commands.find(func); auto it = rigCaps.commands.find(func);
@ -336,12 +336,12 @@ bool rigCommander::getCommand(funcs func, QByteArray &payload, int value, bool s
{ {
// This can use cmd29 so add sub/main to the command // This can use cmd29 so add sub/main to the command
payload.append('\x29'); payload.append('\x29');
payload.append(static_cast<uchar>(sub)); payload.append(static_cast<uchar>(vfo));
} else if (!rigCaps.hasCommand29 && sub) } else if (!rigCaps.hasCommand29 && vfo)
{ {
// We don't have command29 so can't select sub // We don't have command29 so can't select sub
qInfo(logRig()) << "Rig has no Command29, removing command:" << funcString[func] << "sub" << sub; qInfo(logRig()) << "Rig has no Command29, removing command:" << funcString[func] << "VFO" << vfo;
queue->del(func,sub); queue->del(func,vfo);
return false; return false;
} }
payload.append(it.value().data); payload.append(it.value().data);
@ -353,8 +353,8 @@ bool rigCommander::getCommand(funcs func, QByteArray &payload, int value, bool s
} }
} else { } else {
// Don't try this command again as the rig doesn't support it! // Don't try this command again as the rig doesn't support it!
qInfo(logRig()) << "Removing unsupported command from queue" << funcString[func] << "sub" << sub; qInfo(logRig()) << "Removing unsupported command from queue" << funcString[func] << "VFO" << vfo;
queue->del(func,sub); queue->del(func,vfo);
} }
return false; return false;
} }
@ -704,7 +704,7 @@ void rigCommander::parseCommand()
#endif #endif
funcs func = funcNone; funcs func = funcNone;
bool sub = false; uchar vfo = 0;
if (payloadIn.endsWith((char)0xfd)) if (payloadIn.endsWith((char)0xfd))
{ {
@ -713,7 +713,7 @@ void rigCommander::parseCommand()
if (rigCaps.hasCommand29 && payloadIn[0] == '\x29') if (rigCaps.hasCommand29 && payloadIn[0] == '\x29')
{ {
sub = static_cast<bool>(payloadIn[1]); vfo = static_cast<uchar>(payloadIn[1]);
payloadIn.remove(0,2); payloadIn.remove(0,2);
} }
@ -754,7 +754,7 @@ void rigCommander::parseCommand()
case funcFreqTR: case funcFreqTR:
case funcReadTXFreq: case funcReadTXFreq:
{ {
value.setValue(parseFreqData(payloadIn,sub)); value.setValue(parseFreqData(payloadIn,vfo));
break; break;
} }
case funcVFODualWatch: case funcVFODualWatch:
@ -765,18 +765,18 @@ void rigCommander::parseCommand()
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough" #pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
#endif #endif
case funcUnselectedFreq: case funcUnselectedFreq:
sub = true; vfo = 1;
case funcSelectedFreq: case funcSelectedFreq:
{ {
//qInfo(logRig()) << "Freq len:" << payloadIn.size() << "sub=" << sub << "data:" << payloadIn.toHex(' '); //qInfo(logRig()) << "Freq len:" << payloadIn.size() << "VFO=" << vfo << "data:" << payloadIn.toHex(' ');
value.setValue(parseFreqData(payloadIn,sub)); value.setValue(parseFreqData(payloadIn,vfo));
break; break;
} }
case funcModeGet: case funcModeGet:
case funcModeTR: case funcModeTR:
{ {
modeInfo m; modeInfo m;
m = parseMode(payloadIn[0], m.filter,sub); m = parseMode(payloadIn[0], m.filter,vfo);
if(payloadIn.size() > 1) if(payloadIn.size() > 1)
{ {
@ -788,14 +788,14 @@ void rigCommander::parseCommand()
break; break;
} }
case funcUnselectedMode: case funcUnselectedMode:
sub = true; vfo = 1;
case funcSelectedMode: case funcSelectedMode:
{ {
modeInfo m; modeInfo m;
// New format payload with mode+datamode+filter // New format payload with mode+datamode+filter
m = parseMode(bcdHexToUChar(payloadIn[0]), bcdHexToUChar(payloadIn[2]),sub); m = parseMode(bcdHexToUChar(payloadIn[0]), bcdHexToUChar(payloadIn[2]),vfo);
m.data = bcdHexToUChar(payloadIn[1]); m.data = bcdHexToUChar(payloadIn[1]);
m.VFO = selVFO_t(sub); m.VFO = selVFO_t(vfo);
value.setValue(m); value.setValue(m);
break; break;
} }
@ -831,7 +831,7 @@ void rigCommander::parseCommand()
case funcScanning: case funcScanning:
break; break;
case funcReadFreqOffset: case funcReadFreqOffset:
value.setValue(parseFreqData(payloadIn,sub)); value.setValue(parseFreqData(payloadIn,vfo));
break; break;
// These return a single byte that we convert to a uchar (0-99) // These return a single byte that we convert to a uchar (0-99)
case funcTuningStep: case funcTuningStep:
@ -967,7 +967,7 @@ void rigCommander::parseCommand()
if (rigCaps.modelID == 0xAC && bsr.band == 6) { if (rigCaps.modelID == 0xAC && bsr.band == 6) {
freqLen = 6; freqLen = 6;
} }
bsr.freq = parseFreqData(payloadIn.mid(2,freqLen),sub); bsr.freq = parseFreqData(payloadIn.mid(2,freqLen),vfo);
// The Band Stacking command returns the regCode in the position that VFO is expected. // The Band Stacking command returns the regCode in the position that VFO is expected.
// As BSR is always on the active VFO, just set that. // As BSR is always on the active VFO, just set that.
bsr.freq.VFO = selVFO_t::activeVFO; bsr.freq.VFO = selVFO_t::activeVFO;
@ -984,7 +984,7 @@ void rigCommander::parseCommand()
quint16 calc; quint16 calc;
quint8 pass = bcdHexToUChar((quint8)payloadIn[0]); quint8 pass = bcdHexToUChar((quint8)payloadIn[0]);
modeInfo m; modeInfo m;
m = queue->getCache((sub?funcUnselectedMode:funcSelectedMode),sub).value.value<modeInfo>(); m = queue->getCache((vfo?funcUnselectedMode:funcSelectedMode),vfo).value.value<modeInfo>();
if (m.mk == modeAM) if (m.mk == modeAM)
{ {
@ -998,16 +998,16 @@ void rigCommander::parseCommand()
calc = 600 + ((pass - 10) * 100); calc = 600 + ((pass - 10) * 100);
} }
value.setValue(calc); value.setValue(calc);
//qInfo() << "Got filter width" << calc << "sub" << sub; //qInfo() << "Got filter width" << calc << "VFO" << vfo;
break; break;
} }
case funcDataModeWithFilter: case funcDataModeWithFilter:
{ {
modeInfo m; modeInfo m;
// New format payload with mode+datamode+filter // New format payload with mode+datamode+filter
m = parseMode(uchar(payloadIn[0]), uchar(payloadIn[2]),sub); m = parseMode(uchar(payloadIn[0]), uchar(payloadIn[2]),vfo);
m.data = uchar(payloadIn[1]); m.data = uchar(payloadIn[1]);
m.VFO = selVFO_t(sub & 0x01); m.VFO = selVFO_t(vfo & 0x01);
value.setValue(m); value.setValue(m);
break; break;
} }
@ -1080,7 +1080,7 @@ void rigCommander::parseCommand()
case funcScopeMainWaveData: case funcScopeMainWaveData:
{ {
scopeData d; scopeData d;
if (parseSpectrum(d,sub)) if (parseSpectrum(d,vfo))
value.setValue(d); value.setValue(d);
break; break;
} }
@ -1092,6 +1092,7 @@ void rigCommander::parseCommand()
// This tells us whether we are receiving main or sub data // This tells us whether we are receiving main or sub data
case funcScopeSingleDual: case funcScopeSingleDual:
// This tells us whether we are receiving single or dual scopes // This tells us whether we are receiving single or dual scopes
qInfo(logRig()) << "funcScopeSingleDual" << static_cast<bool>(payloadIn[0]);
value.setValue(static_cast<bool>(payloadIn[0])); value.setValue(static_cast<bool>(payloadIn[0]));
break; break;
#if defined __GNUC__ #if defined __GNUC__
@ -1099,7 +1100,7 @@ void rigCommander::parseCommand()
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough" #pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
#endif #endif
case funcScopeSubMode: case funcScopeSubMode:
sub=true; vfo=1;
case funcScopeMainMode: case funcScopeMainMode:
// fixed or center // fixed or center
// [1] 0x14 // [1] 0x14
@ -1108,7 +1109,7 @@ void rigCommander::parseCommand()
value.setValue(static_cast<spectrumMode_t>(uchar(payloadIn[0]))); value.setValue(static_cast<spectrumMode_t>(uchar(payloadIn[0])));
break; break;
case funcScopeSubSpan: case funcScopeSubSpan:
sub=true; vfo=1;
case funcScopeMainSpan: case funcScopeMainSpan:
{ {
freqt f = parseFrequency(payloadIn, 3); freqt f = parseFrequency(payloadIn, 3);
@ -1122,7 +1123,7 @@ void rigCommander::parseCommand()
break; break;
} }
case funcScopeSubEdge: case funcScopeSubEdge:
sub=true; vfo=1;
case funcScopeMainEdge: case funcScopeMainEdge:
// read edge mode center in edge mode // read edge mode center in edge mode
// [1] 0x16 // [1] 0x16
@ -1131,12 +1132,12 @@ void rigCommander::parseCommand()
//emit haveScopeEdge((char)payloadIn[2]); //emit haveScopeEdge((char)payloadIn[2]);
break; break;
case funcScopeSubHold: case funcScopeSubHold:
sub=true; vfo=1;
case funcScopeMainHold: case funcScopeMainHold:
value.setValue(static_cast<bool>(payloadIn[0])); value.setValue(static_cast<bool>(payloadIn[0]));
break; break;
case funcScopeSubRef: case funcScopeSubRef:
sub=true; vfo=1;
case funcScopeMainRef: case funcScopeMainRef:
{ {
// scope reference level // scope reference level
@ -1155,16 +1156,16 @@ void rigCommander::parseCommand()
break; break;
} }
case funcScopeSubSpeed: case funcScopeSubSpeed:
sub=true; vfo=1;
case funcScopeMainSpeed: case funcScopeMainSpeed:
value.setValue(static_cast<uchar>(payloadIn[0])); value.setValue(static_cast<uchar>(payloadIn[0]));
break; break;
case funcScopeSubVBW: case funcScopeSubVBW:
sub=true; vfo=1;
case funcScopeMainVBW: case funcScopeMainVBW:
break; break;
case funcScopeSubRBW: case funcScopeSubRBW:
sub=true; vfo=1;
case funcScopeMainRBW: case funcScopeMainRBW:
break; break;
#if defined __GNUC__ #if defined __GNUC__
@ -1230,7 +1231,7 @@ void rigCommander::parseCommand()
#endif #endif
if (value.isValid() && queue != Q_NULLPTR) { if (value.isValid() && queue != Q_NULLPTR) {
queue->receiveValue(func,value,sub); queue->receiveValue(func,value,vfo);
} }
} }
@ -1534,7 +1535,7 @@ void rigCommander::determineRigCaps()
} }
} }
bool rigCommander::parseSpectrum(scopeData& d, bool sub) bool rigCommander::parseSpectrum(scopeData& d, uchar vfo)
{ {
bool ret = false; bool ret = false;
@ -1550,7 +1551,7 @@ bool rigCommander::parseSpectrum(scopeData& d, bool sub)
return ret; return ret;
} }
if (sub) if (vfo)
d = subScopeData; d = subScopeData;
else else
d = mainScopeData; d = mainScopeData;
@ -1590,7 +1591,7 @@ bool rigCommander::parseSpectrum(scopeData& d, bool sub)
freqt fStart; freqt fStart;
freqt fEnd; freqt fEnd;
d.mainSub = sub; d.vfo = vfo;
unsigned char sequence = bcdHexToUChar(payloadIn[0]); unsigned char sequence = bcdHexToUChar(payloadIn[0]);
unsigned char sequenceMax = bcdHexToUChar(payloadIn[1]); unsigned char sequenceMax = bcdHexToUChar(payloadIn[1]);
@ -1652,9 +1653,9 @@ bool rigCommander::parseSpectrum(scopeData& d, bool sub)
d.data.clear(); d.data.clear();
// For Fixed, and both scroll modes, the following produces correct information: // For Fixed, and both scroll modes, the following produces correct information:
fStart = parseFreqData(payloadIn.mid(3,freqLen),sub); fStart = parseFreqData(payloadIn.mid(3,freqLen),vfo);
d.startFreq = fStart.MHzDouble; d.startFreq = fStart.MHzDouble;
fEnd = parseFreqData(payloadIn.mid(3+freqLen,freqLen),sub); fEnd = parseFreqData(payloadIn.mid(3+freqLen,freqLen),vfo);
d.endFreq = fEnd.MHzDouble; d.endFreq = fEnd.MHzDouble;
if(d.mode == spectModeCenter) if(d.mode == spectModeCenter)
@ -1690,7 +1691,7 @@ bool rigCommander::parseSpectrum(scopeData& d, bool sub)
if (!ret) { if (!ret) {
// We need to temporarilly store the scope data somewhere. // We need to temporarilly store the scope data somewhere.
if (sub) if (vfo)
subScopeData = d; subScopeData = d;
else else
mainScopeData = d; mainScopeData = d;
@ -1925,12 +1926,12 @@ freqt rigCommander::parseFrequency(QByteArray data, unsigned char lastPosition)
} }
freqt rigCommander::parseFreqData(QByteArray data, bool sub) freqt rigCommander::parseFreqData(QByteArray data, uchar vfo)
{ {
freqt freq; freqt freq;
freq.Hz = parseFreqDataToInt(data); freq.Hz = parseFreqDataToInt(data);
freq.MHzDouble = freq.Hz/1000000.0; freq.MHzDouble = freq.Hz/1000000.0;
freq.VFO = selVFO_t(sub); freq.VFO = selVFO_t(vfo);
return freq; return freq;
} }
@ -1950,7 +1951,7 @@ quint64 rigCommander::parseFreqDataToInt(QByteArray data)
} }
modeInfo rigCommander::parseMode(quint8 mode, quint8 filter, bool sub) modeInfo rigCommander::parseMode(quint8 mode, quint8 filter, uchar vfo)
{ {
modeInfo mi; modeInfo mi;
bool found=false; bool found=false;
@ -1971,13 +1972,13 @@ modeInfo rigCommander::parseMode(quint8 mode, quint8 filter, bool sub)
// We cannot query sub VFO width without command29. // We cannot query sub VFO width without command29.
if (!rigCaps.hasCommand29) if (!rigCaps.hasCommand29)
sub = false; vfo = 0;
cacheItem item; cacheItem item;
// Does the current mode support filterwidth? // Does the current mode support filterwidth?
if (mi.bwMin >0 && mi.bwMax > 0) { if (mi.bwMin >0 && mi.bwMax > 0) {
queue->getCache(funcFilterWidth,sub); queue->getCache(funcFilterWidth,vfo);
} }
if (item.value.isValid()) { if (item.value.isValid()) {
@ -2362,10 +2363,10 @@ quint8* rigCommander::getGUID() {
return guid; return guid;
} }
uchar rigCommander::makeFilterWidth(ushort pass,bool sub) uchar rigCommander::makeFilterWidth(ushort pass,uchar vfo)
{ {
unsigned char calc; unsigned char calc;
modeInfo mi = queue->getCache((sub?funcUnselectedMode:funcSelectedMode),sub).value.value<modeInfo>(); modeInfo mi = queue->getCache((vfo==1?funcUnselectedMode:funcSelectedMode),vfo).value.value<modeInfo>();
if (mi.mk == modeAM) { // AM 0-49 if (mi.mk == modeAM) { // AM 0-49
calc = quint16((pass / 200) - 1); calc = quint16((pass / 200) - 1);
@ -2439,8 +2440,8 @@ void rigCommander::receiveCommand(funcs func, QVariant value, uchar vfo)
func = funcModeGet; func = funcModeGet;
} else if (func == funcSelectVFO) { } else if (func == funcSelectVFO) {
// Special command // Special command
vfo_t vfo = value.value<vfo_t>(); vfo_t v = value.value<vfo_t>();
func = (vfo == vfoA)?funcVFOASelect:(vfo == vfoB)?funcVFOBSelect:(vfo == vfoMain)?funcVFOMainSelect:funcVFOSubSelect; func = (v == vfoA)?funcVFOASelect:(v == vfoB)?funcVFOBSelect:(v == vfoMain)?funcVFOMainSelect:funcVFOSubSelect;
value.clear(); value.clear();
val = INT_MIN; val = INT_MIN;
} }

Wyświetl plik

@ -139,7 +139,7 @@ private:
freqt parseFrequency(); freqt parseFrequency();
freqt parseFrequency(QByteArray data, unsigned char lastPosition); // supply index where Mhz is found freqt parseFrequency(QByteArray data, unsigned char lastPosition); // supply index where Mhz is found
freqt parseFreqData(QByteArray data, bool sub); freqt parseFreqData(QByteArray data, uchar vfo);
quint64 parseFreqDataToInt(QByteArray data); quint64 parseFreqDataToInt(QByteArray data);
freqt parseFrequencyRptOffset(QByteArray data); freqt parseFrequencyRptOffset(QByteArray data);
bool parseMemory(QVector<memParserFormat>* memParser, memoryType* mem); bool parseMemory(QVector<memParserFormat>* memParser, memoryType* mem);
@ -151,7 +151,7 @@ private:
toneInfo decodeTone(QByteArray eTone); toneInfo decodeTone(QByteArray eTone);
//quint16 decodeTone(QByteArray eTone, bool &tinv, bool &rinv); //quint16 decodeTone(QByteArray eTone, bool &tinv, bool &rinv);
uchar makeFilterWidth(ushort width, bool sub); uchar makeFilterWidth(ushort width, uchar vfo);
unsigned char audioLevelRxMean[50]; unsigned char audioLevelRxMean[50];
@ -159,9 +159,9 @@ private:
unsigned char audioLevelTxMean[50]; unsigned char audioLevelTxMean[50];
unsigned char audioLevelTxPeak[50]; unsigned char audioLevelTxPeak[50];
modeInfo parseMode(quint8 mode, quint8 filter, bool sub); modeInfo parseMode(quint8 mode, quint8 filter, uchar vfo);
bool parseSpectrum(scopeData& d, bool sub); bool parseSpectrum(scopeData& d, uchar vfo);
bool getCommand(funcs func, QByteArray& payload, int value=INT_MIN, bool sub=false); bool getCommand(funcs func, QByteArray& payload, int value=INT_MIN, uchar vfo=0);
QByteArray getLANAddr(); QByteArray getLANAddr();
QByteArray getUSBAddr(); QByteArray getUSBAddr();

Wyświetl plik

@ -967,7 +967,13 @@ void wfmain::setServerToPrefs()
void wfmain::configureVFOs() void wfmain::configureVFOs()
{ {
qCritical(logSystem()) << "Running configureVFOs()"; qInfo(logSystem()) << "Running configureVFOs()";
if (QThread::currentThread() != QCoreApplication::instance()->thread())
{
qCritical(logSystem()) << "Thread is NOT the main UI thread, cannot create VFO";
return;
}
if (vfos.size()) { if (vfos.size()) {
foreach (spectrumScope* vfo, vfos) foreach (spectrumScope* vfo, vfos)
@ -980,38 +986,39 @@ void wfmain::configureVFOs()
for(uchar i=0;i<rigCaps.numVFO;i++) for(uchar i=0;i<rigCaps.numVFO;i++)
{ {
qCritical(logSystem()) << "Creating VFO" << i; spectrumScope* vfo = new spectrumScope;
vfos.append(new spectrumScope(this));
vfos.last()->setUnderlayMode(prefs.underlayMode); vfo->setUnderlayMode(prefs.underlayMode);
vfos.last()->wfAntiAliased(prefs.wfAntiAlias); vfo->wfAntiAliased(prefs.wfAntiAlias);
vfos.last()->wfInterpolate(prefs.wfInterpolate); vfo->wfInterpolate(prefs.wfInterpolate);
vfos.last()->setScrollSpeedXY(prefs.scopeScrollX, prefs.scopeScrollY); vfo->setScrollSpeedXY(prefs.scopeScrollX, prefs.scopeScrollY);
vfos.last()->prepareWf(i==0?prefs.mainWflength:prefs.subWflength); vfo->prepareWf(i==0?prefs.mainWflength:prefs.subWflength);
vfos.last()->preparePlasma(); vfo->preparePlasma();
vfos.last()->setRange(i==0?prefs.mainPlotFloor:prefs.subPlotFloor,i==0?prefs.mainPlotCeiling:prefs.subPlotCeiling); vfo->setRange(i==0?prefs.mainPlotFloor:prefs.subPlotFloor,i==0?prefs.mainPlotCeiling:prefs.subPlotCeiling);
vfos.last()->wfTheme(i==0?prefs.mainWfTheme:prefs.subWfTheme); vfo->wfTheme(i==0?prefs.mainWfTheme:prefs.subWfTheme);
vfos.last()->setClickDragTuning(prefs.clickDragTuningEnable); vfo->setClickDragTuning(prefs.clickDragTuningEnable);
vfos.last()->setTuningFloorZeros(prefs.niceTS); vfo->setTuningFloorZeros(prefs.niceTS);
vfos.last()->resizePlasmaBuffer(prefs.underlayBufferSize); vfo->resizePlasmaBuffer(prefs.underlayBufferSize);
vfos.last()->setUnit((FctlUnit)prefs.frequencyUnits); vfo->setUnit((FctlUnit)prefs.frequencyUnits);
vfos.last()->colorPreset(this->colorPrefs); vfo->colorPreset(this->colorPrefs);
vfo->setIdentity(i==0?"Main Band":"Sub Band",i);
ui->vfoLayout->addWidget(vfo);
// Hide any secondary VFOs until we need them! // Hide any secondary VFOs until we need them!
if (i>0){ if (i>0){
vfos.last()->setVisible(false); vfo->setVisible(false);
} }
ui->vfoLayout->addWidget(vfos.last());
connect(vfos.last(), SIGNAL(frequencyRange(uchar, double, double)), cluster, SLOT(freqRange(uchar, double, double))); connect(vfo, SIGNAL(frequencyRange(uchar, double, double)), cluster, SLOT(freqRange(uchar, double, double)));
connect(cluster, SIGNAL(sendSpots(uchar, QList<spotData>)), vfos.last(), SLOT(receiveSpots(uchar, QList<spotData>))); connect(cluster, SIGNAL(sendSpots(uchar, QList<spotData>)), vfo, SLOT(receiveSpots(uchar, QList<spotData>)));
connect(cluster, SIGNAL(sendOutput(QString)), this, SLOT(receiveClusterOutput(QString))); connect(cluster, SIGNAL(sendOutput(QString)), this, SLOT(receiveClusterOutput(QString)));
connect(vfos.last(), SIGNAL(updateSettings(uchar,int,quint16,int,int)), this, SLOT(receiveScopeSettings(uchar,int,quint16,int,int))); connect(vfo, SIGNAL(updateSettings(uchar,int,quint16,int,int)), this, SLOT(receiveScopeSettings(uchar,int,quint16,int,int)));
connect(vfos.last(), SIGNAL(dataChanged(modeInfo)), this, SLOT(dataModeChanged(modeInfo))); connect(vfo, SIGNAL(dataChanged(modeInfo)), this, SLOT(dataModeChanged(modeInfo)));
vfos.last()->setIdentity(i==0?"Main Band":"Sub Band",i);
connect(vfos.last(),SIGNAL(showStatusBarText(QString)),this,SLOT(showStatusBarText(QString))); connect(vfo,SIGNAL(showStatusBarText(QString)),this,SLOT(showStatusBarText(QString)));
vfos.append(vfo);
} }
} }
@ -1199,11 +1206,12 @@ void wfmain::setupKeyShortcuts()
[=]() { [=]() {
if (freqLock) return; if (freqLock) return;
freqt f; if (vfos.size()) {
if (vfos.size()) freqt f;
f.Hz = roundFrequencyWithStep(vfos.first()->getFrequency().Hz, -1, tsKnobHz); f.Hz = roundFrequencyWithStep(vfos.first()->getFrequency().Hz, -1, tsKnobHz);
f.MHzDouble = f.Hz / (double)1E6; f.MHzDouble = f.Hz / (double)1E6;
queue->add(priorityImmediate,queueItem(funcSelectedFreq,QVariant::fromValue<freqt>(f))); queue->add(priorityImmediate,queueItem(funcSelectedFreq,QVariant::fromValue<freqt>(f)));
}
}); });
// L = Up // L = Up
@ -1214,10 +1222,11 @@ void wfmain::setupKeyShortcuts()
if (freqLock) return; if (freqLock) return;
freqt f; freqt f;
if (vfos.size()) if (vfos.size()) {
f.Hz = roundFrequencyWithStep(vfos.first()->getFrequency().Hz, 1, tsKnobHz); f.Hz = roundFrequencyWithStep(vfos.first()->getFrequency().Hz, 1, tsKnobHz);
f.MHzDouble = f.Hz / (double)1E6; f.MHzDouble = f.Hz / (double)1E6;
queue->add(priorityImmediate,queueItem(funcSelectedFreq,QVariant::fromValue<freqt>(f))); queue->add(priorityImmediate,queueItem(funcSelectedFreq,QVariant::fromValue<freqt>(f)));
}
}); });
keyDebug = new QShortcut(this); keyDebug = new QShortcut(this);
@ -1461,10 +1470,13 @@ void wfmain::stepDown()
void wfmain::changeFrequency(int value) { void wfmain::changeFrequency(int value) {
if (freqLock) return; if (freqLock) return;
freqt f; if (vfos.size())
f.Hz = roundFrequencyWithStep(vfos[0]->getFrequency().Hz, value, tsWfScrollHz); {
f.MHzDouble = f.Hz / (double)1E6; freqt f;
queue->add(priorityImmediate,queueItem(funcSelectedFreq,QVariant::fromValue<freqt>(f),false)); f.Hz = roundFrequencyWithStep(vfos[0]->getFrequency().Hz, value, tsWfScrollHz);
f.MHzDouble = f.Hz / (double)1E6;
queue->add(priorityImmediate,queueItem(funcSelectedFreq,QVariant::fromValue<freqt>(f),false));
}
} }
void wfmain::setDefPrefs() void wfmain::setDefPrefs()
@ -3221,104 +3233,116 @@ quint64 wfmain::roundFrequencyWithStep(quint64 frequency, int steps, unsigned in
void wfmain::shortcutMinus() void wfmain::shortcutMinus()
{ {
if (freqLock) return; if (freqLock) return;
if (vfos.size()) {
freqt f; freqt f;
f.Hz = roundFrequencyWithStep(vfos[0]->getFrequency().Hz, -1, tsPlusHz); f.Hz = roundFrequencyWithStep(vfos[0]->getFrequency().Hz, -1, tsPlusHz);
f.MHzDouble = f.Hz / (double)1E6; f.MHzDouble = f.Hz / (double)1E6;
queue->add(priorityImmediate,queueItem(funcSelectedFreq,QVariant::fromValue<freqt>(f),false)); queue->add(priorityImmediate,queueItem(funcSelectedFreq,QVariant::fromValue<freqt>(f),false));
}
} }
void wfmain::shortcutPlus() void wfmain::shortcutPlus()
{ {
if (freqLock) return; if (freqLock) return;
freqt f; if (vfos.size()) {
f.Hz = roundFrequencyWithStep(vfos[0]->getFrequency().Hz, 1, tsPlusHz); freqt f;
f.MHzDouble = f.Hz / (double)1E6; f.Hz = roundFrequencyWithStep(vfos[0]->getFrequency().Hz, 1, tsPlusHz);
queue->add(priorityImmediate,queueItem(funcSelectedFreq,QVariant::fromValue<freqt>(f),false)); f.MHzDouble = f.Hz / (double)1E6;
queue->add(priorityImmediate,queueItem(funcSelectedFreq,QVariant::fromValue<freqt>(f),false));
}
} }
void wfmain::shortcutStepMinus() void wfmain::shortcutStepMinus()
{ {
if (freqLock) return; if (freqLock) return;
if (vfos.size())
freqt f; {
f.Hz = roundFrequencyWithStep(vfos[0]->getFrequency().Hz, -1, ui->tuningStepCombo->currentData().toInt()); freqt f;
f.MHzDouble = f.Hz / (double)1E6; f.Hz = roundFrequencyWithStep(vfos[0]->getFrequency().Hz, -1, ui->tuningStepCombo->currentData().toInt());
queue->add(priorityImmediate,queueItem(funcSelectedFreq,QVariant::fromValue<freqt>(f),false)); f.MHzDouble = f.Hz / (double)1E6;
queue->add(priorityImmediate,queueItem(funcSelectedFreq,QVariant::fromValue<freqt>(f),false));
}
} }
void wfmain::shortcutStepPlus() void wfmain::shortcutStepPlus()
{ {
if (freqLock) return; if (freqLock) return;
freqt f; if (vfos.size()) {
f.Hz = roundFrequencyWithStep(vfos[0]->getFrequency().Hz, 1, ui->tuningStepCombo->currentData().toInt()); freqt f;
f.Hz = roundFrequencyWithStep(vfos[0]->getFrequency().Hz, 1, ui->tuningStepCombo->currentData().toInt());
f.MHzDouble = f.Hz / (double)1E6; f.MHzDouble = f.Hz / (double)1E6;
queue->add(priorityImmediate,queueItem(funcSelectedFreq,QVariant::fromValue<freqt>(f),false)); queue->add(priorityImmediate,queueItem(funcSelectedFreq,QVariant::fromValue<freqt>(f),false));
}
} }
void wfmain::shortcutShiftMinus() void wfmain::shortcutShiftMinus()
{ {
if(freqLock) return; if(freqLock) return;
if (vfos.size()) {
freqt f; freqt f;
f.Hz = roundFrequencyWithStep(vfos[0]->getFrequency().Hz, -1, tsPlusShiftHz); f.Hz = roundFrequencyWithStep(vfos[0]->getFrequency().Hz, -1, tsPlusShiftHz);
f.MHzDouble = f.Hz / (double)1E6; f.MHzDouble = f.Hz / (double)1E6;
queue->add(priorityImmediate,queueItem(funcSelectedFreq,QVariant::fromValue<freqt>(f),false)); queue->add(priorityImmediate,queueItem(funcSelectedFreq,QVariant::fromValue<freqt>(f),false));
}
} }
void wfmain::shortcutShiftPlus() void wfmain::shortcutShiftPlus()
{ {
if(freqLock) return; if(freqLock) return;
if (vfos.size()) {
freqt f; freqt f;
f.Hz = roundFrequencyWithStep(vfos[0]->getFrequency().Hz, 1, tsPlusShiftHz); f.Hz = roundFrequencyWithStep(vfos[0]->getFrequency().Hz, 1, tsPlusShiftHz);
f.MHzDouble = f.Hz / (double)1E6; f.MHzDouble = f.Hz / (double)1E6;
queue->add(priorityImmediate,queueItem(funcSelectedFreq,QVariant::fromValue<freqt>(f),false)); queue->add(priorityImmediate,queueItem(funcSelectedFreq,QVariant::fromValue<freqt>(f),false));
}
} }
void wfmain::shortcutControlMinus() void wfmain::shortcutControlMinus()
{ {
if(freqLock) return; if(freqLock) return;
freqt f; if (vfos.size()) {
f.Hz = roundFrequencyWithStep(vfos[0]->getFrequency().Hz, -1, tsPlusControlHz); freqt f;
f.MHzDouble = f.Hz / (double)1E6; f.Hz = roundFrequencyWithStep(vfos[0]->getFrequency().Hz, -1, tsPlusControlHz);
queue->add(priorityImmediate,queueItem(funcSelectedFreq,QVariant::fromValue<freqt>(f),false)); f.MHzDouble = f.Hz / (double)1E6;
queue->add(priorityImmediate,queueItem(funcSelectedFreq,QVariant::fromValue<freqt>(f),false));
}
} }
void wfmain::shortcutControlPlus() void wfmain::shortcutControlPlus()
{ {
if(freqLock) return; if(freqLock) return;
if (vfos.size()) {
freqt f; freqt f;
f.Hz = roundFrequencyWithStep(vfos[0]->getFrequency().Hz, 1, tsPlusControlHz); f.Hz = roundFrequencyWithStep(vfos[0]->getFrequency().Hz, 1, tsPlusControlHz);
f.MHzDouble = f.Hz / (double)1E6; f.MHzDouble = f.Hz / (double)1E6;
queue->add(priorityImmediate,queueItem(funcSelectedFreq,QVariant::fromValue<freqt>(f),false)); queue->add(priorityImmediate,queueItem(funcSelectedFreq,QVariant::fromValue<freqt>(f),false));
}
} }
void wfmain::shortcutPageUp() void wfmain::shortcutPageUp()
{ {
if(freqLock) return; if(freqLock) return;
if (vfos.size()) {
freqt f; freqt f;
f.Hz = vfos[0]->getFrequency().Hz + tsPageHz; f.Hz = vfos[0]->getFrequency().Hz + tsPageHz;
f.MHzDouble = f.Hz / (double)1E6; f.MHzDouble = f.Hz / (double)1E6;
queue->add(priorityImmediate,queueItem(funcSelectedFreq,QVariant::fromValue<freqt>(f),false)); queue->add(priorityImmediate,queueItem(funcSelectedFreq,QVariant::fromValue<freqt>(f),false));
}
} }
void wfmain::shortcutPageDown() void wfmain::shortcutPageDown()
{ {
if(freqLock) return; if(freqLock) return;
if (vfos.size()) {
freqt f; freqt f;
f.Hz = vfos[0]->getFrequency().Hz - tsPageHz; f.Hz = vfos[0]->getFrequency().Hz - tsPageHz;
f.MHzDouble = f.Hz / (double)1E6; f.MHzDouble = f.Hz / (double)1E6;
queue->add(priorityImmediate,queueItem(funcSelectedFreq,QVariant::fromValue<freqt>(f),false)); queue->add(priorityImmediate,queueItem(funcSelectedFreq,QVariant::fromValue<freqt>(f),false));
}
} }
void wfmain::shortcutF() void wfmain::shortcutF()
@ -3417,7 +3441,7 @@ void wfmain:: getInitialRigState()
queue->add(priorityImmediate,funcMonitorGain,false); queue->add(priorityImmediate,funcMonitorGain,false);
*/ */
if(rigCaps.hasSpectrum) if(rigCaps.hasSpectrum && vfos.size())
{ {
queue->add(priorityImmediate,queueItem(funcScopeOnOff,QVariant::fromValue(quint8(1)),false)); queue->add(priorityImmediate,queueItem(funcScopeOnOff,QVariant::fromValue(quint8(1)),false));
queue->add(priorityImmediate,queueItem(funcScopeDataOutput,QVariant::fromValue(quint8(1)),false)); queue->add(priorityImmediate,queueItem(funcScopeDataOutput,QVariant::fromValue(quint8(1)),false));
@ -4061,19 +4085,20 @@ void wfmain::on_freqDial_valueChanged(int value)
// With the number of steps and direction of steps established, // With the number of steps and direction of steps established,
// we can now adjust the frequency: // we can now adjust the frequency:
if (vfos.size()) {
f.Hz = roundFrequencyWithStep(vfos[0]->getFrequency().Hz, delta, tsKnobHz); f.Hz = roundFrequencyWithStep(vfos[0]->getFrequency().Hz, delta, tsKnobHz);
f.MHzDouble = f.Hz / (double)1E6; f.MHzDouble = f.Hz / (double)1E6;
if (f.Hz > 0) if (f.Hz > 0)
{ {
oldFreqDialVal = value; oldFreqDialVal = value;
vfos[0]->setFrequency(f); vfos[0]->setFrequency(f);
queue->add(priorityImmediate,queueItem(funcSelectedFreq,QVariant::fromValue<freqt>(f),false)); queue->add(priorityImmediate,queueItem(funcSelectedFreq,QVariant::fromValue<freqt>(f),false));
} else { } else {
ui->freqDial->blockSignals(true); ui->freqDial->blockSignals(true);
ui->freqDial->setValue(oldFreqDialVal); ui->freqDial->setValue(oldFreqDialVal);
ui->freqDial->blockSignals(false); ui->freqDial->blockSignals(false);
return; return;
}
} }
} }
@ -4106,7 +4131,8 @@ void wfmain::gotoMemoryPreset(int presetNumber)
//issueDelayedCommand(cmdSetModeFilter); // goes to setModeVal //issueDelayedCommand(cmdSetModeFilter); // goes to setModeVal
//issueCmd(cmdSetMode, m); //issueCmd(cmdSetMode, m);
memFreq.MHzDouble = memFreq.Hz / 1.0E6; memFreq.MHzDouble = memFreq.Hz / 1.0E6;
vfos[0]->setFrequency(memFreq); if (vfos.size())
vfos[0]->setFrequency(memFreq);
qDebug(logGui()) << "Recalling preset number " << presetNumber << " as frequency " << temp.frequency << "MHz"; qDebug(logGui()) << "Recalling preset number " << presetNumber << " as frequency " << temp.frequency << "MHz";
} }
@ -4114,15 +4140,17 @@ void wfmain::saveMemoryPreset(int presetNumber)
{ {
// int, double, rigMode_t // int, double, rigMode_t
double frequency; double frequency;
if(vfos[0]->getFrequency().Hz == 0) if (vfos.size()) {
{ if(vfos[0]->getFrequency().Hz == 0)
frequency = vfos[0]->getFrequency().MHzDouble; {
} else { frequency = vfos[0]->getFrequency().MHzDouble;
frequency = vfos[0]->getFrequency().Hz / 1.0E6; } else {
frequency = vfos[0]->getFrequency().Hz / 1.0E6;
}
rigMode_t mode = currentMode;
qDebug(logGui()) << "Saving preset number " << presetNumber << " to frequency " << frequency << " MHz";
mem.setPreset(presetNumber, frequency, mode);
} }
rigMode_t mode = currentMode;
qDebug(logGui()) << "Saving preset number " << presetNumber << " to frequency " << frequency << " MHz";
mem.setPreset(presetNumber, frequency, mode);
} }
void wfmain::on_rfGainSlider_valueChanged(int value) void wfmain::on_rfGainSlider_valueChanged(int value)
@ -4418,21 +4446,22 @@ void wfmain::statusFromSliderPercent(QString name, int rawValue)
void wfmain::processModLevel(inputTypes source, unsigned char level) void wfmain::processModLevel(inputTypes source, unsigned char level)
{ {
unsigned char data = vfos[0]->getDataMode(); if (vfos.size()) {
unsigned char data = vfos[0]->getDataMode();
if(prefs.inputSource[data].type == source) if(prefs.inputSource[data].type == source)
{ {
prefs.inputSource[data].level = level; prefs.inputSource[data].level = level;
changeSliderQuietly(ui->micGainSlider, level); changeSliderQuietly(ui->micGainSlider, level);
emit sendLevel(funcLANModLevel,level); emit sendLevel(funcLANModLevel,level);
}
} }
} }
void wfmain::receiveModInput(rigInput input, unsigned char data) void wfmain::receiveModInput(rigInput input, unsigned char data)
{ {
// This will ONLY fire if the input type is different to the current one // This will ONLY fire if the input type is different to the current one
if (currentModSrc[data].type != input.type) if (currentModSrc[data].type != input.type && vfos.size())
{ {
qInfo() << QString("Data: %0 Input: %1 current: %2").arg(data).arg(input.name).arg(prefs.inputSource[data].name); qInfo() << QString("Data: %0 Input: %1 current: %2").arg(data).arg(input.name).arg(prefs.inputSource[data].name);
queue->del(getInputTypeCommand(prefs.inputSource[data].type),false); queue->del(getInputTypeCommand(prefs.inputSource[data].type),false);
@ -4463,7 +4492,7 @@ void wfmain::receiveModInput(rigInput input, unsigned char data)
void wfmain::receivePassband(quint16 pass) void wfmain::receivePassband(quint16 pass)
{ {
double pb = (double)(pass / 1000000.0); double pb = (double)(pass / 1000000.0);
if (vfos[0]->getPassbandWidth() != pb) { if (vfos.size() && vfos[0]->getPassbandWidth() != pb) {
vfos[0]->setPassbandWidth(pb); vfos[0]->setPassbandWidth(pb);
qInfo(logSystem()) << QString("Received new IF Filter/Passband %0 Hz").arg(pass); qInfo(logSystem()) << QString("Received new IF Filter/Passband %0 Hz").arg(pass);
@ -4601,10 +4630,13 @@ void wfmain::processChangingCurrentModLevel(unsigned char level)
// slider moved, so find the current mod and issue the level set command. // slider moved, so find the current mod and issue the level set command.
funcs f = funcNone; funcs f = funcNone;
unsigned char d = vfos[0]->getDataMode(); if (vfos.size()) {
f = getInputTypeCommand(prefs.inputSource[d].type); unsigned char d = vfos[0]->getDataMode();
f = getInputTypeCommand(prefs.inputSource[d].type);
queue->addUnique(priorityImmediate,queueItem(f,QVariant::fromValue<ushort>(level),false)); queue->addUnique(priorityImmediate,queueItem(f,QVariant::fromValue<ushort>(level),false));
}
} }
void wfmain::on_tuneLockChk_clicked(bool checked) void wfmain::on_tuneLockChk_clicked(bool checked)
@ -5252,6 +5284,11 @@ void wfmain::on_rigCreatorBtn_clicked()
void wfmain::receiveValue(cacheItem val){ void wfmain::receiveValue(cacheItem val){
if (val.vfo >= vfos.size())
{
qCritical(logSystem()) << "Data received for VFO that doesn't exist!" << val.vfo;
return;
}
switch (val.command) switch (val.command)
{ {
#if defined __GNUC__ #if defined __GNUC__
@ -5259,8 +5296,7 @@ void wfmain::receiveValue(cacheItem val){
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough" #pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
#endif #endif
case funcUnselectedFreq: case funcUnselectedFreq:
if (vfos.size() > 1) val.vfo=1;
val.vfo=1;
case funcFreqGet: case funcFreqGet:
case funcFreqTR: case funcFreqTR:
case funcSelectedFreq: case funcSelectedFreq:
@ -5280,12 +5316,13 @@ void wfmain::receiveValue(cacheItem val){
case funcModeGet: case funcModeGet:
case funcModeTR: case funcModeTR:
case funcSelectedMode: case funcSelectedMode:
if (vfos.size()) if (vfos.size()) {
vfos[0]->receiveMode(val.value.value<modeInfo>()); vfos[0]->receiveMode(val.value.value<modeInfo>());
finputbtns->updateCurrentMode(val.value.value<modeInfo>().mk); finputbtns->updateCurrentMode(val.value.value<modeInfo>().mk);
finputbtns->updateFilterSelection(val.value.value<modeInfo>().filter); finputbtns->updateFilterSelection(val.value.value<modeInfo>().filter);
rpt->handleUpdateCurrentMainMode(val.value.value<modeInfo>()); rpt->handleUpdateCurrentMainMode(val.value.value<modeInfo>());
cw->handleCurrentModeUpdate(val.value.value<modeInfo>().mk); cw->handleCurrentModeUpdate(val.value.value<modeInfo>().mk);
}
break; break;
case funcUnselectedMode: case funcUnselectedMode:
val.vfo=1; val.vfo=1;
@ -5610,22 +5647,28 @@ void wfmain::receiveValue(cacheItem val){
{ {
if (vfos.size()>1) if (vfos.size()>1)
{ {
// This tells us whether we are receiving main or sub data if (QThread::currentThread() != QCoreApplication::instance()->thread())
subScope = val.value.value<bool>(); {
if (!subScope && !vfos[0]->isVisible()) { qCritical(logSystem()) << "Thread is NOT the main UI thread, cannot hide/unhide VFO";
vfos[1]->setVisible(false);
vfos[0]->setVisible(true);
} else if (subScope && !vfos[1]->isVisible()) {
vfos[0]->setVisible(false);
vfos[1]->setVisible(true);
}
if (ui->scopeDualBtn->isChecked()) {
vfos[0]->selected(!subScope);
vfos[1]->selected(subScope);
} else { } else {
vfos[0]->selected(false);
vfos[1]->selected(false); // This tells us whether we are receiving main or sub data
subScope = val.value.value<bool>();
if (!subScope && !vfos[0]->isVisible()) {
vfos[1]->setVisible(false);
vfos[0]->setVisible(true);
} else if (subScope && !vfos[1]->isVisible()) {
vfos[0]->setVisible(false);
vfos[1]->setVisible(true);
}
if (ui->scopeDualBtn->isChecked()) {
vfos[0]->selected(!subScope);
vfos[1]->selected(subScope);
} else {
vfos[0]->selected(false);
vfos[1]->selected(false);
}
} }
} }
break; break;
@ -5634,25 +5677,30 @@ void wfmain::receiveValue(cacheItem val){
{ {
if (vfos.size()>1) if (vfos.size()>1)
{ {
// This tells us whether we are receiving single or dual scopes if (QThread::currentThread() != QCoreApplication::instance()->thread())
ui->scopeDualBtn->setChecked(val.value.value<bool>()); {
if (val.value.value<bool>()) { qCritical(logSystem()) << "Thread is NOT the main UI thread, cannot hide/unhide VFO";
if (!vfos[1]->isVisible())
{
vfos[1]->setVisible(true);
}
else if (!vfos[0]->isVisible())
{
vfos[0]->setVisible(true);
}
} else { } else {
if (vfos[0]->isVisible()) // This tells us whether we are receiving single or dual scopes
{ ui->scopeDualBtn->setChecked(val.value.value<bool>());
vfos[1]->setVisible(false); if (val.value.value<bool>()) {
} if (!vfos[1]->isVisible())
else if (vfos[1]->isVisible()) {
{ vfos[1]->setVisible(true);
vfos[0]->setVisible(false); }
else if (!vfos[0]->isVisible())
{
vfos[0]->setVisible(true);
}
} else {
if (vfos[0]->isVisible())
{
vfos[1]->setVisible(false);
}
else if (vfos[1]->isVisible())
{
vfos[0]->setVisible(false);
}
} }
} }
} }
@ -5741,19 +5789,19 @@ void wfmain::on_showSettingsBtn_clicked()
void wfmain::on_scopeMainSubBtn_clicked() void wfmain::on_scopeMainSubBtn_clicked()
{ {
subScope = !subScope; subScope = !subScope;
queue->add(priorityImmediate,queueItem(funcScopeMainSub,QVariant::fromValue(subScope),false,false)); queue->add(priorityImmediate,queueItem(funcScopeMainSub,QVariant::fromValue(subScope),false));
} }
void wfmain::on_scopeDualBtn_toggled(bool en) void wfmain::on_scopeDualBtn_toggled(bool en)
{ {
queue->add(priorityImmediate,queueItem(funcScopeSingleDual,QVariant::fromValue(en),false,false)); queue->add(priorityImmediate,queueItem(funcScopeSingleDual,QVariant::fromValue(en),false));
if (en) if (en)
queue->add(priorityImmediate,queueItem(funcScopeMainSub,QVariant::fromValue(false),false,false)); // Set main scope queue->add(priorityImmediate,queueItem(funcScopeMainSub,QVariant::fromValue(false),false)); // Set main scope
} }
void wfmain::on_dualWatchBtn_toggled(bool en) void wfmain::on_dualWatchBtn_toggled(bool en)
{ {
queue->add(priorityImmediate,queueItem(funcVFODualWatch,QVariant::fromValue(en),false,false)); queue->add(priorityImmediate,queueItem(funcVFODualWatch,QVariant::fromValue(en),false));
} }
void wfmain::dataModeChanged(modeInfo m) void wfmain::dataModeChanged(modeInfo m)

Wyświetl plik

@ -497,7 +497,7 @@ private slots:
private: private:
Ui::wfmain *ui; // Main UI Ui::wfmain *ui; // Main UI
QList<spectrumScope*>vfos; // Spectrum Scope/VFO item. QVector<spectrumScope*>vfos; // Spectrum Scope/VFO item.
void closeEvent(QCloseEvent *event); void closeEvent(QCloseEvent *event);
QString logFilename; QString logFilename;
bool debugMode; bool debugMode;

Wyświetl plik

@ -136,7 +136,7 @@ struct antennaInfo {
struct scopeData { struct scopeData {
bool valid=false; bool valid=false;
QByteArray data; QByteArray data;
bool mainSub; uchar vfo;
spectrumMode_t mode; spectrumMode_t mode;
bool oor; bool oor;
double startFreq; double startFreq;