Porównaj commity

...

4 Commity

Autor SHA1 Wiadomość Data
Phil Taylor c9c129ffe3 Fix cluster spots 2024-01-28 13:14:47 +00:00
Phil Taylor d25dc81d66 Remove more hex conversions 2024-01-28 09:49:08 +00:00
Phil Taylor 03b4059f76 Fix for mode selection 2024-01-28 09:42:50 +00:00
Phil Taylor b3eb151104 Add support for more than 2 VFOs 2024-01-27 22:13:47 +00:00
25 zmienionych plików z 530 dodań i 621 usunięć

Wyświetl plik

@ -81,12 +81,12 @@ void cachingQueue::run()
} }
it--; it--;
auto item = it.value(); auto item = it.value();
emit haveCommand(item.command,item.param,item.sub); emit haveCommand(item.command,item.param,item.vfo);
it=queue.erase(it); it=queue.erase(it);
if (item.recurring && prio != priorityImmediate) { if (item.recurring && prio != priorityImmediate) {
queue.insert(prio,item); queue.insert(prio,item);
} }
updateCache(false,item.command,item.param,item.sub); updateCache(false,item.command,item.param,item.vfo);
} }
QCoreApplication::processEvents(); QCoreApplication::processEvents();
@ -109,9 +109,9 @@ void cachingQueue::interval(quint64 val)
qInfo() << "Changing queue interval to" << val << "ms"; qInfo() << "Changing queue interval to" << val << "ms";
} }
void cachingQueue::add(queuePriority prio ,funcs func, bool recurring, bool sub) void cachingQueue::add(queuePriority prio ,funcs func, bool recurring, uchar vfo)
{ {
queueItem q(func,recurring,sub); queueItem q(func,recurring,vfo);
add(prio,q); add(prio,q);
} }
@ -130,7 +130,7 @@ void cachingQueue::add(queuePriority prio ,queueItem item)
queueItem it=item; queueItem it=item;
it.recurring=false; it.recurring=false;
queue.insert(queue.cend(),priorityHighest, it); queue.insert(queue.cend(),priorityHighest, it);
qInfo() << "adding" << funcString[item.command] << "recurring" << item.recurring << "priority" << prio << "sub" << item.sub; qInfo() << "adding" << funcString[item.command] << "recurring" << item.recurring << "priority" << prio << "vfo" << item.vfo;
} }
queue.insert(prio, item); queue.insert(prio, item);
} }
@ -138,9 +138,9 @@ void cachingQueue::add(queuePriority prio ,queueItem item)
} }
} }
void cachingQueue::addUnique(queuePriority prio ,funcs func, bool recurring, bool sub) void cachingQueue::addUnique(queuePriority prio ,funcs func, bool recurring, uchar vfo)
{ {
queueItem q(func,recurring, sub); queueItem q(func,recurring, vfo);
addUnique(prio,q); addUnique(prio,q);
} }
@ -157,9 +157,9 @@ void cachingQueue::addUnique(queuePriority prio ,queueItem item)
auto it(queue.begin()); auto it(queue.begin());
// This is quite slow but a new unique command is only added in response to user interaction (mode change etc.) // This is quite slow but a new unique command is only added in response to user interaction (mode change etc.)
while (it != queue.end()) { while (it != queue.end()) {
if (it.value().command == item.command && it.value().recurring == item.recurring && it.value().sub == item.sub && it.value().param.isValid() == item.param.isValid()) if (it.value().command == item.command && it.value().recurring == item.recurring && it.value().vfo == item.vfo && it.value().param.isValid() == item.param.isValid())
{ {
//qInfo() << "deleting" << it.value().id << funcString[it.value().command] << "sub" << it.value().sub << "recurring" << it.value().recurring ; //qInfo() << "deleting" << it.value().id << funcString[it.value().command] << "vfo" << it.value().vfo << "recurring" << it.value().recurring ;
it = queue.erase(it); it = queue.erase(it);
} }
else else
@ -172,25 +172,25 @@ void cachingQueue::addUnique(queuePriority prio ,queueItem item)
queueItem it = item; queueItem it = item;
it.recurring=false; it.recurring=false;
queue.insert(queue.cend(),priorityHighest, it); queue.insert(queue.cend(),priorityHighest, it);
qInfo() << "adding unique" << funcString[item.command] << "recurring" << item.recurring << "priority" << prio << "sub" << item.sub; qInfo() << "adding unique" << funcString[item.command] << "recurring" << item.recurring << "priority" << prio << "vfo" << item.vfo;
} }
queue.insert(prio, item); queue.insert(prio, item);
} }
} }
} }
void cachingQueue::del(funcs func, bool sub) void cachingQueue::del(funcs func, uchar vfo)
{ {
// This will immediately delete any matching commands. // This will immediately delete any matching commands.
if (func != funcNone) if (func != funcNone)
{ {
QMutexLocker locker(&mutex); QMutexLocker locker(&mutex);
auto it = std::find_if(queue.begin(), queue.end(), [func,sub](const queueItem& c) { return (c.command == func && c.sub == sub && c.recurring); }); auto it = std::find_if(queue.begin(), queue.end(), [func,vfo](const queueItem& c) { return (c.command == func && c.vfo == vfo && c.recurring); });
//auto it(queue.begin()); //auto it(queue.begin());
if (it == queue.end()) if (it == queue.end())
qInfo() << "recurring command" << funcString[func] << "sub" << sub << "not found in queue"; qInfo() << "recurring command" << funcString[func] << "vfo" << vfo << "not found in queue";
while (it != queue.end()) { while (it != queue.end()) {
if (it.value().command == func && it.value().sub == sub) { if (it.value().command == func && it.value().vfo == vfo) {
//qInfo() << "deleting" << funcString[it.value().command] << "sub" << it.value().sub << "recurring" << it.value().recurring; //qInfo() << "deleting" << funcString[it.value().command] << "sub" << it.value().sub << "recurring" << it.value().recurring;
it = queue.erase(it); it = queue.erase(it);
} }
@ -202,10 +202,10 @@ void cachingQueue::del(funcs func, bool sub)
} }
} }
queuePriority cachingQueue::isRecurring(funcs func, bool sub) queuePriority cachingQueue::isRecurring(funcs func, uchar vfo)
{ {
// Does NOT lock the mutex // Does NOT lock the mutex
auto rec = std::find_if(queue.begin(), queue.end(), [func,sub](const queueItem& c) { return (c.command == func && c.sub == sub && c.recurring); }); auto rec = std::find_if(queue.begin(), queue.end(), [func,vfo](const queueItem& c) { return (c.command == func && c.vfo == vfo && c.recurring); });
if (rec != queue.end()) if (rec != queue.end())
{ {
return rec.key(); return rec.key();
@ -224,12 +224,12 @@ void cachingQueue::message(QString msg)
waiting.wakeOne(); waiting.wakeOne();
} }
void cachingQueue::receiveValue(funcs func, QVariant value, bool sub) void cachingQueue::receiveValue(funcs func, QVariant value, uchar vfo)
{ {
QMutexLocker locker(&mutex); QMutexLocker locker(&mutex);
cacheItem c = cacheItem(func,value,sub); cacheItem c = cacheItem(func,value,vfo);
items.enqueue(c); items.enqueue(c);
updateCache(true,func,value,sub); updateCache(true,func,value,vfo);
waiting.wakeOne(); waiting.wakeOne();
} }
@ -239,7 +239,7 @@ void cachingQueue::updateCache(bool reply, queueItem item)
// Mutex MUST be locked by the calling function. // Mutex MUST be locked by the calling function.
auto cv = cache.find(item.command); auto cv = cache.find(item.command);
while (cv != cache.end() && cv->command == item.command) { while (cv != cache.end() && cv->command == item.command) {
if (cv->sub == item.sub) { if (cv->vfo == item.vfo) {
if (reply) { if (reply) {
cv->reply = QDateTime::currentDateTime(); cv->reply = QDateTime::currentDateTime();
} else { } else {
@ -261,7 +261,7 @@ void cachingQueue::updateCache(bool reply, queueItem item)
cacheItem c; cacheItem c;
c.command = item.command; c.command = item.command;
c.sub = item.sub; c.vfo = item.vfo;
if (reply) { if (reply) {
c.reply = QDateTime::currentDateTime(); c.reply = QDateTime::currentDateTime();
} else { } else {
@ -275,14 +275,14 @@ void cachingQueue::updateCache(bool reply, queueItem item)
} }
void cachingQueue::updateCache(bool reply, funcs func, QVariant value, bool sub) void cachingQueue::updateCache(bool reply, funcs func, QVariant value, uchar vfo)
{ {
queueItem q(func,value,false,sub); queueItem q(func,value,false,vfo);
updateCache(reply,q); updateCache(reply,q);
} }
cacheItem cachingQueue::getCache(funcs func, bool sub) cacheItem cachingQueue::getCache(funcs func, uchar vfo)
{ {
cacheItem ret; cacheItem ret;
if (func != funcNone) { if (func != funcNone) {
@ -290,7 +290,7 @@ cacheItem cachingQueue::getCache(funcs func, bool sub)
auto it = cache.find(func); auto it = cache.find(func);
while (it != cache.end() && it->command == func) while (it != cache.end() && it->command == func)
{ {
if (it->sub == sub) if (it->vfo == vfo)
ret = cacheItem(*it); ret = cacheItem(*it);
++it; ++it;
} }
@ -299,7 +299,7 @@ cacheItem cachingQueue::getCache(funcs func, bool sub)
// Using priorityhighest WILL slow down the S-Meter when a command intensive client is connected to rigctl // Using priorityhighest WILL slow down the S-Meter when a command intensive client is connected to rigctl
if (func != funcNone && (!ret.value.isValid() || ret.reply.addSecs(QRandomGenerator::global()->bounded(5,20)) <= QDateTime::currentDateTime())) { if (func != funcNone && (!ret.value.isValid() || ret.reply.addSecs(QRandomGenerator::global()->bounded(5,20)) <= QDateTime::currentDateTime())) {
//qInfo() << "No (or expired) cache found for" << funcString[func] << "requesting"; //qInfo() << "No (or expired) cache found for" << funcString[func] << "requesting";
add(priorityHighest,func,false,sub); add(priorityHighest,func,false,vfo);
} }
return ret; return ret;
} }

Wyświetl plik

@ -29,28 +29,28 @@ enum queueItemType {
// Command with no param is a get by default // Command with no param is a get by default
struct queueItem { struct queueItem {
queueItem () {} queueItem () {}
queueItem (funcs command, QVariant param, bool recurring, bool sub) : command(command), param(param), sub(sub), recurring(recurring){}; queueItem (funcs command, QVariant param, bool recurring, uchar vfo) : command(command), param(param), vfo(vfo), recurring(recurring){};
queueItem (funcs command, QVariant param, bool recurring) : command(command), param(param), sub(false), recurring(recurring){}; queueItem (funcs command, QVariant param, bool recurring) : command(command), param(param), vfo(false), recurring(recurring){};
queueItem (funcs command, QVariant param) : command(command), param(param), sub(false), recurring(false){}; queueItem (funcs command, QVariant param) : command(command), param(param),vfo(0), recurring(false){};
queueItem (funcs command, bool recurring, bool sub=false) : command(command), param(QVariant()), sub(sub), recurring(recurring) {}; queueItem (funcs command, bool recurring, uchar vfo) : command(command), param(QVariant()), vfo(vfo), recurring(recurring) {};
queueItem (funcs command, bool recurring) : command(command), param(QVariant()), sub(false), recurring(recurring) {}; queueItem (funcs command, bool recurring) : command(command), param(QVariant()), vfo(0), recurring(recurring) {};
queueItem (funcs command) : command(command), param(QVariant()), sub(false), recurring(false){}; queueItem (funcs command) : command(command), param(QVariant()), vfo(0), recurring(false){};
funcs command; funcs command;
QVariant param; QVariant param;
bool sub; uchar vfo;
bool recurring; bool recurring;
qint64 id = QDateTime::currentMSecsSinceEpoch(); qint64 id = QDateTime::currentMSecsSinceEpoch();
}; };
struct cacheItem { struct cacheItem {
cacheItem () {}; cacheItem () {};
cacheItem (funcs command, QVariant value, bool sub=false) : command(command), req(QDateTime()), reply(QDateTime()), value(value), sub(sub){}; cacheItem (funcs command, QVariant value, uchar vfo=0) : command(command), req(QDateTime()), reply(QDateTime()), value(value), vfo(vfo){};
funcs command; funcs command;
QDateTime req; QDateTime req;
QDateTime reply; QDateTime reply;
QVariant value; QVariant value;
bool sub; uchar vfo;
}; };
class cachingQueue : public QThread class cachingQueue : public QThread
@ -58,14 +58,14 @@ class cachingQueue : public QThread
Q_OBJECT Q_OBJECT
signals: signals:
void haveCommand(funcs func, QVariant param, bool sub); void haveCommand(funcs func, QVariant param, uchar vfo);
void sendValue(cacheItem item); void sendValue(cacheItem item);
void cacheUpdated(cacheItem item); void cacheUpdated(cacheItem item);
void rigCapsUpdated(rigCapabilities* caps); void rigCapsUpdated(rigCapabilities* caps);
public slots: public slots:
// Can be called directly or via emit. // Can be called directly or via emit.
void receiveValue(funcs func, QVariant value, bool sub); void receiveValue(funcs func, QVariant value, uchar vfo);
private: private:
@ -79,8 +79,8 @@ private:
QQueue<cacheItem> items; QQueue<cacheItem> items;
// Command to set cache value // Command to set cache value
void setCache(funcs func, QVariant val, bool sub=false); void setCache(funcs func, QVariant val, uchar vfo=0);
queuePriority isRecurring(funcs func, bool sub=false); queuePriority isRecurring(funcs func, uchar vfo=0);
bool compare(QVariant a, QVariant b); bool compare(QVariant a, QVariant b);
@ -104,17 +104,17 @@ public:
static cachingQueue *getInstance(QObject* parent = Q_NULLPTR); static cachingQueue *getInstance(QObject* parent = Q_NULLPTR);
void message(QString msg); void message(QString msg);
void add(queuePriority prio ,funcs func, bool recurring=false, bool sub=false); void add(queuePriority prio ,funcs func, bool recurring=false, uchar vfo=0);
void add(queuePriority prio,queueItem item); void add(queuePriority prio,queueItem item);
void addUnique(queuePriority prio ,funcs func, bool recurring=false, bool sub=false); void addUnique(queuePriority prio ,funcs func, bool recurring=false, uchar vfo=0);
void addUnique(queuePriority prio,queueItem item); void addUnique(queuePriority prio,queueItem item);
void del(funcs func, bool sub=false); void del(funcs func, uchar vfo=0);
void clear(); void clear();
void interval(quint64 val); void interval(quint64 val);
void updateCache(bool reply, queueItem item); void updateCache(bool reply, queueItem item);
void updateCache(bool reply, funcs func, QVariant value=QVariant(), bool sub=false); void updateCache(bool reply, funcs func, QVariant value=QVariant(), uchar vfo=0);
cacheItem getCache(funcs func, bool sub=false); cacheItem getCache(funcs func, uchar vfo=0);
QMultiMap<funcs,cacheItem> getCacheItems(); QMultiMap<funcs,cacheItem> getCacheItems();
QMultiMap <queuePriority,queueItem> getQueueItems(); QMultiMap <queuePriority,queueItem> getQueueItems();

Wyświetl plik

@ -263,9 +263,10 @@ void dxClusterClient::tcpDisconnected() {
// Need to start a timer and attempt reconnect. // 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; lowSubFreq = low;
highSubFreq = high; highSubFreq = high;
} else { } else {
@ -293,47 +294,28 @@ void dxClusterClient::updateSpots()
spots.append(s); spots.append(s);
} }
#else #else
QMap<QString, spotData*>::iterator mainSpot = allSpots.begin();; QMap<uchar, rangeValues>::iterator range = freqRanges.begin();
while (mainSpot != allSpots.end()) { while (range != freqRanges.end())
if (mainSpot.value()->frequency > lowMainFreq && mainSpot.value()->frequency < highMainFreq) {
spots.clear();
QMap<QString, spotData*>::iterator mainSpot = allSpots.begin();
while (mainSpot != allSpots.end())
{
if (mainSpot.value()->frequency >= range->low && mainSpot.value()->frequency <= range->high)
{ {
spots.append(**mainSpot); spots.append(**mainSpot);
} }
++mainSpot; ++mainSpot;
} }
if (!spots.empty()) {
#endif emit sendSpots(range.key(),spots);
if (!spots.empty()) //qInfo(logCluster()) << "Sending" << spots.size() << "DX spots to vfo" << range.key();
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 ++range;
QMap<QString, spotData*>::iterator subSpot = allSpots.begin();;
while (subSpot != allSpots.end()) {
if (subSpot.value()->frequency > lowSubFreq && subSpot.value()->frequency < highSubFreq)
{
spots.append(**subSpot);
}
++subSpot;
} }
#endif #endif
if (!spots.empty())
emit sendSubSpots(spots);
} }
void dxClusterClient::enableSkimmerSpots(bool enable) void dxClusterClient::enableSkimmerSpots(bool enable)

Wyświetl plik

@ -43,6 +43,13 @@ struct clusterSettings {
bool isdefault; bool isdefault;
}; };
struct rangeValues {
rangeValues() {};
rangeValues(double low, double high): low(low), high(high) {};
double low;
double high;
};
class dxClusterClient : public QObject class dxClusterClient : public QObject
{ {
Q_OBJECT Q_OBJECT
@ -56,7 +63,7 @@ signals:
void deleteSpot(QString dxcall); void deleteSpot(QString dxcall);
void deleteOldSpots(int minutes); void deleteOldSpots(int minutes);
void sendOutput(QString text); void sendOutput(QString text);
void sendMainSpots(QList<spotData> spots); void sendSpots(uchar vfo, QList<spotData> spots);
void sendSubSpots(QList<spotData> spots); void sendSubSpots(QList<spotData> spots);
public slots: public slots:
@ -72,7 +79,7 @@ public slots:
void setTcpPassword(QString s) { tcpPassword = s; } void setTcpPassword(QString s) { tcpPassword = s; }
void setTcpTimeout(int p) { tcpTimeout = p; } void setTcpTimeout(int p) { tcpTimeout = p; }
void tcpCleanup(); void tcpCleanup();
void freqRange(bool sub, double low, double high); void freqRange(uchar vfo, double low, double high);
void enableSkimmerSpots(bool enable); void enableSkimmerSpots(bool enable);
private: private:
@ -102,6 +109,7 @@ private:
double highMainFreq; double highMainFreq;
double lowSubFreq; double lowSubFreq;
double highSubFreq; double highSubFreq;
QMap<uchar,rangeValues> freqRanges;
QMap<QString,spotData*> allSpots; QMap<QString,spotData*> allSpots;
bool skimmerSpots = false; bool skimmerSpots = false;
}; };

Wyświetl plik

@ -58,7 +58,7 @@ void debugWindow::getCache()
ui->cacheView->item(c,0)->setText(QString::number(i.value().command).rightJustified(3,'0')); ui->cacheView->item(c,0)->setText(QString::number(i.value().command).rightJustified(3,'0'));
ui->cacheView->item(c,1)->setText(funcString[i.value().command]); ui->cacheView->item(c,1)->setText(funcString[i.value().command]);
ui->cacheView->item(c,2)->setText(getValue(i.value().value)); ui->cacheView->item(c,2)->setText(getValue(i.value().value));
ui->cacheView->item(c,3)->setText((i.value().sub)?"true":"false"); ui->cacheView->item(c,3)->setText(QString::number(i.value().vfo));
ui->cacheView->item(c,4)->setText((i.value().req.isValid()?i.value().req.toString("hh:mm:ss.zzz"):"<none>")); ui->cacheView->item(c,4)->setText((i.value().req.isValid()?i.value().req.toString("hh:mm:ss.zzz"):"<none>"));
ui->cacheView->item(c,5)->setText((i.value().reply.isValid()?i.value().reply.toString("hh:mm:ss.zzz"):"<none>")); ui->cacheView->item(c,5)->setText((i.value().reply.isValid()?i.value().reply.toString("hh:mm:ss.zzz"):"<none>"));
c++; c++;

Wyświetl plik

@ -71,6 +71,12 @@ void loggingWindow::acceptLogText(QPair<QtMsgType,QString> text)
} else if (text.first == QtCriticalMsg || text.first == QtFatalMsg) } else if (text.first == QtCriticalMsg || text.first == QtFatalMsg)
{ {
colour = "red"; colour = "red";
} else if (text.first == QtInfoMsg) {
colour = "white";
}
else
{
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).arg(text.second));
if(vertLogScroll->value() == vertLogScroll->maximum()) if(vertLogScroll->value() == vertLogScroll->maximum())

Wyświetl plik

@ -225,7 +225,7 @@ void rigCommander::commonSetup()
this->setObjectName("Rig Commander"); this->setObjectName("Rig Commander");
queue = cachingQueue::getInstance(this); queue = cachingQueue::getInstance(this);
connect(queue,SIGNAL(haveCommand(funcs,QVariant,bool)),this,SLOT(receiveCommand(funcs,QVariant,bool))); connect(queue,SIGNAL(haveCommand(funcs,QVariant,uchar)),this,SLOT(receiveCommand(funcs,QVariant,uchar)));
oldScopeMode = spectModeUnknown; oldScopeMode = spectModeUnknown;
pttAllowed = true; // This is for developing, set to false for "safe" debugging. Set to true for deployment. pttAllowed = true; // This is for developing, set to false for "safe" debugging. Set to true for deployment.
@ -1235,22 +1235,6 @@ void rigCommander::parseCommand()
} }
unsigned char rigCommander::convertNumberToHex(unsigned char num)
{
// Two digit only
if(num > 99)
{
qInfo(logRig()) << "Invalid numeric conversion from num " << num << " to hex.";
return 0xFA;
}
unsigned char result = 0;
result = (num/10) << 4;
result |= (num - 10*(num/10));
//qDebug(logRig()) << "Converting number: " << num << " to hex: " + QString("0x%1").arg(result, 2, 16, QChar('0');
return result;
}
void rigCommander::determineRigCaps() void rigCommander::determineRigCaps()
{ {
// First clear all of the current settings // First clear all of the current settings
@ -1291,6 +1275,7 @@ void rigCommander::determineRigCaps()
rigCaps.modelName = settings->value("Model", "").toString(); rigCaps.modelName = settings->value("Model", "").toString();
qInfo(logRig()) << QString("Loading Rig: %0 from %1").arg(rigCaps.modelName,rigCaps.filename); qInfo(logRig()) << QString("Loading Rig: %0 from %1").arg(rigCaps.modelName,rigCaps.filename);
rigCaps.numVFO = settings->value("NumberOfVFOs",1).toUInt();
rigCaps.spectSeqMax = settings->value("SpectrumSeqMax",0).toUInt(); rigCaps.spectSeqMax = settings->value("SpectrumSeqMax",0).toUInt();
rigCaps.spectAmpMax = settings->value("SpectrumAmpMax",0).toUInt(); rigCaps.spectAmpMax = settings->value("SpectrumAmpMax",0).toUInt();
rigCaps.spectLenMax = settings->value("SpectrumLenMax",0).toUInt(); rigCaps.spectLenMax = settings->value("SpectrumLenMax",0).toUInt();
@ -1357,7 +1342,7 @@ void rigCommander::determineRigCaps()
{ {
settings->setArrayIndex(c); settings->setArrayIndex(c);
rigCaps.modes.push_back(modeInfo(rigMode_t(settings->value("Num", 0).toUInt()), rigCaps.modes.push_back(modeInfo(rigMode_t(settings->value("Num", 0).toUInt()),
settings->value("Reg", 0).toString().toUInt(nullptr,16), settings->value("Name", "").toString(), settings->value("Min", 0).toInt(), settings->value("Max", 0).toInt())); settings->value("Reg", 0).toString().toUInt(), settings->value("Name", "").toString(), settings->value("Min", 0).toInt(), settings->value("Max", 0).toInt()));
} }
settings->endArray(); settings->endArray();
} }
@ -1385,7 +1370,7 @@ void rigCommander::determineRigCaps()
{ {
settings->setArrayIndex(c); settings->setArrayIndex(c);
rigCaps.inputs.append(rigInput(inputTypes(settings->value("Num", 0).toUInt()), rigCaps.inputs.append(rigInput(inputTypes(settings->value("Num", 0).toUInt()),
settings->value("Reg", 0).toString().toUInt(nullptr,16),settings->value("Name", "").toString())); settings->value("Reg", 0).toString().toUInt(),settings->value("Name", "").toString()));
} }
settings->endArray(); settings->endArray();
} }
@ -1412,7 +1397,7 @@ void rigCommander::determineRigCaps()
for (int c = 0; c < numPreamps; c++) for (int c = 0; c < numPreamps; c++)
{ {
settings->setArrayIndex(c); settings->setArrayIndex(c);
rigCaps.preamps.push_back(genericType(settings->value("Num", 0).toString().toUInt(nullptr,16), settings->value("Name", 0).toString())); rigCaps.preamps.push_back(genericType(settings->value("Num", 0).toString().toUInt(), settings->value("Name", 0).toString()));
} }
settings->endArray(); settings->endArray();
} }
@ -1425,7 +1410,7 @@ void rigCommander::determineRigCaps()
for (int c = 0; c < numAntennas; c++) for (int c = 0; c < numAntennas; c++)
{ {
settings->setArrayIndex(c); settings->setArrayIndex(c);
rigCaps.antennas.push_back(genericType(settings->value("Num", 0).toString().toUInt(nullptr,16), settings->value("Name", 0).toString())); rigCaps.antennas.push_back(genericType(settings->value("Num", 0).toString().toUInt(), settings->value("Name", 0).toString()));
} }
settings->endArray(); settings->endArray();
} }
@ -1438,7 +1423,7 @@ void rigCommander::determineRigCaps()
for (int c = 0; c < numAttenuators; c++) for (int c = 0; c < numAttenuators; c++)
{ {
settings->setArrayIndex(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()); rigCaps.attenuators.push_back((unsigned char)settings->value("dB", 0).toString().toUInt());
} }
settings->endArray(); settings->endArray();
@ -1452,7 +1437,7 @@ void rigCommander::determineRigCaps()
for (int c = 0; c < numFilters; c++) for (int c = 0; c < numFilters; c++)
{ {
settings->setArrayIndex(c); settings->setArrayIndex(c);
rigCaps.filters.push_back(filterType(settings->value("Num", 0).toString().toUInt(nullptr,0), settings->value("Name", "").toString(), settings->value("Modes", 0).toUInt())); rigCaps.filters.push_back(filterType(settings->value("Num", 0).toString().toUInt(), settings->value("Name", "").toString(), settings->value("Modes", 0).toUInt()));
} }
settings->endArray(); settings->endArray();
} }
@ -2294,19 +2279,6 @@ void rigCommander::changeLatency(const quint16 value)
emit haveChangeLatency(value); emit haveChangeLatency(value);
} }
// Other:
QByteArray rigCommander::stripData(const QByteArray &data, unsigned char cutPosition)
{
QByteArray rtndata;
if(data.length() < cutPosition)
{
return rtndata;
}
rtndata = data.right(cutPosition);
return rtndata;
}
void rigCommander::radioSelection(QList<radio_cap_packet> radios) void rigCommander::radioSelection(QList<radio_cap_packet> radios)
{ {
@ -2423,7 +2395,7 @@ uchar rigCommander::makeFilterWidth(ushort pass,bool sub)
return b1; return b1;
} }
void rigCommander::receiveCommand(funcs func, QVariant value, bool sub) void rigCommander::receiveCommand(funcs func, QVariant value, uchar vfo)
{ {
//qInfo() << "Got command:" << funcString[func]; //qInfo() << "Got command:" << funcString[func];
int val=INT_MIN; int val=INT_MIN;
@ -2474,7 +2446,7 @@ void rigCommander::receiveCommand(funcs func, QVariant value, bool sub)
} }
QByteArray payload; QByteArray payload;
if (getCommand(func,payload,val,sub)) if (getCommand(func,payload,val,vfo))
{ {
if (value.isValid()) if (value.isValid())
{ {
@ -2519,8 +2491,8 @@ void rigCommander::receiveCommand(funcs func, QVariant value, bool sub)
else if (!strcmp(value.typeName(),"ushort")) else if (!strcmp(value.typeName(),"ushort"))
{ {
if (func == funcFilterWidth) { if (func == funcFilterWidth) {
payload.append(makeFilterWidth(value.value<ushort>(),sub)); payload.append(makeFilterWidth(value.value<ushort>(),vfo));
//qInfo() << "Setting filter width" << value.value<ushort>() << "sub" << sub << "hex" << payload.toHex(); //qInfo() << "Setting filter width" << value.value<ushort>() << "VFO" << vfo << "hex" << payload.toHex();
} }
else if (func == funcKeySpeed){ else if (func == funcKeySpeed){
@ -2769,11 +2741,11 @@ void rigCommander::receiveCommand(funcs func, QVariant value, bool sub)
{ {
if (func == funcDataModeWithFilter) if (func == funcDataModeWithFilter)
{ {
payload.append(value.value<modeInfo>().data); payload.append(bcdEncodeChar(value.value<modeInfo>().data));
if (value.value<modeInfo>().data != 0) if (value.value<modeInfo>().data != 0)
payload.append(value.value<modeInfo>().filter); payload.append(value.value<modeInfo>().filter);
} else { } else {
payload.append(value.value<modeInfo>().reg); payload.append(bcdEncodeChar(value.value<modeInfo>().reg));
if (func == funcSelectedMode || func == funcUnselectedMode) if (func == funcSelectedMode || func == funcUnselectedMode)
payload.append(value.value<modeInfo>().data); payload.append(value.value<modeInfo>().data);
payload.append(value.value<modeInfo>().filter); payload.append(value.value<modeInfo>().filter);
@ -2789,7 +2761,7 @@ void rigCommander::receiveCommand(funcs func, QVariant value, bool sub)
} }
else if(!strcmp(value.typeName(),"antennaInfo")) else if(!strcmp(value.typeName(),"antennaInfo"))
{ {
payload.append(value.value<antennaInfo>().antenna); payload.append(bcdEncodeChar(value.value<antennaInfo>().antenna));
if (rigCaps.commands.contains(funcRXAntenna)) if (rigCaps.commands.contains(funcRXAntenna))
payload.append(value.value<antennaInfo>().rx); payload.append(value.value<antennaInfo>().rx);
} }
@ -2847,7 +2819,7 @@ void rigCommander::receiveCommand(funcs func, QVariant value, bool sub)
// will fail on some commands so they would need to be added here: // will fail on some commands so they would need to be added here:
if (func != funcScopeFixedEdgeFreq && func != funcSpeech && func != funcBandStackReg && func != funcMemoryContents && func != funcSendCW) if (func != funcScopeFixedEdgeFreq && func != funcSpeech && func != funcBandStackReg && func != funcMemoryContents && func != funcSendCW)
{ {
queue->addUnique(priorityImmediate,func,false,sub); queue->addUnique(priorityImmediate,func,false,vfo);
} }
} }
prepDataAndSend(payload); prepDataAndSend(payload);

Wyświetl plik

@ -74,7 +74,7 @@ public slots:
void radioUsage(quint8 radio, bool admin, quint8 busy, QString name, QString ip); void radioUsage(quint8 radio, bool admin, quint8 busy, QString name, QString ip);
void setCurrentRadio(quint8 radio); void setCurrentRadio(quint8 radio);
void getDebug(); void getDebug();
void receiveCommand(funcs func, QVariant value, bool sub); void receiveCommand(funcs func, QVariant value, uchar vfo);
void setAfGain(unsigned char level); void setAfGain(unsigned char level);
signals: signals:
@ -127,7 +127,7 @@ signals:
private: private:
void commonSetup(); void commonSetup();
QByteArray stripData(const QByteArray &data, unsigned char cutPosition);
void parseData(QByteArray data); // new data come here void parseData(QByteArray data); // new data come here
void parseCommand(); // Entry point for complete commands void parseCommand(); // Entry point for complete commands
unsigned char bcdHexToUChar(unsigned char in); unsigned char bcdHexToUChar(unsigned char in);
@ -148,7 +148,7 @@ private:
QByteArray makeFreqPayload(freqt freq); QByteArray makeFreqPayload(freqt freq);
QByteArray encodeTone(quint16 tone, bool tinv, bool rinv); QByteArray encodeTone(quint16 tone, bool tinv, bool rinv);
QByteArray encodeTone(quint16 tone); QByteArray encodeTone(quint16 tone);
unsigned char convertNumberToHex(unsigned char num);
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, bool sub);

Wyświetl plik

@ -121,6 +121,7 @@ void rigCreator::loadRigFile(QString file)
ui->model->setText(settings->value("Model","").toString()); ui->model->setText(settings->value("Model","").toString());
ui->civAddress->setText(QString("%1").arg(settings->value("CIVAddress",0).toInt(),2,16)); ui->civAddress->setText(QString("%1").arg(settings->value("CIVAddress",0).toInt(),2,16));
ui->rigctldModel->setText(settings->value("RigCtlDModel","").toString()); ui->rigctldModel->setText(settings->value("RigCtlDModel","").toString());
ui->numVFO->setText(settings->value("NumberOfVFOs","1").toString());
ui->seqMax->setText(settings->value("SpectrumSeqMax","").toString()); ui->seqMax->setText(settings->value("SpectrumSeqMax","").toString());
ui->ampMax->setText(settings->value("SpectrumAmpMax","").toString()); ui->ampMax->setText(settings->value("SpectrumAmpMax","").toString());
ui->lenMax->setText(settings->value("SpectrumLenMax","").toString()); ui->lenMax->setText(settings->value("SpectrumLenMax","").toString());
@ -421,6 +422,7 @@ void rigCreator::saveRigFile(QString file)
settings->setValue("Model",ui->model->text()); settings->setValue("Model",ui->model->text());
settings->setValue("CIVAddress",ui->civAddress->text().toInt(nullptr,16)); settings->setValue("CIVAddress",ui->civAddress->text().toInt(nullptr,16));
settings->setValue("RigCtlDModel",ui->rigctldModel->text().toInt()); settings->setValue("RigCtlDModel",ui->rigctldModel->text().toInt());
settings->setValue("NumberOfVFOs",ui->numVFO->text().toInt());
settings->setValue("SpectrumSeqMax",ui->seqMax->text().toInt()); settings->setValue("SpectrumSeqMax",ui->seqMax->text().toInt());
settings->setValue("SpectrumAmpMax",ui->ampMax->text().toInt()); settings->setValue("SpectrumAmpMax",ui->ampMax->text().toInt());
settings->setValue("SpectrumLenMax",ui->lenMax->text().toInt()); settings->setValue("SpectrumLenMax",ui->lenMax->text().toInt());

Wyświetl plik

@ -40,28 +40,28 @@
<layout class="QVBoxLayout" name="verticalLayout_13"> <layout class="QVBoxLayout" name="verticalLayout_13">
<item> <item>
<layout class="QFormLayout" name="formLayout_2"> <layout class="QFormLayout" name="formLayout_2">
<item row="0" column="0"> <item row="1" column="0">
<widget class="QLabel" name="label_4"> <widget class="QLabel" name="label_4">
<property name="text"> <property name="text">
<string>Seq Max</string> <string>Seq Max</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0"> <item row="3" column="0">
<widget class="QLabel" name="label_5"> <widget class="QLabel" name="label_5">
<property name="text"> <property name="text">
<string>Len Max</string> <string>Len Max</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="2" column="0">
<widget class="QLabel" name="label_6"> <widget class="QLabel" name="label_6">
<property name="text"> <property name="text">
<string>Amp Max</string> <string>Amp Max</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item row="2" column="1">
<widget class="QLineEdit" name="ampMax"> <widget class="QLineEdit" name="ampMax">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
@ -80,7 +80,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1"> <item row="3" column="1">
<widget class="QLineEdit" name="lenMax"> <widget class="QLineEdit" name="lenMax">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
@ -99,7 +99,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item row="1" column="1">
<widget class="QLineEdit" name="seqMax"> <widget class="QLineEdit" name="seqMax">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
@ -124,6 +124,26 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="0">
<widget class="QLabel" name="label_14">
<property name="text">
<string>Num VFO</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="numVFO">
<property name="maximumSize">
<size>
<width>60</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>1</string>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
</layout> </layout>

Wyświetl plik

@ -833,7 +833,7 @@ int rigCtlClient::getCommand(QStringList& response, bool extended, const command
return -RIG_EINVAL; return -RIG_EINVAL;
} }
if (rigCaps.commands.contains(func)) if (rigCaps.commands.contains(func))
queue->add(priorityImmediate, queueItem(func, val,false)); queue->add(priorityImmediate, queueItem(func, val,false,0));
} else { } else {
// Simple get command // Simple get command
@ -1011,7 +1011,7 @@ int rigCtlClient::getSubCommand(QStringList& response, bool extended, const comm
return -RIG_EINVAL; return -RIG_EINVAL;
} }
if (rigCaps.commands.contains(sub[i].func)) if (rigCaps.commands.contains(sub[i].func))
queue->add(priorityImmediate, queueItem(sub[i].func, val,false)); queue->add(priorityImmediate, queueItem(sub[i].func, val,false,0));
} else if (params.size() == 1){ } else if (params.size() == 1){
// Not expecting a second argument as it is a get so dump the cache // Not expecting a second argument as it is a get so dump the cache
cacheItem item; cacheItem item;

Wyświetl plik

@ -211,6 +211,7 @@ struct rigCapabilities {
quint8 spectSeqMax; quint8 spectSeqMax;
quint16 spectAmpMax; quint16 spectAmpMax;
quint16 spectLenMax; quint16 spectLenMax;
quint8 numVFO;
bool hasNB = false; bool hasNB = false;
QByteArray nbCommand; QByteArray nbCommand;

Wyświetl plik

@ -399,8 +399,8 @@ Commands\75\Max=0
Commands\75\Command29=false Commands\75\Command29=false
Commands\76\Type=Filter Width Commands\76\Type=Filter Width
Commands\76\String=\\x1a\\x03 Commands\76\String=\\x1a\\x03
Commands\76\Min=0 Commands\76\Min=50
Commands\76\Max=3600 Commands\76\Max=10000
Commands\76\Command29=false Commands\76\Command29=false
Commands\77\Type=Quick Split Commands\77\Type=Quick Split
Commands\77\String=\\x1a\\x05\\x00\\x45 Commands\77\String=\\x1a\\x05\\x00\\x45

Wyświetl plik

@ -304,8 +304,8 @@ Commands\56\Max=0
Commands\56\Command29=false Commands\56\Command29=false
Commands\57\Type=Filter Width Commands\57\Type=Filter Width
Commands\57\String=\\x1a\\x03 Commands\57\String=\\x1a\\x03
Commands\57\Min=0 Commands\57\Min=50
Commands\57\Max=3600 Commands\57\Max=10000
Commands\57\Command29=false Commands\57\Command29=false
Commands\58\Type=Quick Split Commands\58\Type=Quick Split
Commands\58\String=\\x1a\\x05\\x00\\x30 Commands\58\String=\\x1a\\x05\\x00\\x30

Wyświetl plik

@ -6,6 +6,7 @@ Manufacturer=Icom
Model=IC-7610 Model=IC-7610
CIVAddress=152 CIVAddress=152
RigCtlDModel=3078 RigCtlDModel=3078
NumberOfVFOs=2
SpectrumSeqMax=15 SpectrumSeqMax=15
SpectrumAmpMax=200 SpectrumAmpMax=200
SpectrumLenMax=689 SpectrumLenMax=689
@ -424,8 +425,8 @@ Commands\80\Max=0
Commands\80\Command29=false Commands\80\Command29=false
Commands\81\Type=Filter Width Commands\81\Type=Filter Width
Commands\81\String=\\x1a\\x03 Commands\81\String=\\x1a\\x03
Commands\81\Min=0 Commands\81\Min=50
Commands\81\Max=3600 Commands\81\Max=10000
Commands\81\Command29=true Commands\81\Command29=true
Commands\82\Type=Quick Dual Watch Commands\82\Type=Quick Dual Watch
Commands\82\String=\\x1a\\x05\\x00\\x32 Commands\82\String=\\x1a\\x05\\x00\\x32
@ -897,12 +898,12 @@ Modes\8\Min=50
Modes\8\Max=2700 Modes\8\Max=2700
Modes\8\Name=RTTY-R Modes\8\Name=RTTY-R
Modes\9\Num=8 Modes\9\Num=8
Modes\9\Reg=0 Modes\9\Reg=12
Modes\9\Min=50 Modes\9\Min=50
Modes\9\Max=3600 Modes\9\Max=3600
Modes\9\Name=PSK Modes\9\Name=PSK
Modes\10\Num=9 Modes\10\Num=9
Modes\10\Reg=0 Modes\10\Reg=13
Modes\10\Min=50 Modes\10\Min=50
Modes\10\Max=3600 Modes\10\Max=3600
Modes\10\Name=PSK-R Modes\10\Name=PSK-R

Wyświetl plik

@ -424,8 +424,8 @@ Commands\80\Max=0
Commands\80\Command29=false Commands\80\Command29=false
Commands\81\Type=Filter Width Commands\81\Type=Filter Width
Commands\81\String=\\x1a\\x03 Commands\81\String=\\x1a\\x03
Commands\81\Min=0 Commands\81\Min=50
Commands\81\Max=3600 Commands\81\Max=10000
Commands\81\Command29=true Commands\81\Command29=true
Commands\82\Type=Quick Split Commands\82\Type=Quick Split
Commands\82\String=\\x1a\\x05\\x00\\x33 Commands\82\String=\\x1a\\x05\\x00\\x33

Wyświetl plik

@ -379,8 +379,8 @@ Commands\71\Max=0
Commands\71\Command29=false Commands\71\Command29=false
Commands\72\Type=Filter Width Commands\72\Type=Filter Width
Commands\72\String=\\x1a\\x03 Commands\72\String=\\x1a\\x03
Commands\72\Min=0 Commands\72\Min=50
Commands\72\Max=3600 Commands\72\Max=10000
Commands\72\Command29=false Commands\72\Command29=false
Commands\73\Type=Quick Split Commands\73\Type=Quick Split
Commands\73\String=\\x1a\\x05\\x00\\x46 Commands\73\String=\\x1a\\x05\\x00\\x46

Wyświetl plik

@ -89,8 +89,8 @@ Commands\13\Max=1
Commands\13\Command29=false Commands\13\Command29=false
Commands\14\Type=Memory Mode Commands\14\Type=Memory Mode
Commands\14\String=\\x08 Commands\14\String=\\x08
Commands\14\Min=0 Commands\14\Min=1
Commands\14\Max=0 Commands\14\Max=107
Commands\14\Command29=false Commands\14\Command29=false
Commands\15\Type=Scanning Commands\15\Type=Scanning
Commands\15\String=\\x0e Commands\15\String=\\x0e
@ -105,7 +105,7 @@ Commands\16\Command29=false
Commands\17\Type=Tuning Step Commands\17\Type=Tuning Step
Commands\17\String=\\x10 Commands\17\String=\\x10
Commands\17\Min=0 Commands\17\Min=0
Commands\17\Max=0 Commands\17\Max=11
Commands\17\Command29=false Commands\17\Command29=false
Commands\18\Type=Attenuator Status Commands\18\Type=Attenuator Status
Commands\18\String=\\x11 Commands\18\String=\\x11
@ -399,8 +399,8 @@ Commands\75\Max=0
Commands\75\Command29=false Commands\75\Command29=false
Commands\76\Type=Filter Width Commands\76\Type=Filter Width
Commands\76\String=\\x1a\\x03 Commands\76\String=\\x1a\\x03
Commands\76\Min=0 Commands\76\Min=50
Commands\76\Max=3600 Commands\76\Max=10000
Commands\76\Command29=false Commands\76\Command29=false
Commands\77\Type=Quick Split Commands\77\Type=Quick Split
Commands\77\String=\\x1a\\x05\\x00\\x43 Commands\77\String=\\x1a\\x05\\x00\\x43
@ -570,7 +570,7 @@ Commands\109\Command29=false
Commands\110\Type=Scope Main Mode Commands\110\Type=Scope Main Mode
Commands\110\String=\\x27\\x14\\x00 Commands\110\String=\\x27\\x14\\x00
Commands\110\Min=0 Commands\110\Min=0
Commands\110\Max=0 Commands\110\Max=3
Commands\110\Command29=false Commands\110\Command29=false
Commands\111\Type=Scope Main Span Commands\111\Type=Scope Main Span
Commands\111\String=\\x27\\x15\\x00 Commands\111\String=\\x27\\x15\\x00
@ -612,7 +612,7 @@ Commands\118\String=\\x27\\x1d\\x00
Commands\118\Min=0 Commands\118\Min=0
Commands\118\Max=1 Commands\118\Max=1
Commands\118\Command29=false Commands\118\Command29=false
Commands\119\Type=Scope Fixed Freq Commands\119\Type=Scope Fixed Edge Freq
Commands\119\String=\\x27\\x1e Commands\119\String=\\x27\\x1e
Commands\119\Min=1 Commands\119\Min=1
Commands\119\Max=0 Commands\119\Max=0
@ -740,12 +740,12 @@ Modes\8\Min=50
Modes\8\Max=2700 Modes\8\Max=2700
Modes\8\Name=RTTY-R Modes\8\Name=RTTY-R
Modes\9\Num=12 Modes\9\Num=12
Modes\9\Reg=0 Modes\9\Reg=17
Modes\9\Min=0 Modes\9\Min=0
Modes\9\Max=0 Modes\9\Max=0
Modes\9\Name=DV Modes\9\Name=DV
Modes\10\Num=14 Modes\10\Num=14
Modes\10\Reg=0 Modes\10\Reg=22
Modes\10\Min=0 Modes\10\Min=0
Modes\10\Max=0 Modes\10\Max=0
Modes\10\Name=DD Modes\10\Name=DD

Wyświetl plik

@ -291,51 +291,51 @@ spectrumScope::spectrumScope(QWidget *parent)
connect(configLength, &QSlider::valueChanged, this, [=](const int &val) { connect(configLength, &QSlider::valueChanged, this, [=](const int &val) {
prepareWf(val); prepareWf(val);
emit updateSettings(sub,currentTheme,wfLength,plotFloor,plotCeiling); emit updateSettings(vfo,currentTheme,wfLength,plotFloor,plotCeiling);
}); });
connect(configBottom, &QSlider::valueChanged, this, [=](const int &val) { connect(configBottom, &QSlider::valueChanged, this, [=](const int &val) {
this->plotFloor = val; this->plotFloor = val;
this->wfFloor = val; this->wfFloor = val;
this->setRange(plotFloor,plotCeiling); this->setRange(plotFloor,plotCeiling);
emit updateSettings(sub,currentTheme,wfLength,plotFloor,plotCeiling); emit updateSettings(vfo,currentTheme,wfLength,plotFloor,plotCeiling);
}); });
connect(configTop, &QSlider::valueChanged, this, [=](const int &val) { connect(configTop, &QSlider::valueChanged, this, [=](const int &val) {
this->plotCeiling = val; this->plotCeiling = val;
this->wfCeiling = val; this->wfCeiling = val;
this->setRange(plotFloor,plotCeiling); this->setRange(plotFloor,plotCeiling);
emit updateSettings(sub,currentTheme,wfLength,plotFloor,plotCeiling); emit updateSettings(vfo,currentTheme,wfLength,plotFloor,plotCeiling);
}); });
connect(configRef, &QSlider::valueChanged, this, [=](const int &val) { connect(configRef, &QSlider::valueChanged, this, [=](const int &val) {
currentRef = (val/5) * 5; // rounded to "nearest 5" currentRef = (val/5) * 5; // rounded to "nearest 5"
queue->add(priorityImmediate,queueItem(sub?funcScopeSubRef:funcScopeMainRef,QVariant::fromValue(currentRef),false,this->sub)); queue->add(priorityImmediate,queueItem(vfo?funcScopeSubRef:funcScopeMainRef,QVariant::fromValue(currentRef),false,this->vfo));
}); });
connect(configSpeed, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [=](const int &val) { connect(configSpeed, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [=](const int &val) {
queue->add(priorityImmediate,queueItem(sub?funcScopeSubSpeed:funcScopeMainSpeed,configSpeed->itemData(val),false,this->sub)); queue->add(priorityImmediate,queueItem(vfo?funcScopeSubSpeed:funcScopeMainSpeed,configSpeed->itemData(val),false,this->vfo));
}); });
connect(configTheme, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [=](const int &val) { connect(configTheme, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [=](const int &val) {
Q_UNUSED(val) Q_UNUSED(val)
currentTheme = configTheme->currentData().value<QCPColorGradient::GradientPreset>(); currentTheme = configTheme->currentData().value<QCPColorGradient::GradientPreset>();
colorMap->setGradient(currentTheme); colorMap->setGradient(currentTheme);
emit updateSettings(sub,currentTheme,wfLength,plotFloor,plotCeiling); emit updateSettings(vfo,currentTheme,wfLength,plotFloor,plotCeiling);
}); });
connect(configPbtInner, &QSlider::valueChanged, this, [=](const int &val) { connect(configPbtInner, &QSlider::valueChanged, this, [=](const int &val) {
queue->add(priorityImmediate,queueItem(funcPBTInner,QVariant::fromValue<ushort>(val),false,sub)); queue->add(priorityImmediate,queueItem(funcPBTInner,QVariant::fromValue<ushort>(val),false,vfo));
}); });
connect(configPbtOuter, &QSlider::valueChanged, this, [=](const int &val) { connect(configPbtOuter, &QSlider::valueChanged, this, [=](const int &val) {
queue->add(priorityImmediate,queueItem(funcPBTInner,QVariant::fromValue<ushort>(val),false,sub)); queue->add(priorityImmediate,queueItem(funcPBTInner,QVariant::fromValue<ushort>(val),false,vfo));
}); });
connect(configIfShift, &QSlider::valueChanged, this, [=](const int &val) { connect(configIfShift, &QSlider::valueChanged, this, [=](const int &val) {
queue->add(priorityImmediate,queueItem(funcIFShift,QVariant::fromValue<ushort>(val),false,sub)); queue->add(priorityImmediate,queueItem(funcIFShift,QVariant::fromValue<ushort>(val),false,vfo));
}); });
connect(configFilterWidth, &QSlider::valueChanged, this, [=](const int &val) { connect(configFilterWidth, &QSlider::valueChanged, this, [=](const int &val) {
queue->add(priorityImmediate,queueItem(funcFilterWidth,QVariant::fromValue<ushort>(val),false,sub)); queue->add(priorityImmediate,queueItem(funcFilterWidth,QVariant::fromValue<ushort>(val),false,vfo));
}); });
configGroup->setVisible(false); configGroup->setVisible(false);
@ -507,7 +507,7 @@ void spectrumScope::colorPreset(colorPrefsType *cp)
} }
bool spectrumScope::update(scopeData data) bool spectrumScope::updateScope(scopeData data)
{ {
if (!scopePrepared ) if (!scopePrepared )
{ {
@ -532,7 +532,7 @@ bool spectrumScope::update(scopeData data)
preparePlasma(); preparePlasma();
} }
// Inform other threads (cluster) that the frequency range has changed. // Inform other threads (cluster) that the frequency range has changed.
emit frequencyRange(sub, data.startFreq, data.endFreq); emit frequencyRange(vfo, data.startFreq, data.endFreq);
} }
lowerFreq = data.startFreq; lowerFreq = data.startFreq;
@ -757,7 +757,7 @@ bool spectrumScope::update(scopeData data)
oorIndicator->setVisible(false); oorIndicator->setVisible(false);
} }
emit elapsedTime(sub, elapsed.elapsed()); emit elapsedTime(vfo, elapsed.elapsed());
return true; return true;
} }
@ -901,14 +901,14 @@ void spectrumScope::updatedScopeMode(int index)
//spectrumMode_t s = static_cast<spectrumMode_t>(scopeModeCombo->itemData(index).toInt()); //spectrumMode_t s = static_cast<spectrumMode_t>(scopeModeCombo->itemData(index).toInt());
spectrumMode_t s = scopeModeCombo->itemData(index).value<spectrumMode_t>(); spectrumMode_t s = scopeModeCombo->itemData(index).value<spectrumMode_t>();
queue->add(priorityImmediate,queueItem((sub?funcScopeSubMode:funcScopeMainMode),QVariant::fromValue(s),false,sub)); queue->add(priorityImmediate,queueItem((vfo?funcScopeSubMode:funcScopeMainMode),QVariant::fromValue(s),false,vfo));
showHideControls(s); showHideControls(s);
} }
void spectrumScope::updatedSpan(int index) void spectrumScope::updatedSpan(int index)
{ {
queue->add(priorityImmediate,queueItem((sub?funcScopeSubSpan:funcScopeMainSpan),spanCombo->itemData(index),false,sub)); queue->add(priorityImmediate,queueItem((vfo?funcScopeSubSpan:funcScopeMainSpan),spanCombo->itemData(index),false,vfo));
} }
void spectrumScope::updatedMode(int index) void spectrumScope::updatedMode(int index)
@ -916,15 +916,22 @@ void spectrumScope::updatedMode(int index)
Q_UNUSED(index) // We don't know where it came from! Q_UNUSED(index) // We don't know where it came from!
modeInfo mi = modeCombo->currentData().value<modeInfo>(); modeInfo mi = modeCombo->currentData().value<modeInfo>();
mi.filter = filterCombo->currentData().toInt(); mi.filter = filterCombo->currentData().toInt();
if (mi.mk == modeCW || mi.mk == modeCW_R || mi.mk == modeRTTY || mi.mk == modeRTTY_R || mi.mk == modePSK || mi.mk == modePSK_R)
{
mi.data = 0;
dataCombo->setEnabled(false);
} else {
mi.data = dataCombo->currentIndex(); mi.data = dataCombo->currentIndex();
queue->add(priorityImmediate,queueItem((sub?funcUnselectedMode:funcSelectedMode),QVariant::fromValue(mi),false,sub)); dataCombo->setEnabled(true);
}
queue->add(priorityImmediate,queueItem((vfo?funcUnselectedMode:funcSelectedMode),QVariant::fromValue(mi),false,vfo));
} }
void spectrumScope::updatedEdge(int index) void spectrumScope::updatedEdge(int index)
{ {
queue->add(priorityImmediate,queueItem((sub?funcScopeSubEdge:funcScopeMainEdge),QVariant::fromValue<uchar>(index+1),false,sub)); queue->add(priorityImmediate,queueItem((vfo?funcScopeSubEdge:funcScopeMainEdge),QVariant::fromValue<uchar>(index+1),false,vfo));
} }
void spectrumScope::toFixedPressed() void spectrumScope::toFixedPressed()
@ -946,8 +953,8 @@ void spectrumScope::toFixedPressed()
edgeCombo->blockSignals(true); edgeCombo->blockSignals(true);
edgeCombo->setCurrentIndex(edge-1); edgeCombo->setCurrentIndex(edge-1);
edgeCombo->blockSignals(false); edgeCombo->blockSignals(false);
queue->add(priorityImmediate,queueItem(funcScopeFixedEdgeFreq,QVariant::fromValue(spectrumBounds(lowerFreq, upperFreq, edge)),false,sub)); queue->add(priorityImmediate,queueItem(funcScopeFixedEdgeFreq,QVariant::fromValue(spectrumBounds(lowerFreq, upperFreq, edge)),false,vfo));
queue->add(priorityImmediate,queueItem((sub?funcScopeSubMode:funcScopeMainMode),QVariant::fromValue<uchar>(spectrumMode_t::spectModeFixed),false,sub)); queue->add(priorityImmediate,queueItem((vfo?funcScopeSubMode:funcScopeMainMode),QVariant::fromValue<uchar>(spectrumMode_t::spectModeFixed),false,vfo));
} }
} }
} }
@ -1015,7 +1022,7 @@ void spectrumScope::doubleClick(QMouseEvent *me)
freqGo.Hz = roundFrequency(freqGo.Hz, stepSize); freqGo.Hz = roundFrequency(freqGo.Hz, stepSize);
freqGo.MHzDouble = (float)freqGo.Hz / 1E6; freqGo.MHzDouble = (float)freqGo.Hz / 1E6;
setFrequency(freqGo); setFrequency(freqGo);
queue->add(priorityImmediate,queueItem((sub?funcUnselectedFreq:funcSelectedFreq),QVariant::fromValue<freqt>(freqGo),false,sub)); queue->add(priorityImmediate,queueItem((vfo?funcUnselectedFreq:funcSelectedFreq),QVariant::fromValue<freqt>(freqGo),false,vfo));
} }
} }
@ -1027,8 +1034,8 @@ void spectrumScope::doubleClick(QMouseEvent *me)
{ {
double pbFreq = (pbtDefault / passbandWidth) * 127.0; double pbFreq = (pbtDefault / passbandWidth) * 127.0;
qint16 newFreq = pbFreq + 128; qint16 newFreq = pbFreq + 128;
queue->add(priorityImmediate,queueItem(funcPBTInner,QVariant::fromValue<ushort>(newFreq),false,sub)); queue->add(priorityImmediate,queueItem(funcPBTInner,QVariant::fromValue<ushort>(newFreq),false,vfo));
queue->add(priorityImmediate,queueItem(funcPBTOuter,QVariant::fromValue<ushort>(newFreq),false,sub)); queue->add(priorityImmediate,queueItem(funcPBTOuter,QVariant::fromValue<ushort>(newFreq),false,vfo));
} }
} }
} }
@ -1064,7 +1071,7 @@ void spectrumScope::scopeClick(QMouseEvent* me)
freqGo.Hz = (spot.value()->frequency) * 1E6; freqGo.Hz = (spot.value()->frequency) * 1E6;
freqGo.MHzDouble = spot.value()->frequency; freqGo.MHzDouble = spot.value()->frequency;
setFrequency(freqGo); setFrequency(freqGo);
queue->add(priorityImmediate,queueItem((sub?funcUnselectedFreq:funcSelectedFreq),QVariant::fromValue<freqt>(freqGo),false,sub)); queue->add(priorityImmediate,queueItem((vfo?funcUnselectedFreq:funcSelectedFreq),QVariant::fromValue<freqt>(freqGo),false,vfo));
} }
} }
else if (passbandAction == passbandStatic && rectItem != nullptr) else if (passbandAction == passbandStatic && rectItem != nullptr)
@ -1199,7 +1206,7 @@ void spectrumScope::scopeMouseMove(QMouseEvent* me)
else { else {
pb = passbandIndicator->bottomRight->coords().x() - spectrum->xAxis->pixelToCoord(cursor); pb = passbandIndicator->bottomRight->coords().x() - spectrum->xAxis->pixelToCoord(cursor);
} }
queue->add(priorityImmediate,queueItem(funcFilterWidth,QVariant::fromValue<ushort>(pb * 1000000),false,sub)); queue->add(priorityImmediate,queueItem(funcFilterWidth,QVariant::fromValue<ushort>(pb * 1000000),false,vfo));
//qInfo() << "New passband" << uint(pb * 1000000); //qInfo() << "New passband" << uint(pb * 1000000);
lastFreq = movedFrequency; lastFreq = movedFrequency;
@ -1222,8 +1229,8 @@ void spectrumScope::scopeMouseMove(QMouseEvent* me)
if (newInFreq >= 0 && newInFreq <= 255 && newOutFreq >= 0 && newOutFreq <= 255) { if (newInFreq >= 0 && newInFreq <= 255 && newOutFreq >= 0 && newOutFreq <= 255) {
qDebug() << QString("Moving passband by %1 Hz (Inner %2) (Outer %3) Mode:%4").arg((qint16)(movedFrequency * 1000000)) qDebug() << QString("Moving passband by %1 Hz (Inner %2) (Outer %3) Mode:%4").arg((qint16)(movedFrequency * 1000000))
.arg(newInFreq).arg(newOutFreq).arg(mode.mk); .arg(newInFreq).arg(newOutFreq).arg(mode.mk);
queue->add(priorityImmediate,queueItem(funcPBTInner,QVariant::fromValue<ushort>(newInFreq),false,sub)); queue->add(priorityImmediate,queueItem(funcPBTInner,QVariant::fromValue<ushort>(newInFreq),false,vfo));
queue->add(priorityImmediate,queueItem(funcPBTOuter,QVariant::fromValue<ushort>(newOutFreq),false,sub)); queue->add(priorityImmediate,queueItem(funcPBTOuter,QVariant::fromValue<ushort>(newOutFreq),false,vfo));
} }
lastFreq = movedFrequency; lastFreq = movedFrequency;
} }
@ -1234,7 +1241,7 @@ void spectrumScope::scopeMouseMove(QMouseEvent* me)
double pbFreq = ((double)(PBTInner + movedFrequency) / passbandWidth) * 127.0; double pbFreq = ((double)(PBTInner + movedFrequency) / passbandWidth) * 127.0;
qint16 newFreq = pbFreq + 128; qint16 newFreq = pbFreq + 128;
if (newFreq >= 0 && newFreq <= 255) { if (newFreq >= 0 && newFreq <= 255) {
queue->add(priorityImmediate,queueItem(funcPBTInner,QVariant::fromValue<ushort>(newFreq),false,sub)); queue->add(priorityImmediate,queueItem(funcPBTInner,QVariant::fromValue<ushort>(newFreq),false,vfo));
} }
lastFreq = movedFrequency; lastFreq = movedFrequency;
} }
@ -1245,7 +1252,7 @@ void spectrumScope::scopeMouseMove(QMouseEvent* me)
double pbFreq = ((double)(PBTOuter + movedFrequency) / passbandWidth) * 127.0; double pbFreq = ((double)(PBTOuter + movedFrequency) / passbandWidth) * 127.0;
qint16 newFreq = pbFreq + 128; qint16 newFreq = pbFreq + 128;
if (newFreq >= 0 && newFreq <= 255) { if (newFreq >= 0 && newFreq <= 255) {
queue->add(priorityImmediate,queueItem(funcPBTOuter,QVariant::fromValue<ushort>(newFreq),false,sub)); queue->add(priorityImmediate,queueItem(funcPBTOuter,QVariant::fromValue<ushort>(newFreq),false,vfo));
} }
lastFreq = movedFrequency; lastFreq = movedFrequency;
} }
@ -1261,7 +1268,7 @@ void spectrumScope::scopeMouseMove(QMouseEvent* me)
freqGo.Hz = roundFrequency(freqGo.Hz, stepSize); freqGo.Hz = roundFrequency(freqGo.Hz, stepSize);
freqGo.MHzDouble = (float)freqGo.Hz / 1E6; freqGo.MHzDouble = (float)freqGo.Hz / 1E6;
setFrequency(freqGo); setFrequency(freqGo);
queue->add(priorityImmediate,queueItem((sub?funcUnselectedFreq:funcSelectedFreq),QVariant::fromValue<freqt>(freqGo),false,sub)); queue->add(priorityImmediate,queueItem((vfo?funcUnselectedFreq:funcSelectedFreq),QVariant::fromValue<freqt>(freqGo),false,vfo));
} }
} }
else { else {
@ -1335,7 +1342,7 @@ void spectrumScope::scroll(QWheelEvent *we)
freq = f; // Do we need to do this? freq = f; // Do we need to do this?
setFrequency(f); setFrequency(f);
queue->add(priorityImmediate,queueItem((sub?funcUnselectedFreq:funcSelectedFreq),QVariant::fromValue<freqt>(f),false,sub)); queue->add(priorityImmediate,queueItem((vfo?funcUnselectedFreq:funcSelectedFreq),QVariant::fromValue<freqt>(f),false,vfo));
//qInfo() << "Moving to freq:" << f.Hz << "step" << stepsHz; //qInfo() << "Moving to freq:" << f.Hz << "step" << stepsHz;
scrollWheelOffsetAccumulated = 0; scrollWheelOffsetAccumulated = 0;
} }
@ -1350,7 +1357,7 @@ void spectrumScope::receiveMode(modeInfo m)
{ {
qInfo(logSystem()) << __func__ << QString("Received new mode for %0: %1 (%2) filter:%3 data:%4") qInfo(logSystem()) << __func__ << QString("Received new mode for %0: %1 (%2) filter:%3 data:%4")
.arg((sub?"Sub":"Main")).arg(QString::number(m.mk,16)).arg(m.name).arg(m.filter).arg(m.data) ; .arg((vfo?"Sub":"Main")).arg(QString::number(m.mk,16)).arg(m.name).arg(m.filter).arg(m.data) ;
if (mode.mk != m.mk) { if (mode.mk != m.mk) {
for (int i=0;i<modeCombo->count();i++) for (int i=0;i<modeCombo->count();i++)
@ -1381,6 +1388,13 @@ void spectrumScope::receiveMode(modeInfo m)
dataCombo->blockSignals(false); dataCombo->blockSignals(false);
} }
if (m.mk == modeCW || m.mk == modeCW_R || m.mk == modeRTTY || m.mk == modeRTTY_R || m.mk == modePSK || m.mk == modePSK_R)
{
dataCombo->setEnabled(false);
} else {
dataCombo->setEnabled(true);
}
if (m.mk != mode.mk) { if (m.mk != mode.mk) {
// We have changed mode so "may" need to change regular commands // We have changed mode so "may" need to change regular commands
@ -1394,13 +1408,13 @@ void spectrumScope::receiveMode(modeInfo m)
// If new mode doesn't allow bandwidth control, disable filterwidth and pbt. // If new mode doesn't allow bandwidth control, disable filterwidth and pbt.
if (m.bwMin > 0 && m.bwMax > 0) { if (m.bwMin > 0 && m.bwMax > 0) {
queue->addUnique(priorityHigh,funcPBTInner,true,sub); queue->addUnique(priorityHigh,funcPBTInner,true,vfo);
queue->addUnique(priorityHigh,funcPBTOuter,true,sub); queue->addUnique(priorityHigh,funcPBTOuter,true,vfo);
queue->addUnique(priorityHigh,funcFilterWidth,true,sub); queue->addUnique(priorityHigh,funcFilterWidth,true,vfo);
} else{ } else{
queue->del(funcPBTInner,sub); queue->del(funcPBTInner,vfo);
queue->del(funcPBTOuter,sub); queue->del(funcPBTOuter,vfo);
queue->del(funcFilterWidth,sub); queue->del(funcFilterWidth,vfo);
} }
switch (m.mk) { switch (m.mk) {
@ -1412,15 +1426,15 @@ void spectrumScope::receiveMode(modeInfo m)
case modePSK: case modePSK:
case modePSK_R: case modePSK_R:
case modeAM: case modeAM:
queue->del(funcCwPitch,sub); queue->del(funcCwPitch,vfo);
queue->del(funcDashRatio,sub); queue->del(funcDashRatio,vfo);
queue->del(funcKeySpeed,sub); queue->del(funcKeySpeed,vfo);
break; break;
case modeCW: case modeCW:
case modeCW_R: case modeCW_R:
queue->addUnique(priorityLow,funcCwPitch,true,sub); queue->addUnique(priorityLow,funcCwPitch,true,vfo);
queue->addUnique(priorityLow,funcDashRatio,true,sub); queue->addUnique(priorityLow,funcDashRatio,true,vfo);
queue->addUnique(priorityLow,funcKeySpeed,true,sub); queue->addUnique(priorityLow,funcKeySpeed,true,vfo);
break; break;
default: default:
// FM and digital modes are fixed width, not sure about any other modes? // FM and digital modes are fixed width, not sure about any other modes?
@ -1431,9 +1445,9 @@ void spectrumScope::receiveMode(modeInfo m)
else else
passbandWidth = 0.007; passbandWidth = 0.007;
break; break;
queue->del(funcCwPitch,sub); queue->del(funcCwPitch,vfo);
queue->del(funcDashRatio,sub); queue->del(funcDashRatio,vfo);
queue->del(funcKeySpeed,sub); queue->del(funcKeySpeed,vfo);
break; break;
} }
@ -1474,7 +1488,7 @@ void spectrumScope::receiveCwPitch(uchar pitch)
if (p != cwPitch) if (p != cwPitch)
{ {
passbandCenterFrequency = p / 2000000.0; passbandCenterFrequency = p / 2000000.0;
qInfo(logSystem()) << QString("%0 Received new CW Pitch %1 Hz was %2 (center freq %3 MHz)").arg((sub?"Sub":"Main")).arg(p).arg(cwPitch).arg(passbandCenterFrequency); qInfo(logSystem()) << QString("%0 Received new CW Pitch %1 Hz was %2 (center freq %3 MHz)").arg((vfo?"Sub":"Main")).arg(p).arg(cwPitch).arg(passbandCenterFrequency);
cwPitch = p; cwPitch = p;
} }
} }
@ -1486,8 +1500,8 @@ void spectrumScope::receivePassband(quint16 pass)
if (passbandWidth != pb) { if (passbandWidth != pb) {
passbandWidth = pb; passbandWidth = pb;
//trxadj->updatePassband(pass); //trxadj->updatePassband(pass);
qInfo(logSystem()) << QString("%0 Received new IF Filter/Passband %1 Hz").arg(sub?"Sub":"Main").arg(pass); qInfo(logSystem()) << QString("%0 Received new IF Filter/Passband %1 Hz").arg(vfo?"Sub":"Main").arg(pass);
emit showStatusBarText(QString("%0 IF filter width %1 Hz (%2 MHz)").arg(sub?"Sub":"Main").arg(pass).arg(passbandWidth)); emit showStatusBarText(QString("%0 IF filter width %1 Hz (%2 MHz)").arg(vfo?"Sub":"Main").arg(pass).arg(passbandWidth));
} }
} }
@ -1502,7 +1516,7 @@ void spectrumScope::selected(bool en)
void spectrumScope::holdPressed(bool en) void spectrumScope::holdPressed(bool en)
{ {
queue->add(priorityImmediate,queueItem(sub?funcScopeSubHold:funcScopeMainHold,QVariant::fromValue(en),false,sub)); queue->add(priorityImmediate,queueItem(vfo?funcScopeSubHold:funcScopeMainHold,QVariant::fromValue(en),false,vfo));
} }
void spectrumScope::setHold(bool h) void spectrumScope::setHold(bool h)
@ -1519,8 +1533,11 @@ void spectrumScope::setSpeed(uchar s)
} }
void spectrumScope::receiveSpots(QList<spotData> spots) void spectrumScope::receiveSpots(uchar vfo, QList<spotData> spots)
{ {
if (vfo != this->vfo) {
return;
}
//QElapsedTimer timer; //QElapsedTimer timer;
//timer.start(); //timer.start();
bool current = false; bool current = false;
@ -1606,7 +1623,6 @@ void spectrumScope::receiveSpots(QList<spotData> spots)
} }
//qDebug(logCluster()) << "Processing took" << timer.nsecsElapsed() / 1000 << "us"; //qDebug(logCluster()) << "Processing took" << timer.nsecsElapsed() / 1000 << "us";
} }
void spectrumScope::configPressed() void spectrumScope::configPressed()
@ -1672,7 +1688,7 @@ void spectrumScope::newFrequency(qint64 freq)
f.MHzDouble = f.Hz / (double)1E6; f.MHzDouble = f.Hz / (double)1E6;
if (f.Hz > 0) if (f.Hz > 0)
{ {
queue->add(priorityImmediate,queueItem((sub?funcUnselectedFreq:funcSelectedFreq),QVariant::fromValue<freqt>(f),false,sub)); queue->add(priorityImmediate,queueItem((vfo?funcUnselectedFreq:funcSelectedFreq),QVariant::fromValue<freqt>(f),false,vfo));
} }
} }
@ -1690,20 +1706,20 @@ void spectrumScope::detachScope(bool state)
{ {
if (state) if (state)
{ {
windowLabel = new QLabel("Detached to window"); windowLabel = new QLabel();
detachButton->setText("Attach"); detachButton->setText("Attach");
qInfo(logGui()) << "Detaching scope" << (sub?"Sub":"Main"); qInfo(logGui()) << "Detaching scope" << (vfo?"Sub":"Main");
this->parentWidget()->layout()->replaceWidget(this,windowLabel); this->parentWidget()->layout()->replaceWidget(this,windowLabel);
this->setParent(NULL); this->setParent(NULL);
this-> setWindowFlags(Qt::Window | Qt::WindowMinimizeButtonHint | Qt::WindowMaximizeButtonHint); this-> setWindowFlags(Qt::Window | Qt::WindowMinimizeButtonHint | Qt::WindowMaximizeButtonHint);
this->move(screen()->geometry().center() - frameGeometry().center()); this->move(screen()->geometry().center() - frameGeometry().center());
this->repaint();
} else { } else {
detachButton->setText("Detach"); detachButton->setText("Detach");
qInfo(logGui()) << "Attaching scope" << (sub?"Sub":"Main"); qInfo(logGui()) << "Attaching scope" << (vfo?"Sub":"Main");
windowLabel->parentWidget()->layout()->replaceWidget(windowLabel,this); windowLabel->parentWidget()->layout()->replaceWidget(windowLabel,this);
windowLabel->setParent(NULL); windowLabel->setParent(NULL);
delete windowLabel; delete windowLabel;
this->repaint();
} }
// Force a redraw?
this->show();
} }

Wyświetl plik

@ -34,7 +34,7 @@ public:
bool prepareWf(uint wfLength); bool prepareWf(uint wfLength);
void prepareScope(uint ampMap, uint spectWidth); void prepareScope(uint ampMap, uint spectWidth);
bool update(scopeData spectrum); bool updateScope(scopeData spectrum);
void preparePlasma(); void preparePlasma();
void setRange(int floor, int ceiling); void setRange(int floor, int ceiling);
void wfInterpolate(bool en) { colorMap->setInterpolate(en); } void wfInterpolate(bool en) { colorMap->setInterpolate(en); }
@ -51,8 +51,8 @@ public:
void setPassbandWidth(double hz) { passbandWidth = hz;} void setPassbandWidth(double hz) { passbandWidth = hz;}
double getPassbandWidth() { configFilterWidth->setValue(passbandWidth*1E6); return passbandWidth;} double getPassbandWidth() { configFilterWidth->setValue(passbandWidth*1E6); return passbandWidth;}
void setIdentity(QString name, bool s) {this->setTitle(name), sub = s;} void setIdentity(QString name, uchar v) {this->setTitle(name), vfo = v;}
bool getSub() { return sub;} bool getVfo() { return vfo;}
void setTuningFloorZeros(bool tf) {this->tuningFloorZeros = tf;} void setTuningFloorZeros(bool tf) {this->tuningFloorZeros = tf;}
void setClickDragTuning(bool cg) { this->clickDragTuning = cg;} void setClickDragTuning(bool cg) { this->clickDragTuning = cg;}
@ -77,7 +77,7 @@ public:
void setFrequency (freqt f); void setFrequency (freqt f);
void receiveMode (modeInfo m); void receiveMode (modeInfo m);
modeInfo currentMode() {return mode;};
void clearSpans() { spanCombo->clear();} void clearSpans() { spanCombo->clear();}
void clearMode() { modeCombo->clear();} void clearMode() { modeCombo->clear();}
void clearData() { dataCombo->clear();} void clearData() { dataCombo->clear();}
@ -100,15 +100,15 @@ public:
public slots: // Can be called directly or updated via signal/slot public slots: // Can be called directly or updated via signal/slot
void selectScopeMode(spectrumMode_t m); void selectScopeMode(spectrumMode_t m);
void selectSpan(centerSpanData s); void selectSpan(centerSpanData s);
void receiveSpots(QList<spotData> spots); void receiveSpots(uchar vfo, QList<spotData> spots);
signals: signals:
void frequencyRange(bool sub, double start, double end); void frequencyRange(uchar vfo, double start, double end);
void updateScopeMode(spectrumMode_t index); void updateScopeMode(spectrumMode_t index);
void updateSpan(centerSpanData s); void updateSpan(centerSpanData s);
void showStatusBarText(QString text); void showStatusBarText(QString text);
void updateSettings(bool sub, int value, quint16 len, int floor, int ceiling); void updateSettings(uchar vfo, int value, quint16 len, int floor, int ceiling);
void elapsedTime(bool sub, qint64 ns); void elapsedTime(uchar vfo, qint64 ns);
void dataChanged(modeInfo m); void dataChanged(modeInfo m);
private slots: private slots:
@ -261,7 +261,7 @@ private:
QVector <QByteArray> wfimage; QVector <QByteArray> wfimage;
cachingQueue* queue; cachingQueue* queue;
bool sub=false; uchar vfo=0;
double startFrequency; double startFrequency;
QMap<QString, spotData*> clusterSpots; QMap<QString, spotData*> clusterSpots;

Wyświetl plik

@ -137,7 +137,7 @@ tciServer::~tciServer()
server->close(); server->close();
auto it = clients.begin(); auto it = clients.begin();
if (it != clients.end()) while (it != clients.end())
{ {
it.key()->deleteLater(); it.key()->deleteLater();
it = clients.erase(it); it = clients.erase(it);
@ -228,7 +228,8 @@ void tciServer::processIncomingTextMessage(QString message)
else if (cmd == "trx" ) { else if (cmd == "trx" ) {
if (arg.size() == 1) { if (arg.size() == 1) {
it.value().rxaudio=false; it.value().rxaudio=false;
reply = QString("trx:%0,%1;").arg(QString::number(sub)).arg(queue->getCache(funcTransceiverStatus).value.value<bool>()?"true":"false"); reply = QString("trx:%0,%1;").arg(
QString::number(sub),queue->getCache(funcTransceiverStatus).value.value<bool>()?"true":"false");
} }
else if (arg.size() > 1) { else if (arg.size() > 1) {
bool on = arg[1]=="true"?true:false; bool on = arg[1]=="true"?true:false;
@ -238,7 +239,7 @@ void tciServer::processIncomingTextMessage(QString message)
else if (cmd == "vfo") else if (cmd == "vfo")
{ {
if (arg.size() == 2) { if (arg.size() == 2) {
reply = QString("%0:%1,%2,%3;").arg(cmd).arg(arg[0]).arg(arg[1]) reply = QString("%0:%1,%2,%3;").arg(cmd,arg[0],arg[1])
.arg(queue->getCache(sub?funcUnselectedFreq:funcSelectedFreq,sub).value.value<freqt>().Hz); .arg(queue->getCache(sub?funcUnselectedFreq:funcSelectedFreq,sub).value.value<freqt>().Hz);
} }
else if (arg.size() == 3) { else if (arg.size() == 3) {
@ -252,13 +253,13 @@ void tciServer::processIncomingTextMessage(QString message)
else if (cmd == "modulation") else if (cmd == "modulation")
{ {
if (arg.size() == 1) { if (arg.size() == 1) {
reply = QString("modulation:%0,%1;").arg(QString::number(sub)) reply = QString("modulation:%0,%1;").arg(
.arg(queue->getCache(sub?funcUnselectedMode:funcSelectedMode,sub).value.value<modeInfo>().name.toLower()); QString::number(sub),queue->getCache(sub?funcUnselectedMode:funcSelectedMode,sub).value.value<modeInfo>().name.toLower());
} }
else if (arg.size() == 2) { else if (arg.size() == 2) {
qInfo() << "Mode (TODO)" << arg[1]; qInfo() << "Mode (TODO)" << arg[1];
reply = QString("modulation:%0,%1;").arg(QString::number(sub)) reply = QString("modulation:%0,%1;").arg(
.arg(queue->getCache(sub?funcUnselectedMode:funcSelectedMode,sub).value.value<modeInfo>().name.toLower()); QString::number(sub),queue->getCache(sub?funcUnselectedMode:funcSelectedMode,sub).value.value<modeInfo>().name.toLower());
/* /*
freqt f; freqt f;
f.Hz = arg[2].toUInt(); f.Hz = arg[2].toUInt();
@ -357,15 +358,15 @@ void tciServer::receiveCache(cacheItem item)
case funcFreqTR: case funcFreqTR:
case funcSelectedFreq: case funcSelectedFreq:
case funcUnselectedFreq: case funcUnselectedFreq:
reply = QString("vfo:0,%0,%1;").arg(QString::number(item.sub)).arg(item.value.value<freqt>().Hz); reply = QString("vfo:0,%0,%1;").arg(QString::number(item.vfo),item.value.value<freqt>().Hz);
break; break;
case funcModeTR: case funcModeTR:
case funcSelectedMode: case funcSelectedMode:
case funcUnselectedMode: case funcUnselectedMode:
reply = QString("modulation:%0,%1;").arg(QString::number(item.sub)).arg(item.value.value<modeInfo>().name.toLower()); reply = QString("modulation:%0,%1;").arg(QString::number(item.vfo),item.value.value<modeInfo>().name.toLower());
break; break;
case funcTransceiverStatus: case funcTransceiverStatus:
reply = QString("trx:%0,%1;").arg(QString::number(item.sub)).arg(item.value.value<bool>()?"true":"false"); reply = QString("trx:%0,%1;").arg(QString::number(item.vfo),item.value.value<bool>()?"true":"false");
break; break;
default: default:
break; break;

Plik diff jest za duży Load Diff

Wyświetl plik

@ -329,7 +329,7 @@ private slots:
void extChangedUdpPref(prefUDPItem i); void extChangedUdpPref(prefUDPItem i);
void extChangedServerPref(prefServerItem i); void extChangedServerPref(prefServerItem i);
void receiveScopeSettings(bool sub, int theme, quint16 len, int floor, int ceiling); void receiveScopeSettings(uchar vfo, int theme, quint16 len, int floor, int ceiling);
void receiveValue(cacheItem val); void receiveValue(cacheItem val);
void setAudioDevicesUI(); void setAudioDevicesUI();
void shortcutF1(); void shortcutF1();
@ -381,8 +381,6 @@ private slots:
//void receiveDuplexMode(duplexMode_t dm); //void receiveDuplexMode(duplexMode_t dm);
void receivePassband(quint16 pass); void receivePassband(quint16 pass);
void receiveCwPitch(unsigned char pitch); void receiveCwPitch(unsigned char pitch);
void receivePBTInner(unsigned char level);
void receivePBTOuter(unsigned char level);
void receiveVox(bool en); void receiveVox(bool en);
void receiveMonitor(bool en); void receiveMonitor(bool en);
void receiveComp(bool en); void receiveComp(bool en);
@ -498,7 +496,8 @@ private slots:
void receiveElapsed(bool sub, qint64 us); void receiveElapsed(bool sub, qint64 us);
private: private:
Ui::wfmain *ui; Ui::wfmain *ui; // Main UI
QList<spectrumScope*>vfos; // Spectrum Scope/VFO item.
void closeEvent(QCloseEvent *event); void closeEvent(QCloseEvent *event);
QString logFilename; QString logFilename;
bool debugMode; bool debugMode;
@ -521,7 +520,6 @@ private:
QCPItemText* ovfIndicator; QCPItemText* ovfIndicator;
void setAppTheme(bool isCustom); void setAppTheme(bool isCustom);
void showHideSpectrum(bool show);
void getInitialRigState(); void getInitialRigState();
void showButton(QPushButton *btn); void showButton(QPushButton *btn);
void hideButton(QPushButton *btn); void hideButton(QPushButton *btn);
@ -600,7 +598,7 @@ private:
void setupKeyShortcuts(); void setupKeyShortcuts();
void setupMainUI(); void setupMainUI();
void setUIToPrefs(); void configureVFOs();
void setSerialDevicesUI(); void setSerialDevicesUI();
void setServerToPrefs(); void setServerToPrefs();
void setupUsbControllerDevice(); void setupUsbControllerDevice();
@ -809,6 +807,7 @@ private:
audioDevices* audioDev = Q_NULLPTR; audioDevices* audioDev = Q_NULLPTR;
QImage lcdImage; QImage lcdImage;
connectionStatus_t connStatus = connDisconnected; connectionStatus_t connStatus = connDisconnected;
}; };
Q_DECLARE_METATYPE(udpPreferences) Q_DECLARE_METATYPE(udpPreferences)

Wyświetl plik

@ -49,36 +49,10 @@
<number>3</number> <number>3</number>
</property> </property>
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout_3"> <layout class="QVBoxLayout" name="vfoLayout">
<property name="spacing"> <property name="spacing">
<number>0</number> <number>0</number>
</property> </property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<property name="spacing">
<number>0</number>
</property>
<property name="sizeConstraint">
<enum>QLayout::SetNoConstraint</enum>
</property>
<item>
<widget class="spectrumScope" name="mainScope" native="true"/>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_9">
<property name="spacing">
<number>0</number>
</property>
<property name="sizeConstraint">
<enum>QLayout::SetNoConstraint</enum>
</property>
<item>
<widget class="spectrumScope" name="subScope" native="true"/>
</item>
</layout>
</item>
</layout> </layout>
</item> </item>
<item> <item>
@ -1282,12 +1256,6 @@
<header>meter.h</header> <header>meter.h</header>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
<customwidget>
<class>spectrumScope</class>
<extends>QWidget</extends>
<header>spectrumscope.h</header>
<container>1</container>
</customwidget>
</customwidgets> </customwidgets>
<resources/> <resources/>
<connections/> <connections/>