Adapt WSPRnet.org spotting to moveable Rx analysis window

This allows spots at any frequency to be posted rather than just those
in the 1400 to 1600 Hz range above the VFO dial frequency.
This commit is contained in:
Bill Somerville 2020-10-04 22:41:52 +01:00
parent 0c0adbdaab
commit add63fb374
No known key found for this signature in database
GPG Key ID: D864B06D1E81618F
3 changed files with 42 additions and 31 deletions

View File

@ -86,26 +86,29 @@ void WSPRNet::upload (QString const& call, QString const& grid, QString const& r
m_file = fileName; m_file = fileName;
// Open the wsprd.out file // Open the wsprd.out file
QFile wsprdOutFile (fileName); if (m_uploadType != 3)
if (!wsprdOutFile.open (QIODevice::ReadOnly | QIODevice::Text) || !wsprdOutFile.size ())
{ {
spot_queue_.enqueue (urlEncodeNoSpot ()); QFile wsprdOutFile (fileName);
m_uploadType = 1; if (!wsprdOutFile.open (QIODevice::ReadOnly | QIODevice::Text) || !wsprdOutFile.size ())
}
else
{
// Read the contents
while (!wsprdOutFile.atEnd())
{ {
SpotQueue::value_type query; spot_queue_.enqueue (urlEncodeNoSpot ());
if (decodeLine (wsprdOutFile.readLine(), query)) m_uploadType = 1;
}
else
{
// Read the contents
while (!wsprdOutFile.atEnd())
{ {
// Prevent reporting data ouside of the current frequency band SpotQueue::value_type query;
float f = fabs (m_rfreq.toFloat() - query.queryItemValue ("tqrg", QUrl::FullyDecoded).toFloat()); if (decodeLine (wsprdOutFile.readLine(), query))
if (f < 0.0002)
{ {
spot_queue_.enqueue(urlEncodeSpot (query)); // Prevent reporting data ouside of the current frequency band
m_uploadType = 2; float f = fabs (m_rfreq.toFloat() - query.queryItemValue ("tqrg", QUrl::FullyDecoded).toFloat());
if (f < 0.01) // MHz
{
spot_queue_.enqueue(urlEncodeSpot (query));
m_uploadType = 2;
}
} }
} }
} }
@ -133,10 +136,8 @@ void WSPRNet::post (QString const& call, QString const& grid, QString const& rfr
if (!spot_queue_.size ()) if (!spot_queue_.size ())
{ {
spot_queue_.enqueue (urlEncodeNoSpot ()); spot_queue_.enqueue (urlEncodeNoSpot ());
m_uploadType = 1; m_uploadType = 3;
} }
spots_to_send_ = spot_queue_.size ();
upload_timer_.start (200);
} }
else else
{ {

View File

@ -3248,7 +3248,14 @@ void MainWindow::decodeDone ()
if(m_mode=="QRA64") m_wideGraph->drawRed(0,0); if(m_mode=="QRA64") m_wideGraph->drawRed(0,0);
if ("FST4W" == m_mode) if ("FST4W" == m_mode)
{ {
uploadWSPRSpots (true); // DE station info and trigger posts if (m_uploadWSPRSpots
&& m_config.is_transceiver_online ()) { // need working rig control
#if QT_VERSION >= QT_VERSION_CHECK (5, 15, 0)
uploadTimer.start(QRandomGenerator::global ()->bounded (0, 20000)); // Upload delay
#else
uploadTimer.start(20000 * qrand()/((double)RAND_MAX + 1.0)); // Upload delay
#endif
}
} }
auto tnow = QDateTime::currentDateTimeUtc (); auto tnow = QDateTime::currentDateTimeUtc ();
double tdone = fmod(double(tnow.time().second()),m_TRperiod); double tdone = fmod(double(tnow.time().second()),m_TRperiod);
@ -7959,35 +7966,38 @@ void MainWindow::uploadWSPRSpots (bool direct_post, QString const& decode_text)
{ {
// do not spot if disabled, replays, or if rig control not working // do not spot if disabled, replays, or if rig control not working
if(!m_uploadWSPRSpots || m_diskData || !m_config.is_transceiver_online ()) return; if(!m_uploadWSPRSpots || m_diskData || !m_config.is_transceiver_online ()) return;
if(m_uploading) { if(m_uploading && !decode_text.size ()) {
qDebug() << "Previous upload has not completed, spots were lost"; qDebug() << "Previous upload has not completed, spots were lost";
wsprNet->abortOutstandingRequests (); wsprNet->abortOutstandingRequests ();
m_uploading = false; m_uploading = false;
} }
QString rfreq = QString("%1").arg((m_dialFreqRxWSPR + 1500) / 1e6, 0, 'f', 6); QString rfreq = QString("%1").arg((m_dialFreqRxWSPR + m_wideGraph->rxFreq ()) / 1e6, 0, 'f', 6);
QString tfreq = QString("%1").arg((m_dialFreqRxWSPR + QString tfreq = QString("%1").arg((m_dialFreqRxWSPR +
ui->TxFreqSpinBox->value()) / 1e6, 0, 'f', 6); ui->TxFreqSpinBox->value()) / 1e6, 0, 'f', 6);
auto pct = QString::number (ui->autoButton->isChecked () ? ui->sbTxPercent->value () : 0); auto pct = QString::number (ui->autoButton->isChecked () ? ui->sbTxPercent->value () : 0);
if (!direct_post) if (direct_post)
{ {
// queues one FST4W spot
wsprNet->post (m_config.my_callsign (), m_config.my_grid (), rfreq, tfreq,
m_mode, m_TRperiod, pct,
QString::number (m_dBm), version (), decode_text);
}
else
{
// queues spots for each decode in wspr_spots.txt
wsprNet->upload (m_config.my_callsign (), m_config.my_grid (), rfreq, tfreq, wsprNet->upload (m_config.my_callsign (), m_config.my_grid (), rfreq, tfreq,
m_mode, m_TRperiod, pct, m_mode, m_TRperiod, pct,
QString::number (m_dBm), version (), QString::number (m_dBm), version (),
m_config.writeable_data_dir ().absoluteFilePath ("wspr_spots.txt")); m_config.writeable_data_dir ().absoluteFilePath ("wspr_spots.txt"));
} }
else // trigger upload of any queued spots
{
wsprNet->post (m_config.my_callsign (), m_config.my_grid (), rfreq, tfreq,
m_mode, m_TRperiod, pct,
QString::number (m_dBm), version (), decode_text);
}
if (!decode_text.size ()) if (!decode_text.size ())
{ {
m_uploading = true; m_uploading = true;
} }
} }
void MainWindow::uploadResponse(QString response) void MainWindow::uploadResponse(QString const& response)
{ {
if (response == "done") { if (response == "done") {
m_uploading=false; m_uploading=false;

View File

@ -278,7 +278,7 @@ private slots:
void WSPR_config(bool b); void WSPR_config(bool b);
void uploadWSPRSpots (bool direct_post = false, QString const& decode_text = QString {}); void uploadWSPRSpots (bool direct_post = false, QString const& decode_text = QString {});
void TxAgain(); void TxAgain();
void uploadResponse(QString response); void uploadResponse(QString const& response);
void on_WSPRfreqSpinBox_valueChanged(int n); void on_WSPRfreqSpinBox_valueChanged(int n);
void on_sbFST4W_RxFreq_valueChanged(int n); void on_sbFST4W_RxFreq_valueChanged(int n);
void on_sbFST4W_FTol_valueChanged(int n); void on_sbFST4W_FTol_valueChanged(int n);