Better beacon scheduling. Should prevent future issues with beacons going missed
This commit is contained in:
parent
07118dac49
commit
d303cbfe67
@ -811,8 +811,8 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
|
|||||||
TxAgainTimer.setSingleShot(true);
|
TxAgainTimer.setSingleShot(true);
|
||||||
connect(&TxAgainTimer, SIGNAL(timeout()), this, SLOT(TxAgain()));
|
connect(&TxAgainTimer, SIGNAL(timeout()), this, SLOT(TxAgain()));
|
||||||
|
|
||||||
beaconTimer.setSingleShot(true);
|
beaconTimer.setSingleShot(false);
|
||||||
connect(&beaconTimer, &QTimer::timeout, this, &MainWindow::prepareBacon);
|
connect(&beaconTimer, &QTimer::timeout, this, &MainWindow::checkBacon);
|
||||||
|
|
||||||
connect(m_wideGraph.data (), SIGNAL(setFreq3(int,int)),this,
|
connect(m_wideGraph.data (), SIGNAL(setFreq3(int,int)),this,
|
||||||
SLOT(setFreq4(int,int)));
|
SLOT(setFreq4(int,int)));
|
||||||
@ -1188,7 +1188,8 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
m_lastTxTime = QDateTime::currentDateTimeUtc();
|
// Don't block beacon's first run...
|
||||||
|
m_lastTxTime = QDateTime::currentDateTimeUtc().addSecs(-300);
|
||||||
|
|
||||||
displayActivity(true);
|
displayActivity(true);
|
||||||
|
|
||||||
@ -6103,35 +6104,44 @@ void MainWindow::scheduleBacon(bool first){
|
|||||||
timestamp = timestamp.addSecs(15);
|
timestamp = timestamp.addSecs(15);
|
||||||
}
|
}
|
||||||
|
|
||||||
setBaconTimer(timestamp);
|
|
||||||
}
|
|
||||||
|
|
||||||
// setBeaconTimer
|
|
||||||
void MainWindow::setBaconTimer(QDateTime timestamp){
|
|
||||||
// set the next beacon timestamp and timer
|
|
||||||
beaconTimer.stop();
|
|
||||||
m_nextBeacon = timestamp;
|
m_nextBeacon = timestamp;
|
||||||
|
m_nextBeaconQueued = false;
|
||||||
m_nextBeaconPaused = false;
|
m_nextBeaconPaused = false;
|
||||||
beaconTimer.start(QDateTime::currentDateTimeUtc().msecsTo(m_nextBeacon) - 2*1000);
|
|
||||||
|
if(!beaconTimer.isActive()){
|
||||||
|
beaconTimer.setInterval(1000);
|
||||||
|
beaconTimer.start();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// pauseBeacon
|
// pauseBeacon
|
||||||
void MainWindow::pauseBacon(){
|
void MainWindow::pauseBacon(){
|
||||||
ui->beaconButton->setChecked(false);
|
ui->beaconButton->setChecked(false);
|
||||||
beaconTimer.stop();
|
|
||||||
m_nextBeaconPaused = true;
|
m_nextBeaconPaused = true;
|
||||||
|
|
||||||
|
if(beaconTimer.isActive()){
|
||||||
|
beaconTimer.stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// checkBeacon
|
||||||
|
void MainWindow::checkBacon(){
|
||||||
|
if(!ui->beaconButton->isChecked()){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(QDateTime::currentDateTimeUtc().secsTo(m_nextBeacon) > 5){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(m_nextBeaconQueued){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
qDebug() << "PREPARING BACON!!";
|
||||||
|
prepareBacon();
|
||||||
}
|
}
|
||||||
|
|
||||||
// prepareBeacon
|
// prepareBeacon
|
||||||
void MainWindow::prepareBacon(){
|
void MainWindow::prepareBacon(){
|
||||||
if(!ui->beaconButton->isChecked()){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(QDateTime::currentDateTimeUtc().secsTo(m_nextBeacon) > 15){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList lines;
|
QStringList lines;
|
||||||
|
|
||||||
QString call = m_config.my_callsign();
|
QString call = m_config.my_callsign();
|
||||||
@ -6146,40 +6156,15 @@ void MainWindow::prepareBacon(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Queue the beacon
|
// Queue the beacon
|
||||||
enqueueMessage(PriorityLow, lines.join(QChar('\n')), currentFreq(), nullptr);
|
enqueueMessage(PriorityLow, lines.join(QChar('\n')), currentFreq(), [this](){
|
||||||
|
m_nextBeaconQueued = false;
|
||||||
|
});
|
||||||
|
|
||||||
|
m_nextBeaconQueued = true;
|
||||||
#if 0
|
|
||||||
if(!m_callActivity.isEmpty()){
|
|
||||||
auto callsHeard = QSet<QString>::fromList(m_callActivity.keys());
|
|
||||||
auto callsToBeacon = callsHeard - m_callSeenBeacon;
|
|
||||||
if(callsToBeacon.isEmpty()){
|
|
||||||
m_callSeenBeacon.clear();
|
|
||||||
} else {
|
|
||||||
auto call = callsToBeacon.toList().first();
|
|
||||||
auto d = m_callActivity[call];
|
|
||||||
|
|
||||||
lines.append(QString("%1 SNR %2").arg(call).arg(Varicode::formatSNR(d.snr)));
|
|
||||||
m_callSeenBeacon.insert(call);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
while(lines.length() > 2){
|
|
||||||
lines.removeFirst();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
addMessageText(lines.join(QChar('\n')));
|
|
||||||
|
|
||||||
ui->startTxButton->setChecked(true);
|
|
||||||
|
|
||||||
scheduleBacon(false);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
QString MainWindow::calculateDistance(QString const& value)
|
QString MainWindow::calculateDistance(QString const& value)
|
||||||
{
|
{
|
||||||
QString grid = value.trimmed();
|
QString grid = value.trimmed();
|
||||||
@ -7788,6 +7773,8 @@ void MainWindow::on_beaconButton_clicked()
|
|||||||
{
|
{
|
||||||
if(ui->beaconButton->isChecked()){
|
if(ui->beaconButton->isChecked()){
|
||||||
scheduleBacon(true);
|
scheduleBacon(true);
|
||||||
|
} else {
|
||||||
|
pauseBacon();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -9105,6 +9092,9 @@ void MainWindow::processTxQueue(){
|
|||||||
|
|
||||||
// check to see if we have autoreply enabled...
|
// check to see if we have autoreply enabled...
|
||||||
if(ui->autoReplyButton->isChecked()){
|
if(ui->autoReplyButton->isChecked()){
|
||||||
|
// then try to set the frequency...
|
||||||
|
setFreqForRestore(f, true);
|
||||||
|
|
||||||
// then prepare to transmit...
|
// then prepare to transmit...
|
||||||
toggleTx(true);
|
toggleTx(true);
|
||||||
}
|
}
|
||||||
|
@ -271,8 +271,8 @@ private slots:
|
|||||||
bool isFreqOffsetFree(int f, int bw);
|
bool isFreqOffsetFree(int f, int bw);
|
||||||
int findFreeFreqOffset(int fmin, int fmax, int bw);
|
int findFreeFreqOffset(int fmin, int fmax, int bw);
|
||||||
void scheduleBacon(bool first=false);
|
void scheduleBacon(bool first=false);
|
||||||
void setBaconTimer(QDateTime timestamp);
|
|
||||||
void pauseBacon();
|
void pauseBacon();
|
||||||
|
void checkBacon();
|
||||||
void prepareBacon();
|
void prepareBacon();
|
||||||
QString calculateDistance(QString const& grid);
|
QString calculateDistance(QString const& grid);
|
||||||
void on_rptSpinBox_valueChanged(int n);
|
void on_rptSpinBox_valueChanged(int n);
|
||||||
@ -757,6 +757,7 @@ private:
|
|||||||
QQueue<QString> m_foxQSOinProgress; //QSOs in progress: Fox has sent a report
|
QQueue<QString> m_foxQSOinProgress; //QSOs in progress: Fox has sent a report
|
||||||
QQueue<qint64> m_foxRateQueue;
|
QQueue<qint64> m_foxRateQueue;
|
||||||
|
|
||||||
|
bool m_nextBeaconQueued = false;
|
||||||
bool m_nextBeaconPaused = false;
|
bool m_nextBeaconPaused = false;
|
||||||
QDateTime m_nextBeacon;
|
QDateTime m_nextBeacon;
|
||||||
QDateTime m_dateTimeQSOOn;
|
QDateTime m_dateTimeQSOOn;
|
||||||
|
Loading…
Reference in New Issue
Block a user