Do not pass around speed name, use submode int

This commit is contained in:
Jordan Sherer 2019-11-09 09:48:09 -05:00
parent 305c0fdb12
commit b8ccd5d810
2 changed files with 79 additions and 82 deletions

View File

@ -1234,8 +1234,8 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
auto items = m_bandActivity.value(selectedOffset); auto items = m_bandActivity.value(selectedOffset);
if(!items.isEmpty()){ if(!items.isEmpty()){
auto speed = items.last().speed; int submode = items.last().submode;
int submode = speedNameToSubmode(speed); auto speed = submodeName(submode);
if(submode != m_nSubMode){ if(submode != m_nSubMode){
auto qrqAction = menu->addAction(QString("Jump to %1%2 speed").arg(speed.left(1)).arg(speed.mid(1).toLower())); auto qrqAction = menu->addAction(QString("Jump to %1%2 speed").arg(speed.left(1)).arg(speed.mid(1).toLower()));
connect(qrqAction, &QAction::triggered, this, [this, submode](){ connect(qrqAction, &QAction::triggered, this, [this, submode](){
@ -1426,7 +1426,7 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
d.relayPath = d.from; d.relayPath = d.from;
d.text = m->textValue(); d.text = m->textValue();
d.utcTimestamp = DriftingDateTime::currentDateTimeUtc(); d.utcTimestamp = DriftingDateTime::currentDateTimeUtc();
d.speed = modeSpeedName(m_nSubMode); d.submode = m_nSubMode;
addCommandToStorage("STORE", d); addCommandToStorage("STORE", d);
}); });
@ -1465,8 +1465,8 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
}); });
auto speed = m_callActivity[selectedCall].speed; int submode = m_callActivity[selectedCall].submode;
int submode = speedNameToSubmode(speed); auto speed = submodeName(submode);
if(submode != m_nSubMode){ if(submode != m_nSubMode){
auto qrqAction = menu->addAction(QString("Jump to %1%2 speed").arg(speed.left(1)).arg(speed.mid(1).toLower())); auto qrqAction = menu->addAction(QString("Jump to %1%2 speed").arg(speed.left(1)).arg(speed.mid(1).toLower()));
connect(qrqAction, &QAction::triggered, this, [this, submode](){ connect(qrqAction, &QAction::triggered, this, [this, submode](){
@ -1910,7 +1910,7 @@ void MainWindow::initializeDummyData(){
cd.utcTimestamp = dt; cd.utcTimestamp = dt;
cd.grid = i == 5 ? "J042" : i == 6 ? " FN42FN42FN" : ""; cd.grid = i == 5 ? "J042" : i == 6 ? " FN42FN42FN" : "";
cd.tdrift = 0.1*i; cd.tdrift = 0.1*i;
cd.speed = modeSpeedName(i % 4); cd.submode = i % 4;
logCallActivity(cd, false); logCallActivity(cd, false);
ActivityDetail ad = {}; ActivityDetail ad = {};
@ -1919,7 +1919,7 @@ void MainWindow::initializeDummyData(){
ad.freq = 500 + 100*i; ad.freq = 500 + 100*i;
ad.text = QString("%1: %2 TEST MESSAGE").arg(call).arg(m_config.my_callsign()); ad.text = QString("%1: %2 TEST MESSAGE").arg(call).arg(m_config.my_callsign());
ad.utcTimestamp = dt; ad.utcTimestamp = dt;
ad.speed = cd.speed; ad.submode = cd.submode;
m_bandActivity[500+100*i] = { ad }; m_bandActivity[500+100*i] = { ad };
markOffsetDirected(500+100*i, false); markOffsetDirected(500+100*i, false);
@ -1933,7 +1933,7 @@ void MainWindow::initializeDummyData(){
adHB1.freq = 750; adHB1.freq = 750;
adHB1.text = QString("KN4CRD: HB AUTO EM73"); adHB1.text = QString("KN4CRD: HB AUTO EM73");
adHB1.utcTimestamp = DriftingDateTime::currentDateTimeUtc(); adHB1.utcTimestamp = DriftingDateTime::currentDateTimeUtc();
adHB1.speed = "NORMAL"; adHB1.submode = Varicode::JS8CallNormal;
m_bandActivity[750].append(adHB1); m_bandActivity[750].append(adHB1);
ActivityDetail adHB2 = {}; ActivityDetail adHB2 = {};
@ -1942,7 +1942,7 @@ void MainWindow::initializeDummyData(){
adHB2.freq = 750; adHB2.freq = 750;
adHB2.text = QString(" MSG ID 1"); adHB2.text = QString(" MSG ID 1");
adHB2.utcTimestamp = DriftingDateTime::currentDateTimeUtc(); adHB2.utcTimestamp = DriftingDateTime::currentDateTimeUtc();
adHB2.speed = "NORMAL"; adHB2.submode = Varicode::JS8CallNormal;
m_bandActivity[750].append(adHB2); m_bandActivity[750].append(adHB2);
CommandDetail cmd = {}; CommandDetail cmd = {};
@ -1952,7 +1952,7 @@ void MainWindow::initializeDummyData(){
cmd.relayPath = "N0JDS>OH8STN"; cmd.relayPath = "N0JDS>OH8STN";
cmd.text = "HELLO BRAVE SOUL"; cmd.text = "HELLO BRAVE SOUL";
cmd.utcTimestamp = dt; cmd.utcTimestamp = dt;
cmd.speed = "NORMAL"; cmd.submode = Varicode::JS8CallNormal;
addCommandToMyInbox(cmd); addCommandToMyInbox(cmd);
QString eot = m_config.eot(); QString eot = m_config.eot();
@ -2254,7 +2254,7 @@ void MainWindow::writeSettings()
{"ackTimestamp", QVariant(cd.ackTimestamp)}, {"ackTimestamp", QVariant(cd.ackTimestamp)},
{"utcTimestamp", QVariant(cd.utcTimestamp)}, {"utcTimestamp", QVariant(cd.utcTimestamp)},
#endif #endif
{"mode", QVariant(cd.speed)}, {"submode", QVariant(cd.submode)},
}); });
} }
m_settings->endGroup(); m_settings->endGroup();
@ -2434,7 +2434,7 @@ void MainWindow::readSettings()
auto ackTimestamp = values.value("ackTimestamp").toDateTime(); auto ackTimestamp = values.value("ackTimestamp").toDateTime();
auto utcTimestamp = values.value("utcTimestamp").toDateTime(); auto utcTimestamp = values.value("utcTimestamp").toDateTime();
#endif #endif
auto mode = values.value("mode", "JS8").toString(); auto submode = values.value("submode", Varicode::JS8CallNormal).toInt();
CallDetail cd = {}; CallDetail cd = {};
cd.call = call; cd.call = call;
@ -2444,7 +2444,7 @@ void MainWindow::readSettings()
cd.tdrift = tdrift; cd.tdrift = tdrift;
cd.ackTimestamp = ackTimestamp; cd.ackTimestamp = ackTimestamp;
cd.utcTimestamp = utcTimestamp; cd.utcTimestamp = utcTimestamp;
cd.speed = mode; cd.submode = submode;
logCallActivity(cd, false); logCallActivity(cd, false);
} }
@ -2676,8 +2676,6 @@ void MainWindow::dataSink(qint64 frames)
dec_data.params.nagain=0; dec_data.params.nagain=0;
dec_data.params.nzhsym=m_ihsym; dec_data.params.nzhsym=m_ihsym;
qDebug() << "dataSink k" << k;
decode(); decode();
} }
@ -3265,19 +3263,19 @@ void MainWindow::setSubmode(int submode){
on_actionJS8_triggered(); on_actionJS8_triggered();
} }
int MainWindow::speedNameToSubmode(QString speedName){ int MainWindow::submodeNameToSubmode(QString speedName){
auto speed = speedName.toUpper().trimmed(); auto speed = speedName.toUpper().trimmed();
if(speed == modeSpeedName(Varicode::JS8CallNormal)){ if(speed == submodeName(Varicode::JS8CallNormal)){
return Varicode::JS8CallNormal; return Varicode::JS8CallNormal;
} }
if(speed == modeSpeedName(Varicode::JS8CallFast)){ if(speed == submodeName(Varicode::JS8CallFast)){
return Varicode::JS8CallFast; return Varicode::JS8CallFast;
} }
if(speed == modeSpeedName(Varicode::JS8CallTurbo)){ if(speed == submodeName(Varicode::JS8CallTurbo)){
return Varicode::JS8CallTurbo; return Varicode::JS8CallTurbo;
} }
if(speed == modeSpeedName(Varicode::JS8CallUltraSlow)){ if(speed == submodeName(Varicode::JS8CallUltraSlow)){
return Varicode::JS8CallUltraSlow; return Varicode::JS8CallUltraSlow;
} }
// default to the current submode // default to the current submode
@ -3285,7 +3283,7 @@ int MainWindow::speedNameToSubmode(QString speedName){
} }
QString MainWindow::modeSpeedName(int submode){ QString MainWindow::submodeName(int submode){
if(submode == Varicode::JS8CallNormal){ if(submode == Varicode::JS8CallNormal){
return "NORMAL"; return "NORMAL";
} }
@ -3982,7 +3980,9 @@ void MainWindow::decode(){
} }
bool MainWindow::decodeReady(int submode, int period, int *pSubmode, int *pPeriod){ bool MainWindow::decodeReady(int submode, int period, int *pSubmode, int *pPeriod){
qDebug() << "decoder checking if ready..."; int k = dec_data.params.kin;
qDebug() << "decoder checking if ready..." << "k" << k;
if(m_decoderBusy){ if(m_decoderBusy){
qDebug() << "decoder busy"; qDebug() << "decoder busy";
@ -3995,8 +3995,6 @@ bool MainWindow::decodeReady(int submode, int period, int *pSubmode, int *pPerio
} }
#if JS8_RING_BUFFER #if JS8_RING_BUFFER
int k = dec_data.params.kin;
static int lastKA = -1; static int lastKA = -1;
static qint32 lastCycleA = -1; static qint32 lastCycleA = -1;
qint32 cycleA = computeCurrentCycle(JS8A_TX_SECONDS); qint32 cycleA = computeCurrentCycle(JS8A_TX_SECONDS);
@ -4450,23 +4448,7 @@ void MainWindow::readFromStdout() //readFromStdout
DecodedText decodedtext {QString::fromUtf8 (t.constData ()).remove (QRegularExpression {"\r|\n"}), "FT8" == m_mode && DecodedText decodedtext {QString::fromUtf8 (t.constData ()).remove (QRegularExpression {"\r|\n"}), "FT8" == m_mode &&
ui->cbVHFcontest->isChecked(), m_config.my_grid ()}; ui->cbVHFcontest->isChecked(), m_config.my_grid ()};
int snr = decodedtext.snr(); bool bValidFrame = decodedtext.snr() >= rxSnrThreshold(decodedtext.submode());
bool bValidFrame = snr >= -28;
// these are baseline thresholds for valid frames
switch(decodedtext.submode()){
case Varicode::JS8CallNormal:
bValidFrame = snr >= -24; break;
case Varicode::JS8CallFast:
bValidFrame = snr >= -22; break;
case Varicode::JS8CallTurbo:
bValidFrame = snr >= -20; break;
#if JS8E_IS_ULTRA
case Varicode::JS8CallUltraSlow:
bValidFrame = snr >= -18; break;
break;
#endif
}
// dupe check // dupe check
auto frame = decodedtext.message(); auto frame = decodedtext.message();
@ -4483,7 +4465,7 @@ void MainWindow::readFromStdout() //readFromStdout
m_messageDupeCache[frame] = frameOffset; m_messageDupeCache[frame] = frameOffset;
} }
qDebug() << "valid" << bValidFrame << decodedtext.submode() << "decoded text" << decodedtext.message(); qDebug() << "valid" << bValidFrame << submodeName(decodedtext.submode()) << "decoded text" << decodedtext.message();
// skip if invalid // skip if invalid
if(!bValidFrame) { if(!bValidFrame) {
@ -4526,7 +4508,7 @@ void MainWindow::readFromStdout() //readFromStdout
d.snr = decodedtext.snr(); d.snr = decodedtext.snr();
d.isBuffered = false; d.isBuffered = false;
d.tdrift = decodedtext.dt(); d.tdrift = decodedtext.dt();
d.speed = modeSpeedName(decodedtext.submode()); d.submode = decodedtext.submode();
// if we have any "first" frame, and a buffer is already established, clear it... // if we have any "first" frame, and a buffer is already established, clear it...
int prevBufferOffset = -1; int prevBufferOffset = -1;
@ -4563,7 +4545,7 @@ void MainWindow::readFromStdout() //readFromStdout
cd.utcTimestamp = DriftingDateTime::currentDateTimeUtc(); cd.utcTimestamp = DriftingDateTime::currentDateTimeUtc();
cd.bits = decodedtext.bits(); cd.bits = decodedtext.bits();
cd.tdrift = decodedtext.dt(); cd.tdrift = decodedtext.dt();
cd.speed = modeSpeedName(decodedtext.submode()); cd.submode = decodedtext.submode();
// Only respond to HEARTBEATS...remember that CQ messages are "Alt" pings // Only respond to HEARTBEATS...remember that CQ messages are "Alt" pings
if(decodedtext.isHeartbeat()){ if(decodedtext.isHeartbeat()){
@ -4588,7 +4570,7 @@ void MainWindow::readFromStdout() //readFromStdout
cmd.freq = cd.freq; cmd.freq = cd.freq;
cmd.utcTimestamp = cd.utcTimestamp; cmd.utcTimestamp = cd.utcTimestamp;
cmd.tdrift = cd.tdrift; cmd.tdrift = cd.tdrift;
cmd.speed = cd.speed; cmd.submode = cd.submode;
m_rxCommandQueue.append(cmd); m_rxCommandQueue.append(cmd);
// notification for hb // notification for hb
@ -4598,7 +4580,7 @@ void MainWindow::readFromStdout() //readFromStdout
} else { } else {
qDebug() << "buffering compound call" << cd.freq << cd.call << cd.bits; qDebug() << "buffering compound call" << cd.freq << cd.call << cd.bits;
hasExistingMessageBuffer(speedNameToSubmode(cd.speed), cd.freq, true, nullptr); hasExistingMessageBuffer(cd.submode, cd.freq, true, nullptr);
m_messageBuffer[cd.freq].compound.append(cd); m_messageBuffer[cd.freq].compound.append(cd);
} }
} }
@ -4620,7 +4602,7 @@ void MainWindow::readFromStdout() //readFromStdout
cmd.bits = decodedtext.bits(); cmd.bits = decodedtext.bits();
cmd.extra = parts.length() > 2 ? parts.mid(3).join(" ") : ""; cmd.extra = parts.length() > 2 ? parts.mid(3).join(" ") : "";
cmd.tdrift = decodedtext.dt(); cmd.tdrift = decodedtext.dt();
cmd.speed = modeSpeedName(decodedtext.submode()); cmd.submode = decodedtext.submode();
// if the command is a buffered command and its not the last frame OR we have from or to in a separate message (compound call) // if the command is a buffered command and its not the last frame OR we have from or to in a separate message (compound call)
if((Varicode::isCommandBuffered(cmd.cmd) && (cmd.bits & Varicode::JS8CallLast) != Varicode::JS8CallLast) || cmd.from == "<....>" || cmd.to == "<....>"){ if((Varicode::isCommandBuffered(cmd.cmd) && (cmd.bits & Varicode::JS8CallLast) != Varicode::JS8CallLast) || cmd.from == "<....>" || cmd.to == "<....>"){
@ -4636,13 +4618,13 @@ void MainWindow::readFromStdout() //readFromStdout
cmdcd.utcTimestamp = cmd.utcTimestamp; cmdcd.utcTimestamp = cmd.utcTimestamp;
cmdcd.ackTimestamp = cmd.to == m_config.my_callsign() ? cmd.utcTimestamp : QDateTime{}; cmdcd.ackTimestamp = cmd.to == m_config.my_callsign() ? cmd.utcTimestamp : QDateTime{};
cmdcd.tdrift = cmd.tdrift; cmdcd.tdrift = cmd.tdrift;
cmdcd.speed = cmd.speed; cmdcd.submode = cmd.submode;
logCallActivity(cmdcd, false); logCallActivity(cmdcd, false);
logHeardGraph(cmd.from, cmd.to); logHeardGraph(cmd.from, cmd.to);
} }
// merge any existing buffer to this frequency // merge any existing buffer to this frequency
hasExistingMessageBuffer(speedNameToSubmode(cmd.speed), cmd.freq, true, nullptr); hasExistingMessageBuffer(cmd.submode, cmd.freq, true, nullptr);
if(cmd.to == m_config.my_callsign()){ if(cmd.to == m_config.my_callsign()){
d.shouldDisplay = true; d.shouldDisplay = true;
@ -4671,7 +4653,7 @@ void MainWindow::readFromStdout() //readFromStdout
td.freq = cmd.freq; td.freq = cmd.freq;
td.utcTimestamp = cmd.utcTimestamp; td.utcTimestamp = cmd.utcTimestamp;
td.tdrift = cmd.tdrift; td.tdrift = cmd.tdrift;
td.speed = cmd.speed; td.submode = cmd.submode;
logCallActivity(td, true); logCallActivity(td, true);
logHeardGraph(cmd.from, cmd.to); logHeardGraph(cmd.from, cmd.to);
} }
@ -9602,6 +9584,24 @@ int MainWindow::rxThreshold(int submode){
return threshold; return threshold;
} }
int MainWindow::rxSnrThreshold(int submode){
// these are baseline thresholds for valid frames
switch(submode){
case Varicode::JS8CallNormal:
return -24;
case Varicode::JS8CallFast:
return -22;
case Varicode::JS8CallTurbo:
return -20;
#if JS8E_IS_ULTRA
case Varicode::JS8CallUltraSlow:
return -18;
#endif
}
return -28;
}
void MainWindow::displayTransmit(){ void MainWindow::displayTransmit(){
// Transmit Activity // Transmit Activity
update_dynamic_property (ui->startTxButton, "transmitting", m_transmitting); update_dynamic_property (ui->startTxButton, "transmitting", m_transmitting);
@ -9615,7 +9615,7 @@ void MainWindow::updateModeButtonText(){
auto heartbeat = ui->actionModeJS8HB->isEnabled() && ui->actionModeJS8HB->isChecked(); auto heartbeat = ui->actionModeJS8HB->isEnabled() && ui->actionModeJS8HB->isChecked();
auto ack = autoreply && ui->actionHeartbeatAcknowledgements->isChecked() && (!m_config.heartbeat_qso_pause() || selectedCallsign.isEmpty()); auto ack = autoreply && ui->actionHeartbeatAcknowledgements->isChecked() && (!m_config.heartbeat_qso_pause() || selectedCallsign.isEmpty());
auto modeText = modeSpeedName(m_nSubMode); auto modeText = submodeName(m_nSubMode);
if(multi){ if(multi){
modeText += QString("+MULTI"); modeText += QString("+MULTI");
} }
@ -10083,8 +10083,7 @@ void MainWindow::processIdleActivity() {
continue; continue;
} }
auto submode = speedNameToSubmode(last.speed); if(last.utcTimestamp.secsTo(now) < computeSubmodePeriod(last.submode)){
if(last.utcTimestamp.secsTo(now) < computeSubmodePeriod(submode)){
continue; continue;
} }
@ -10099,9 +10098,9 @@ void MainWindow::processIdleActivity() {
d.snr = last.snr; d.snr = last.snr;
d.tdrift = last.tdrift; d.tdrift = last.tdrift;
d.freq = last.freq; d.freq = last.freq;
d.speed = last.speed; d.submode = last.submode;
if(hasExistingMessageBuffer(speedNameToSubmode(d.speed), offset, false, nullptr)){ if(hasExistingMessageBuffer(d.submode, offset, false, nullptr)){
m_messageBuffer[offset].msgs.append(d); m_messageBuffer[offset].msgs.append(d);
} }
@ -10126,12 +10125,10 @@ void MainWindow::processRxActivity() {
// use the actual frequency and check its delta from our current frequency // use the actual frequency and check its delta from our current frequency
// meaning, if our current offset is 1502 and the d.freq is 1492, the delta is <= 10; // meaning, if our current offset is 1502 and the d.freq is 1492, the delta is <= 10;
int submode = speedNameToSubmode(d.speed); bool shouldDisplay = abs(d.freq - freqOffset) <= rxThreshold(d.submode);
bool shouldDisplay = abs(d.freq - freqOffset) <= rxThreshold(submode);
int prevOffset = d.freq; int prevOffset = d.freq;
if(hasExistingMessageBuffer(submode, d.freq, false, &prevOffset) && ( if(hasExistingMessageBuffer(d.submode, d.freq, false, &prevOffset) && (
(m_messageBuffer[prevOffset].cmd.to == m_config.my_callsign()) || (m_messageBuffer[prevOffset].cmd.to == m_config.my_callsign()) ||
// (isAllCallIncluded(m_messageBuffer[prevOffset].cmd.to)) || // uncomment this if we want to incrementally print allcalls // (isAllCallIncluded(m_messageBuffer[prevOffset].cmd.to)) || // uncomment this if we want to incrementally print allcalls
(isGroupCallIncluded(m_messageBuffer[prevOffset].cmd.to)) (isGroupCallIncluded(m_messageBuffer[prevOffset].cmd.to))
@ -10177,7 +10174,7 @@ void MainWindow::processRxActivity() {
cd.bits = d.bits; cd.bits = d.bits;
cd.tdrift = d.tdrift; cd.tdrift = d.tdrift;
cd.utcTimestamp = d.utcTimestamp; cd.utcTimestamp = d.utcTimestamp;
cd.speed = d.speed; cd.submode = d.submode;
logCallActivity(cd, true); logCallActivity(cd, true);
} }
} }
@ -10522,7 +10519,7 @@ void MainWindow::processCommandActivity() {
cd.ackTimestamp = d.text.contains(": ACK") || toMe ? d.utcTimestamp : QDateTime{}; cd.ackTimestamp = d.text.contains(": ACK") || toMe ? d.utcTimestamp : QDateTime{};
cd.utcTimestamp = d.utcTimestamp; cd.utcTimestamp = d.utcTimestamp;
cd.tdrift = d.tdrift; cd.tdrift = d.tdrift;
cd.speed = d.speed; cd.submode = d.submode;
logCallActivity(cd, true); logCallActivity(cd, true);
logHeardGraph(d.from, d.to); logHeardGraph(d.from, d.to);
@ -10550,7 +10547,7 @@ void MainWindow::processCommandActivity() {
cd.snr = d.snr; cd.snr = d.snr;
cd.utcTimestamp = d.utcTimestamp; cd.utcTimestamp = d.utcTimestamp;
cd.tdrift = d.tdrift; cd.tdrift = d.tdrift;
cd.speed = d.speed; cd.submode = d.submode;
if(d.to == "@APRSIS"){ if(d.to == "@APRSIS"){
m_aprsCallCache.remove(cd.call); m_aprsCallCache.remove(cd.call);
@ -10815,7 +10812,7 @@ void MainWindow::processCommandActivity() {
cd.through = d.from; cd.through = d.from;
cd.utcTimestamp = DriftingDateTime::currentDateTimeUtc(); cd.utcTimestamp = DriftingDateTime::currentDateTimeUtc();
cd.tdrift = d.tdrift; cd.tdrift = d.tdrift;
cd.speed = d.speed; cd.submode = d.submode;
logCallActivity(cd, false); logCallActivity(cd, false);
} }
@ -10914,7 +10911,7 @@ void MainWindow::processCommandActivity() {
cd.text = text; cd.text = text;
cd.to = Radio::base_callsign(to); cd.to = Radio::base_callsign(to);
cd.utcTimestamp = d.utcTimestamp; cd.utcTimestamp = d.utcTimestamp;
cd.speed = d.speed; cd.submode = d.submode;
qDebug() << "storing message to" << to << ":" << text; qDebug() << "storing message to" << to << ":" << text;
@ -11241,7 +11238,7 @@ void MainWindow::refreshInboxCounts(){
auto snr = params.value("SNR").toInt(); auto snr = params.value("SNR").toInt();
auto freq = params.value("OFFSET").toInt(); auto freq = params.value("OFFSET").toInt();
auto tdrift = params.value("TDRIFT").toInt(); auto tdrift = params.value("TDRIFT").toInt();
auto mode = params.value("MODENAME").toString(); auto submode = params.value("SUBMODE").toInt();
CallDetail cd; CallDetail cd;
cd.call = from; cd.call = from;
@ -11251,7 +11248,7 @@ void MainWindow::refreshInboxCounts(){
cd.utcTimestamp = QDateTime::fromString(utc, "yyyy-MM-dd hh:mm:ss"); cd.utcTimestamp = QDateTime::fromString(utc, "yyyy-MM-dd hh:mm:ss");
cd.utcTimestamp.setUtcOffset(0); cd.utcTimestamp.setUtcOffset(0);
cd.ackTimestamp = cd.utcTimestamp; cd.ackTimestamp = cd.utcTimestamp;
cd.speed = mode; cd.submode = submode;
logCallActivity(cd, false); logCallActivity(cd, false);
} }
} }
@ -11297,7 +11294,7 @@ int MainWindow::addCommandToStorage(QString type, CommandDetail d){
{"OFFSET", QVariant(d.freq)}, {"OFFSET", QVariant(d.freq)},
{"CMD", QVariant(d.cmd)}, {"CMD", QVariant(d.cmd)},
{"SNR", QVariant(d.snr)}, {"SNR", QVariant(d.snr)},
{"MODENAME", QVariant(d.speed)}, {"SUBMODE", QVariant(d.submode)},
}; };
if(!d.grid.isEmpty()){ if(!d.grid.isEmpty()){
@ -11576,7 +11573,7 @@ void MainWindow::displayBandActivity() {
QString age; QString age;
int snr = 0; int snr = 0;
float tdrift = 0; float tdrift = 0;
QString mode; int submode;
int activityAging = m_config.activity_aging(); int activityAging = m_config.activity_aging();
@ -11641,7 +11638,7 @@ void MainWindow::displayBandActivity() {
age = since(item.utcTimestamp); age = since(item.utcTimestamp);
timestamp = item.utcTimestamp; timestamp = item.utcTimestamp;
tdrift = item.tdrift; tdrift = item.tdrift;
mode = item.speed; submode = item.submode;
} }
auto joined = Varicode::rstrip(text.join("")); auto joined = Varicode::rstrip(text.join(""));
@ -11671,11 +11668,12 @@ void MainWindow::displayBandActivity() {
tdriftItem->setData(Qt::UserRole, QVariant(tdrift)); tdriftItem->setData(Qt::UserRole, QVariant(tdrift));
ui->tableWidgetRXAll->setItem(row, col++, tdriftItem); ui->tableWidgetRXAll->setItem(row, col++, tdriftItem);
auto modeItem = new QTableWidgetItem(mode.left(1).replace("H", "N")); auto name = submodeName(submode);
modeItem->setToolTip(mode); auto submodeItem = new QTableWidgetItem(name.left(1).replace("H", "N"));
modeItem->setData(Qt::UserRole, QVariant(mode)); submodeItem->setToolTip(name);
modeItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter); submodeItem->setData(Qt::UserRole, QVariant(name));
ui->tableWidgetRXAll->setItem(row, col++, modeItem); submodeItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
ui->tableWidgetRXAll->setItem(row, col++, submodeItem);
// align right if eliding... // align right if eliding...
int colWidth = ui->tableWidgetRXAll->columnWidth(3); int colWidth = ui->tableWidgetRXAll->columnWidth(3);
@ -11960,9 +11958,10 @@ void MainWindow::displayCallActivity() {
ui->tableWidgetCalls->setItem(row, col++, new QTableWidgetItem(QString("%1 ms").arg((int)(1000*d.tdrift)))); ui->tableWidgetCalls->setItem(row, col++, new QTableWidgetItem(QString("%1 ms").arg((int)(1000*d.tdrift))));
auto modeItem = new QTableWidgetItem(d.speed.left(1).replace("H", "N")); auto name = submodeName(d.submode);
modeItem->setToolTip(d.speed); auto modeItem = new QTableWidgetItem(name.left(1).replace("H", "N"));
modeItem->setData(Qt::UserRole, QVariant(d.speed)); modeItem->setToolTip(name);
modeItem->setData(Qt::UserRole, QVariant(name));
modeItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter); modeItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
ui->tableWidgetCalls->setItem(row, col++, modeItem); ui->tableWidgetCalls->setItem(row, col++, modeItem);

View File

@ -163,6 +163,7 @@ public slots:
QPair<QString, int> popMessageFrame(); QPair<QString, int> popMessageFrame();
void tryNotify(const QString &key); void tryNotify(const QString &key);
int rxThreshold(int submode); int rxThreshold(int submode);
int rxSnrThreshold(int submode);
protected: protected:
void keyPressEvent (QKeyEvent *) override; void keyPressEvent (QKeyEvent *) override;
@ -719,7 +720,6 @@ private:
int bits; int bits;
float tdrift; float tdrift;
int submode; int submode;
QString speed;
}; };
struct CommandDetail struct CommandDetail
@ -738,7 +738,6 @@ private:
QString extra; QString extra;
float tdrift; float tdrift;
int submode; int submode;
QString speed;
QString relayPath; QString relayPath;
}; };
@ -757,7 +756,6 @@ private:
bool shouldDisplay; bool shouldDisplay;
float tdrift; float tdrift;
int submode; int submode;
QString speed;
}; };
struct MessageBuffer { struct MessageBuffer {
@ -948,8 +946,8 @@ private:
void aprsLogReport(int offset, int snr, QString callsign, QString grid); void aprsLogReport(int offset, int snr, QString callsign, QString grid);
Radio::Frequency dialFrequency(); Radio::Frequency dialFrequency();
void setSubmode(int submode); void setSubmode(int submode);
int speedNameToSubmode(QString speed); int submodeNameToSubmode(QString speed);
QString modeSpeedName(int submode); QString submodeName(int submode);
void updateCurrentBand(); void updateCurrentBand();
void displayDialFrequency (); void displayDialFrequency ();
void transmitDisplay (bool); void transmitDisplay (bool);