diff --git a/cluster.cpp b/cluster.cpp index d9497b7..c4a4fb5 100644 --- a/cluster.cpp +++ b/cluster.cpp @@ -263,9 +263,10 @@ void dxClusterClient::tcpDisconnected() { // Need to start a timer and attempt reconnect. } -void dxClusterClient::freqRange(bool sub, double low, double high) +void dxClusterClient::freqRange(uchar vfo, double low, double high) { - if (sub) { + freqRanges[vfo] = {low,high}; + if (vfo) { lowSubFreq = low; highSubFreq = high; } else { @@ -293,47 +294,28 @@ void dxClusterClient::updateSpots() spots.append(s); } #else - QMap::iterator mainSpot = allSpots.begin();; - while (mainSpot != allSpots.end()) { - if (mainSpot.value()->frequency > lowMainFreq && mainSpot.value()->frequency < highMainFreq) + QMap::iterator range = freqRanges.begin(); + while (range != freqRanges.end()) + { + spots.clear(); + QMap::iterator mainSpot = allSpots.begin(); + while (mainSpot != allSpots.end()) { - spots.append(**mainSpot); + if (mainSpot.value()->frequency >= range->low && mainSpot.value()->frequency <= range->high) + { + spots.append(**mainSpot); + } + ++mainSpot; } - ++mainSpot; + if (!spots.empty()) { + emit sendSpots(range.key(),spots); + //qInfo(logCluster()) << "Sending" << spots.size() << "DX spots to vfo" << range.key(); + } + ++range; } #endif - if (!spots.empty()) - emit sendMainSpots(spots); - spots.clear(); -#ifdef USESQL - // Set the required frequency range. - QString queryText = QString("SELECT * FROM spots WHERE frequency > %1 AND frequency < %2").arg(lowFreq).arg(highFreq); - //QString queryText = QString("SELECT * FROM spots"); - database db; - auto query = db.query(queryText); - - while (query.next()) { - // Step through all current spots within range - spotData s = spotData(); - s.dxcall = query.value(query.record().indexOf("dxcall")).toString(); - s.frequency = query.value(query.record().indexOf("frequency")).toDouble(); - spots.append(s); - } -#else - QMap::iterator subSpot = allSpots.begin();; - while (subSpot != allSpots.end()) { - if (subSpot.value()->frequency > lowSubFreq && subSpot.value()->frequency < highSubFreq) - { - spots.append(**subSpot); - } - ++subSpot; - } - -#endif - if (!spots.empty()) - emit sendSubSpots(spots); } void dxClusterClient::enableSkimmerSpots(bool enable) diff --git a/cluster.h b/cluster.h index c9d349d..bbf5753 100644 --- a/cluster.h +++ b/cluster.h @@ -43,6 +43,13 @@ struct clusterSettings { bool isdefault; }; +struct rangeValues { + rangeValues() {}; + rangeValues(double low, double high): low(low), high(high) {}; + double low; + double high; +}; + class dxClusterClient : public QObject { Q_OBJECT @@ -56,7 +63,7 @@ signals: void deleteSpot(QString dxcall); void deleteOldSpots(int minutes); void sendOutput(QString text); - void sendMainSpots(QList spots); + void sendSpots(uchar vfo, QList spots); void sendSubSpots(QList spots); public slots: @@ -72,7 +79,7 @@ public slots: void setTcpPassword(QString s) { tcpPassword = s; } void setTcpTimeout(int p) { tcpTimeout = p; } void tcpCleanup(); - void freqRange(bool sub, double low, double high); + void freqRange(uchar vfo, double low, double high); void enableSkimmerSpots(bool enable); private: @@ -102,6 +109,7 @@ private: double highMainFreq; double lowSubFreq; double highSubFreq; + QMap freqRanges; QMap allSpots; bool skimmerSpots = false; }; diff --git a/loggingwindow.cpp b/loggingwindow.cpp index 5b9c972..500ba4e 100644 --- a/loggingwindow.cpp +++ b/loggingwindow.cpp @@ -71,6 +71,12 @@ void loggingWindow::acceptLogText(QPair text) } else if (text.first == QtCriticalMsg || text.first == QtFatalMsg) { colour = "red"; + } else if (text.first == QtInfoMsg) { + colour = "white"; + } + else + { + colour = "green"; } ui->logTextDisplay->appendHtml(QString("

%1

").arg(colour).arg(text.second)); if(vertLogScroll->value() == vertLogScroll->maximum()) diff --git a/rigcommander.cpp b/rigcommander.cpp index ce0a32f..ac80642 100644 --- a/rigcommander.cpp +++ b/rigcommander.cpp @@ -1423,7 +1423,7 @@ void rigCommander::determineRigCaps() for (int c = 0; c < numAttenuators; c++) { settings->setArrayIndex(c); - qInfo(logRig()) << "** GOT ATTENUATOR" << settings->value("dB", 0).toString().toUInt(); + //qInfo(logRig()) << "** GOT ATTENUATOR" << settings->value("dB", 0).toString().toUInt(); rigCaps.attenuators.push_back((unsigned char)settings->value("dB", 0).toString().toUInt()); } settings->endArray(); diff --git a/spectrumscope.cpp b/spectrumscope.cpp index d9dd0e3..31b2c2e 100644 --- a/spectrumscope.cpp +++ b/spectrumscope.cpp @@ -1533,8 +1533,11 @@ void spectrumScope::setSpeed(uchar s) } -void spectrumScope::receiveSpots(QList spots) +void spectrumScope::receiveSpots(uchar vfo, QList spots) { + if (vfo != this->vfo) { + return; + } //QElapsedTimer timer; //timer.start(); bool current = false; @@ -1620,7 +1623,6 @@ void spectrumScope::receiveSpots(QList spots) } //qDebug(logCluster()) << "Processing took" << timer.nsecsElapsed() / 1000 << "us"; - } void spectrumScope::configPressed() diff --git a/spectrumscope.h b/spectrumscope.h index e903388..515daf0 100644 --- a/spectrumscope.h +++ b/spectrumscope.h @@ -100,7 +100,7 @@ public: public slots: // Can be called directly or updated via signal/slot void selectScopeMode(spectrumMode_t m); void selectSpan(centerSpanData s); - void receiveSpots(QList spots); + void receiveSpots(uchar vfo, QList spots); signals: void frequencyRange(uchar vfo, double start, double end); diff --git a/wfmain.cpp b/wfmain.cpp index 9a8ff1e..7197128 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -1003,7 +1003,8 @@ void wfmain::configureVFOs() ui->vfoLayout->addWidget(vfos.last()); connect(vfos.last(), SIGNAL(frequencyRange(uchar, double, double)), cluster, SLOT(freqRange(uchar, double, double))); - connect(cluster, SIGNAL(sendMainSpots(QList)), vfos.last(), SLOT(receiveSpots(QList))); + + connect(cluster, SIGNAL(sendSpots(uchar, QList)), vfos.last(), SLOT(receiveSpots(uchar, QList))); 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)));