Only QSY your beacon if the frequency isn't free. Don't break lines in the rx window
This commit is contained in:
parent
0df4bbcd29
commit
16b46176a6
@ -5107,6 +5107,7 @@ int MainWindow::logRxTxMessageText(QDateTime date, bool isFree, QString text, in
|
|||||||
c.movePosition(QTextCursor::EndOfBlock);
|
c.movePosition(QTextCursor::EndOfBlock);
|
||||||
found = true;
|
found = true;
|
||||||
} else {
|
} else {
|
||||||
|
c.movePosition(QTextCursor::End);
|
||||||
c.insertBlock();
|
c.insertBlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5354,12 +5355,9 @@ bool MainWindow::prepareNextMessageFrame()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MainWindow::isFreqOffsetFree(int f){
|
bool MainWindow::isFreqOffsetFree(int f, int bw){
|
||||||
int bw = 50;
|
|
||||||
int pad = 5;
|
|
||||||
|
|
||||||
foreach(int offset, m_bandActivity.keys()){
|
foreach(int offset, m_bandActivity.keys()){
|
||||||
if(qAbs(offset - f) < bw+pad){
|
if(qAbs(offset - f) < bw){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5367,23 +5365,20 @@ bool MainWindow::isFreqOffsetFree(int f){
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int MainWindow::findFreeFreqOffset(){
|
int MainWindow::findFreeFreqOffset(int fmin, int fmax, int bw){
|
||||||
int bw = 50;
|
|
||||||
int fmin = 100;
|
|
||||||
int fmax = 1000;
|
|
||||||
int nslots = (fmax-fmin)/bw;
|
int nslots = (fmax-fmin)/bw;
|
||||||
|
|
||||||
int f = fmin;
|
int f = fmin;
|
||||||
for(int i = 0; i < nslots; i++){
|
for(int i = 0; i < nslots; i++){
|
||||||
f = fmin + bw * (qrand() % nslots);
|
f = fmin + bw * (qrand() % nslots);
|
||||||
if(isFreqOffsetFree(f)){
|
if(isFreqOffsetFree(f, bw)){
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i = 0; i < nslots; i++){
|
for(int i = 0; i < nslots; i++){
|
||||||
f = fmin + (qrand() % (fmax-fmin));
|
f = fmin + (qrand() % (fmax-fmin));
|
||||||
if(isFreqOffsetFree(f)){
|
if(isFreqOffsetFree(f, bw)){
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5402,11 +5397,16 @@ void MainWindow::scheduleBeacon(bool first){
|
|||||||
timestamp.setTime(t);
|
timestamp.setTime(t);
|
||||||
|
|
||||||
// round to 15 second increment
|
// round to 15 second increment
|
||||||
|
|
||||||
int secondsSinceEpoch = (timestamp.toMSecsSinceEpoch()/1000);
|
int secondsSinceEpoch = (timestamp.toMSecsSinceEpoch()/1000);
|
||||||
int delta = roundUp(secondsSinceEpoch, 15) + 1 + (first ? m_txFirst ? 15 : 30 : qMax(1, m_config.beacon()) * 60) - secondsSinceEpoch;
|
int delta = roundUp(secondsSinceEpoch, 15) + 1 + (first ? m_txFirst ? 15 : 30 : qMax(1, m_config.beacon()) * 60) - secondsSinceEpoch;
|
||||||
timestamp = timestamp.addSecs(delta);
|
timestamp = timestamp.addSecs(delta);
|
||||||
|
|
||||||
|
// 25% of the time, switch intervals
|
||||||
|
float prob = (float) qrand() / (RAND_MAX+1);
|
||||||
|
if(prob < 0.25){
|
||||||
|
timestamp = timestamp.addSecs(15);
|
||||||
|
}
|
||||||
|
|
||||||
// set the next beacon timestamp and timer
|
// set the next beacon timestamp and timer
|
||||||
m_nextBeacon = timestamp;
|
m_nextBeacon = timestamp;
|
||||||
beaconTimer.start(QDateTime::currentDateTimeUtc().msecsTo(m_nextBeacon) - 2*1000);
|
beaconTimer.start(QDateTime::currentDateTimeUtc().msecsTo(m_nextBeacon) - 2*1000);
|
||||||
@ -5421,7 +5421,11 @@ void MainWindow::prepareBeacon(){
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int f = findFreeFreqOffset();
|
int bw = 50 + 5;
|
||||||
|
int f = ui->TxFreqSpinBox->value();
|
||||||
|
if(!isFreqOffsetFree(f, bw)){
|
||||||
|
f = findFreeFreqOffset(250, 1500, bw);
|
||||||
|
}
|
||||||
|
|
||||||
// delay beacon if there's not a free frequency or there's something the tx queue...
|
// delay beacon if there's not a free frequency or there's something the tx queue...
|
||||||
if(f == 0 || !m_txFrameQueue.isEmpty()){
|
if(f == 0 || !m_txFrameQueue.isEmpty()){
|
||||||
|
@ -251,8 +251,8 @@ private slots:
|
|||||||
QString parseFT8Message(QString input);
|
QString parseFT8Message(QString input);
|
||||||
int countFreeTextMsgs(QString input);
|
int countFreeTextMsgs(QString input);
|
||||||
bool prepareNextMessageFrame();
|
bool prepareNextMessageFrame();
|
||||||
bool isFreqOffsetFree(int f);
|
bool isFreqOffsetFree(int f, int bw);
|
||||||
int findFreeFreqOffset();
|
int findFreeFreqOffset(int fmin, int fmax, int bw);
|
||||||
void scheduleBeacon(bool first=false);
|
void scheduleBeacon(bool first=false);
|
||||||
void prepareBeacon();
|
void prepareBeacon();
|
||||||
void on_rptSpinBox_valueChanged(int n);
|
void on_rptSpinBox_valueChanged(int n);
|
||||||
|
Loading…
Reference in New Issue
Block a user