1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 01:39:05 -05:00

FT8 demod: moved sending to Map feature to the demod worker

This commit is contained in:
f4exb 2023-01-24 01:07:51 +01:00
parent 9f13c002ab
commit 886ce74220
4 changed files with 60 additions and 65 deletions

View File

@ -270,7 +270,7 @@ void FT8DemodBaseband::tick()
if (m_tickCount++ == 0)
{
QDateTime periodTs = nowUTC.addSecs(-15);
qDebug("FT8DemodBaseband::tick: %s", qPrintable(nowUTC.toString("yyyy-MM-dd HH:mm:ss")));
// qDebug("FT8DemodBaseband::tick: %s", qPrintable(nowUTC.toString("yyyy-MM-dd HH:mm:ss")));
m_ft8Buffer.getCurrentBuffer(m_ft8WorkerBuffer);
emit bufferReady(m_ft8WorkerBuffer, periodTs);
periodTs = nowUTC;

View File

@ -31,9 +31,7 @@
#include "gui/dialpopup.h"
#include "gui/dialogpositioner.h"
#include "util/db.h"
#include "util/maidenhead.h"
#include "maincore.h"
#include "SWGMapItem.h"
#include "ui_ft8demodgui.h"
#include "ft8demodgui.h"
@ -735,19 +733,6 @@ void FT8DemodGUI::messagesReceived(const QList<FT8Message>& messages)
locItem->setText(message.loc);
infoItem->setText(message.decoderInfo);
// If message contains a Maidenhead locator, display caller on Map feature
float latitude, longitude;
if ((message.loc.size() == 4) && Maidenhead::fromMaidenhead(message.loc, latitude, longitude))
{
QString text = QString("%1\nMode: FT8\nFrequency: %2 Hz\nLocator: %3\nSNR: %4\nLast heard: %5")
.arg(message.call2)
.arg(m_deviceCenterFrequency + m_settings.m_inputFrequencyOffset)
.arg(message.loc)
.arg(message.snr)
.arg(QDateTime::currentDateTime().toString("dd MMM yyyy HH:mm:ss"));
sendToMap(message.call2, text, latitude, longitude);
}
filterMessageRow(row);
row++;
@ -760,36 +745,6 @@ void FT8DemodGUI::messagesReceived(const QList<FT8Message>& messages)
}
}
void FT8DemodGUI::sendToMap(const QString& caller, const QString& text, float latitude, float longitude)
{
QList<ObjectPipe*> mapPipes;
MainCore::instance()->getMessagePipes().getMessagePipes(m_ft8Demod, "mapitems", mapPipes);
for (const auto& pipe : mapPipes)
{
MessageQueue *messageQueue = qobject_cast<MessageQueue*>(pipe->m_element);
SWGSDRangel::SWGMapItem *swgMapItem = new SWGSDRangel::SWGMapItem();
swgMapItem->setName(new QString(caller));
swgMapItem->setLatitude(latitude);
swgMapItem->setLongitude(longitude);
swgMapItem->setAltitude(0);
swgMapItem->setAltitudeReference(1); // CLAMP_TO_GROUND
swgMapItem->setPositionDateTime(new QString(QDateTime::currentDateTime().toString(Qt::ISODateWithMs)));
swgMapItem->setImageRotation(0);
swgMapItem->setText(new QString(text));
swgMapItem->setImage(new QString("antenna.png"));
swgMapItem->setModel(new QString("antenna.glb"));
swgMapItem->setModelAltitudeOffset(0.0);
swgMapItem->setLabel(new QString(caller));
swgMapItem->setLabelAltitudeOffset(4.5);
swgMapItem->setFixedPosition(false);
swgMapItem->setOrientation(0);
swgMapItem->setHeading(0);
MainCore::MsgMapItem *msg = MainCore::MsgMapItem::create(m_ft8Demod, swgMapItem);
messageQueue->push(msg);
}
}
void FT8DemodGUI::populateBandPresets()
{
ui->bandPreset->blockSignals(true);

View File

@ -108,7 +108,6 @@ private:
void messagesReceived(const QList<FT8Message>& messages);
void populateBandPresets();
void filterMessageRow(int row);
void sendToMap(const QString& call2, const QString& text, float latitude, float longitude);
enum MessageCol {
MESSAGE_COL_UTC,

View File

@ -23,6 +23,9 @@
#include "dsp/wavfilerecord.h"
#include "util/messagequeue.h"
#include "util/ft8message.h"
#include "util/maidenhead.h"
#include "maincore.h"
#include "SWGMapItem.h"
#include "ft8demodsettings.h"
#include "ft8demodworker.h"
@ -84,16 +87,16 @@ int FT8DemodWorker::FT8Callback::hcb(
ft8Message.decoderInfo = QString(comment);
cycle_mu.unlock();
qDebug("FT8DemodWorker::FT8Callback::hcb: %6.3f %d %3d %3d %5.2f %6.1f %s (%s)",
m_baseFrequency / 1000000.0,
pass,
(int)snr,
correct_bits,
off - 0.5,
hz0,
msg.c_str(),
comment
);
// qDebug("FT8DemodWorker::FT8Callback::hcb: %6.3f %d %3d %3d %5.2f %6.1f %s (%s)",
// m_baseFrequency / 1000000.0,
// pass,
// (int)snr,
// correct_bits,
// off - 0.5,
// hz0,
// msg.c_str(),
// comment
// );
return 2; // 2 => new decode, do subtract.
}
@ -187,13 +190,15 @@ void FT8DemodWorker::processBuffer(int16_t *buffer, QDateTime periodTS)
m_reportingMessageQueue->push(ft8Callback.getReportMessage());
}
if (m_logMessages)
{
const QList<FT8Message>& ft8Messages = ft8Callback.getReportMessage()->getFT8Messages();
std::ofstream logFile;
double baseFrequencyMHz = m_baseFrequency/1000000.0;
QList<ObjectPipe*> mapPipes;
MainCore::instance()->getMessagePipes().getMessagePipes((const QObject*) m_channel, "mapitems", mapPipes);
const QList<FT8Message>& ft8Messages = ft8Callback.getReportMessage()->getFT8Messages();
std::ofstream logFile;
double baseFrequencyMHz = m_baseFrequency/1000000.0;
for (const auto& ft8Message : ft8Messages)
for (const auto& ft8Message : ft8Messages)
{
if (m_logMessages)
{
if (!logFile.is_open())
{
@ -225,8 +230,44 @@ void FT8DemodWorker::processBuffer(int16_t *buffer, QDateTime periodTS)
logFile << logMessage.toStdString() << std::endl;
}
if (logFile.is_open()) {
logFile.close();
if (mapPipes.size() > 0)
{
// If message contains a Maidenhead locator, display caller on Map feature
float latitude, longitude;
if ((ft8Message.loc.size() == 4) && (ft8Message.loc != "RR73") && Maidenhead::fromMaidenhead(ft8Message.loc, latitude, longitude))
{
QString text = QString("%1\nMode: FT8\nFrequency: %2 Hz\nLocator: %3\nSNR: %4\nLast heard: %5")
.arg(ft8Message.call2)
.arg(baseFrequencyMHz*1000000 + ft8Message.df)
.arg(ft8Message.loc)
.arg(ft8Message.snr)
.arg(periodTS.toString("dd MMM yyyy HH:mm:ss"));
for (const auto& pipe : mapPipes)
{
MessageQueue *messageQueue = qobject_cast<MessageQueue*>(pipe->m_element);
SWGSDRangel::SWGMapItem *swgMapItem = new SWGSDRangel::SWGMapItem();
swgMapItem->setName(new QString(ft8Message.call2));
swgMapItem->setLatitude(latitude);
swgMapItem->setLongitude(longitude);
swgMapItem->setAltitude(0);
swgMapItem->setAltitudeReference(1); // CLAMP_TO_GROUND
swgMapItem->setPositionDateTime(new QString(QDateTime::currentDateTime().toString(Qt::ISODateWithMs)));
swgMapItem->setImageRotation(0);
swgMapItem->setText(new QString(text));
swgMapItem->setImage(new QString("antenna.png"));
swgMapItem->setModel(new QString("antenna.glb"));
swgMapItem->setModelAltitudeOffset(0.0);
swgMapItem->setLabel(new QString(ft8Message.call2));
swgMapItem->setLabelAltitudeOffset(4.5);
swgMapItem->setFixedPosition(false);
swgMapItem->setOrientation(0);
swgMapItem->setHeading(0);
MainCore::MsgMapItem *msg = MainCore::MsgMapItem::create((const QObject*) m_channel, swgMapItem);
messageQueue->push(msg);
}
}
}
}