Send data frames after directed. Fix bug with enter key double sending
This commit is contained in:
parent
796920cb6b
commit
115a9d65f7
@ -1034,6 +1034,9 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
|
|||||||
|
|
||||||
auto enterFilter = new EnterKeyPressEater();
|
auto enterFilter = new EnterKeyPressEater();
|
||||||
connect(enterFilter, &EnterKeyPressEater::enterKeyPressed, this, [this](QKeyEvent *, QObject *){
|
connect(enterFilter, &EnterKeyPressEater::enterKeyPressed, this, [this](QKeyEvent *, QObject *){
|
||||||
|
if(ui->extFreeTextMsgEdit->isReadOnly()){
|
||||||
|
return;
|
||||||
|
}
|
||||||
toggleTx(true);
|
toggleTx(true);
|
||||||
});
|
});
|
||||||
ui->extFreeTextMsgEdit->installEventFilter(enterFilter);
|
ui->extFreeTextMsgEdit->installEventFilter(enterFilter);
|
||||||
@ -5628,6 +5631,9 @@ QPair<QStringList, QStringList> MainWindow::buildFT8MessageFrames(QString const&
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// once we find a directed call, data encode the rest of the line.
|
||||||
|
bool hasDirected = false;
|
||||||
|
|
||||||
while(line.size() > 0){
|
while(line.size() > 0){
|
||||||
QString frame;
|
QString frame;
|
||||||
|
|
||||||
@ -5646,10 +5652,11 @@ QPair<QStringList, QStringList> MainWindow::buildFT8MessageFrames(QString const&
|
|||||||
// if this parses to a standard FT8 free text message
|
// if this parses to a standard FT8 free text message
|
||||||
// but it can be parsed as a directed message, then we
|
// but it can be parsed as a directed message, then we
|
||||||
// should send the directed version
|
// should send the directed version
|
||||||
if(isFree && n > 0){
|
if(isFree && !hasDirected && n > 0){
|
||||||
useDir = true;
|
useDir = true;
|
||||||
|
hasDirected = true;
|
||||||
frame = dirFrame;
|
frame = dirFrame;
|
||||||
} else if (isFree && m > 0) {
|
} else if ((isFree || hasDirected) && m > 0) {
|
||||||
useDat = true;
|
useDat = true;
|
||||||
frame = datFrame;
|
frame = datFrame;
|
||||||
} else {
|
} else {
|
||||||
@ -5693,6 +5700,13 @@ QPair<QStringList, QStringList> MainWindow::buildFT8MessageFrames(QString const&
|
|||||||
|
|
||||||
lines.append(line.left(n) + " ");
|
lines.append(line.left(n) + " ");
|
||||||
line = line.mid(n);
|
line = line.mid(n);
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
// TODO: jsherer - this is how we'll prepend a 16-bit checksum to the message, just encode it in the data...
|
||||||
|
if(!line.isEmpty()){
|
||||||
|
line = Varicode::checksum16(line) + line;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if(useDat){
|
if(useDat){
|
||||||
@ -5985,16 +5999,7 @@ QString MainWindow::calculateDistance(QString const& grid)
|
|||||||
// this function is called by auto_tx_mode, which is called by autoButton.clicked
|
// this function is called by auto_tx_mode, which is called by autoButton.clicked
|
||||||
void MainWindow::on_startTxButton_toggled(bool checked)
|
void MainWindow::on_startTxButton_toggled(bool checked)
|
||||||
{
|
{
|
||||||
toggleTx(checked);
|
if(checked){
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::toggleTx(bool start){
|
|
||||||
if(start){
|
|
||||||
// ensure the start button is checked
|
|
||||||
if(!ui->startTxButton->isChecked()){
|
|
||||||
ui->startTxButton->setChecked(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
createMessage(ui->extFreeTextMsgEdit->toPlainText());
|
createMessage(ui->extFreeTextMsgEdit->toPlainText());
|
||||||
startTx();
|
startTx();
|
||||||
} else {
|
} else {
|
||||||
@ -6003,6 +6008,12 @@ void MainWindow::toggleTx(bool start){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::toggleTx(bool start){
|
||||||
|
if(start && ui->startTxButton->isChecked()) { return; }
|
||||||
|
if(!start && !ui->startTxButton->isChecked()) { return; }
|
||||||
|
ui->startTxButton->setChecked(start);
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::splitAndSendNextMessage()
|
void MainWindow::splitAndSendNextMessage()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
22
varicode.cpp
22
varicode.cpp
@ -61,7 +61,7 @@ QMap<QString, int> directed_cmds = {
|
|||||||
{" ", 31 }, // send freetext
|
{" ", 31 }, // send freetext
|
||||||
};
|
};
|
||||||
|
|
||||||
QSet<int> allowed_cmds = {0, 1, 2, 3, 4, /*5,*/ 10, 23, 24, 25, 26, 27, 28, 29, 30, 31};
|
QSet<int> allowed_cmds = {0, 1, 2, 3, 4, 5, /*6,*/ 10, 23, 24, 25, 26, 27, 28, 29, 30, 31};
|
||||||
|
|
||||||
QRegularExpression directed_re("^"
|
QRegularExpression directed_re("^"
|
||||||
"(?<to>[A-Z0-9/]+)"
|
"(?<to>[A-Z0-9/]+)"
|
||||||
@ -199,7 +199,7 @@ QString Varicode::formatPWR(int dbm){
|
|||||||
return QString("%1W").arg(mwatts/1000);
|
return QString("%1W").arg(mwatts/1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Varicode::checksum(QString const &input){
|
QString Varicode::checksum16(QString const &input){
|
||||||
auto fromBytes = input.toLocal8Bit();
|
auto fromBytes = input.toLocal8Bit();
|
||||||
auto crc = CRC::Calculate(fromBytes.data(), fromBytes.length(), CRC::CRC_16_KERMIT());
|
auto crc = CRC::Calculate(fromBytes.data(), fromBytes.length(), CRC::CRC_16_KERMIT());
|
||||||
auto checksum = Varicode::pack16bits(crc);
|
auto checksum = Varicode::pack16bits(crc);
|
||||||
@ -209,12 +209,28 @@ QString Varicode::checksum(QString const &input){
|
|||||||
return checksum;
|
return checksum;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Varicode::checksumValid(QString const &checksum, QString const &input){
|
bool Varicode::checksum16Valid(QString const &checksum, QString const &input){
|
||||||
auto fromBytes = input.toLocal8Bit();
|
auto fromBytes = input.toLocal8Bit();
|
||||||
auto crc = CRC::Calculate(fromBytes.data(), fromBytes.length(), CRC::CRC_16_KERMIT());
|
auto crc = CRC::Calculate(fromBytes.data(), fromBytes.length(), CRC::CRC_16_KERMIT());
|
||||||
return Varicode::pack16bits(crc) == checksum;
|
return Varicode::pack16bits(crc) == checksum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString Varicode::checksum32(QString const &input){
|
||||||
|
auto fromBytes = input.toLocal8Bit();
|
||||||
|
auto crc = CRC::Calculate(fromBytes.data(), fromBytes.length(), CRC::CRC_32_BZIP2());
|
||||||
|
auto checksum = Varicode::pack32bits(crc);
|
||||||
|
if(checksum.length() < 6){
|
||||||
|
checksum += QString(" ").repeated(6-checksum.length());
|
||||||
|
}
|
||||||
|
return checksum;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Varicode::checksum32Valid(QString const &checksum, QString const &input){
|
||||||
|
auto fromBytes = input.toLocal8Bit();
|
||||||
|
auto crc = CRC::Calculate(fromBytes.data(), fromBytes.length(), CRC::CRC_32_BZIP2());
|
||||||
|
return Varicode::pack32bits(crc) == checksum;
|
||||||
|
}
|
||||||
|
|
||||||
QStringList Varicode::parseCallsigns(QString const &input){
|
QStringList Varicode::parseCallsigns(QString const &input){
|
||||||
QStringList callsigns;
|
QStringList callsigns;
|
||||||
QRegularExpression re(compound_callsign_pattern);
|
QRegularExpression re(compound_callsign_pattern);
|
||||||
|
@ -30,8 +30,11 @@ public:
|
|||||||
static QString formatSNR(int snr);
|
static QString formatSNR(int snr);
|
||||||
static QString formatPWR(int dbm);
|
static QString formatPWR(int dbm);
|
||||||
|
|
||||||
static QString checksum(QString const &input);
|
static QString checksum16(QString const &input);
|
||||||
static bool checksumValid(QString const &checksum, QString const &input);
|
static bool checksum16Valid(QString const &checksum, QString const &input);
|
||||||
|
|
||||||
|
static QString checksum32(QString const &input);
|
||||||
|
static bool checksum32Valid(QString const &checksum, QString const &input);
|
||||||
|
|
||||||
static QStringList parseCallsigns(QString const &input);
|
static QStringList parseCallsigns(QString const &input);
|
||||||
static QStringList parseGrids(QString const &input);
|
static QStringList parseGrids(QString const &input);
|
||||||
|
Loading…
Reference in New Issue
Block a user