Fixed the data frame creation for buffered messages
This commit is contained in:
parent
3058dcb152
commit
c5451a2029
@ -224,6 +224,7 @@ void TransmitTextEdit::on_textContentsChanged(int /*pos*/, int rem, int add){
|
|||||||
//qDebug() << "sent:" << sentText();
|
//qDebug() << "sent:" << sentText();
|
||||||
//qDebug() << "unsent:" << unsentText();
|
//qDebug() << "unsent:" << unsentText();
|
||||||
|
|
||||||
|
m_dirty = true;
|
||||||
m_lastText = text;
|
m_lastText = text;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,6 +46,17 @@ public:
|
|||||||
}
|
}
|
||||||
void setProtected(bool protect);
|
void setProtected(bool protect);
|
||||||
bool cursorShouldBeProtected(QTextCursor c);
|
bool cursorShouldBeProtected(QTextCursor c);
|
||||||
|
|
||||||
|
bool isEmpty() const {
|
||||||
|
return toPlainText().isEmpty();
|
||||||
|
}
|
||||||
|
bool isDirty() const {
|
||||||
|
return m_dirty;
|
||||||
|
}
|
||||||
|
void setClean(){
|
||||||
|
m_dirty = false;
|
||||||
|
}
|
||||||
|
|
||||||
void highlightBase();
|
void highlightBase();
|
||||||
void highlightCharsSent();
|
void highlightCharsSent();
|
||||||
void highlight();
|
void highlight();
|
||||||
@ -61,6 +72,7 @@ private:
|
|||||||
int m_sent;
|
int m_sent;
|
||||||
QString m_textSent;
|
QString m_textSent;
|
||||||
bool m_protected;
|
bool m_protected;
|
||||||
|
bool m_dirty;
|
||||||
QFont m_font;
|
QFont m_font;
|
||||||
QColor m_fg;
|
QColor m_fg;
|
||||||
QColor m_bg;
|
QColor m_bg;
|
||||||
|
@ -463,6 +463,7 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
|
|||||||
m_i3bit {0},
|
m_i3bit {0},
|
||||||
m_manual {&m_network_manager},
|
m_manual {&m_network_manager},
|
||||||
m_txFrameCount {0},
|
m_txFrameCount {0},
|
||||||
|
m_txFrameCountSent {0},
|
||||||
m_txTextDirty {false},
|
m_txTextDirty {false},
|
||||||
m_txFrameCountEstimate {0},
|
m_txFrameCountEstimate {0},
|
||||||
m_previousFreq {0},
|
m_previousFreq {0},
|
||||||
@ -4936,7 +4937,6 @@ void MainWindow::guiUpdate()
|
|||||||
// 0: [000] <- this is standard set
|
// 0: [000] <- this is standard set
|
||||||
// 1: [001] <- this is fox/hound
|
// 1: [001] <- this is fox/hound
|
||||||
//m_i3bit=0;
|
//m_i3bit=0;
|
||||||
qDebug() << "gen tones" << message;
|
|
||||||
char ft8msgbits[75 + 12]; //packed 75 bit ft8 message plus 12-bit CRC
|
char ft8msgbits[75 + 12]; //packed 75 bit ft8 message plus 12-bit CRC
|
||||||
|
|
||||||
if(m_nSubMode == Varicode::JS8CallNormal){
|
if(m_nSubMode == Varicode::JS8CallNormal){
|
||||||
@ -4949,6 +4949,9 @@ void MainWindow::guiUpdate()
|
|||||||
const_cast<int *> (itone), 22, 6, 22);
|
const_cast<int *> (itone), 22, 6, 22);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qDebug() << "-> msg:" << message;
|
||||||
|
qDebug() << "-> bit:" << m_i3bit;
|
||||||
|
|
||||||
msgibits = m_i3bit;
|
msgibits = m_i3bit;
|
||||||
msgsent[22]=0;
|
msgsent[22]=0;
|
||||||
|
|
||||||
@ -5276,6 +5279,10 @@ void MainWindow::startTx()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
auto text = ui->extFreeTextMsgEdit->toPlainText();
|
||||||
|
if(!ensureCreateMessageReady(text)){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(!prepareNextMessageFrame()){
|
if(!prepareNextMessageFrame()){
|
||||||
return;
|
return;
|
||||||
@ -6210,6 +6217,7 @@ void MainWindow::restoreMessage(){
|
|||||||
|
|
||||||
void MainWindow::resetMessageTransmitQueue(){
|
void MainWindow::resetMessageTransmitQueue(){
|
||||||
m_txFrameCount = 0;
|
m_txFrameCount = 0;
|
||||||
|
m_txFrameCountSent = 0;
|
||||||
m_txFrameQueue.clear();
|
m_txFrameQueue.clear();
|
||||||
m_txMessageQueue.clear();
|
m_txMessageQueue.clear();
|
||||||
|
|
||||||
@ -6334,7 +6342,7 @@ QList<QPair<QString, int>> MainWindow::buildMessageFrames(const QString &text){
|
|||||||
bool forceIdentify = !m_config.avoid_forced_identify();
|
bool forceIdentify = !m_config.avoid_forced_identify();
|
||||||
|
|
||||||
// TODO: might want to be more explicit?
|
// TODO: might want to be more explicit?
|
||||||
bool forceData = !m_totalTxMessage.isEmpty();
|
bool forceData = m_txFrameCountSent > 0;
|
||||||
|
|
||||||
auto frames = Varicode::buildMessageFrames(
|
auto frames = Varicode::buildMessageFrames(
|
||||||
mycall,
|
mycall,
|
||||||
@ -6361,10 +6369,7 @@ bool MainWindow::prepareNextMessageFrame()
|
|||||||
m_i3bit = Varicode::JS8Call;
|
m_i3bit = Varicode::JS8Call;
|
||||||
|
|
||||||
// typeahead
|
// typeahead
|
||||||
static QString lastText;
|
if(ui->extFreeTextMsgEdit->isDirty() && !ui->extFreeTextMsgEdit->isEmpty()){
|
||||||
auto text = ui->extFreeTextMsgEdit->toPlainText();
|
|
||||||
if(!text.isEmpty() && (lastText == "" || lastText != text)){
|
|
||||||
#if 1
|
|
||||||
auto sent = ui->extFreeTextMsgEdit->sentText();
|
auto sent = ui->extFreeTextMsgEdit->sentText();
|
||||||
auto unsent = ui->extFreeTextMsgEdit->unsentText();
|
auto unsent = ui->extFreeTextMsgEdit->unsentText();
|
||||||
qDebug() << "text dirty for typeahead\n" << sent << "\n" << unsent;
|
qDebug() << "text dirty for typeahead\n" << sent << "\n" << unsent;
|
||||||
@ -6372,45 +6377,44 @@ bool MainWindow::prepareNextMessageFrame()
|
|||||||
m_txFrameCount = 0;
|
m_txFrameCount = 0;
|
||||||
auto newText = appendMessage(unsent);
|
auto newText = appendMessage(unsent);
|
||||||
ui->extFreeTextMsgEdit->replaceUnsentText(newText);
|
ui->extFreeTextMsgEdit->replaceUnsentText(newText);
|
||||||
#else
|
ui->extFreeTextMsgEdit->setClean();
|
||||||
m_txFrameQueue.clear();
|
|
||||||
auto newText = appendMessage(text);
|
|
||||||
for(int i = 0; i < m_txFrameCount; i++){
|
|
||||||
if(m_txFrameQueue.isEmpty()){
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
m_txFrameQueue.removeFirst();
|
|
||||||
}
|
|
||||||
ui->extFreeTextMsgEdit->replacePlainText(newText);
|
|
||||||
#endif
|
|
||||||
lastText = text;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QPair<QString, int> f = popMessageFrame();
|
QPair<QString, int> f = popMessageFrame();
|
||||||
auto frame = f.first;
|
auto frame = f.first;
|
||||||
auto bits = f.second;
|
auto bits = f.second;
|
||||||
|
|
||||||
// append this frame to the total message sent so far
|
// if not the first frame, ensure first bit is not set
|
||||||
auto dt = DecodedText(frame, bits, m_nSubMode);
|
if(m_txFrameCountSent > 0){
|
||||||
m_totalTxMessage.append(dt.message());
|
bits &= ~Varicode::JS8CallFirst;
|
||||||
ui->extFreeTextMsgEdit->setCharsSent(m_totalTxMessage.length());
|
}
|
||||||
qDebug() << "total sent:\n" << m_totalTxMessage;
|
|
||||||
|
// if last frame, ensure the last bit is set
|
||||||
|
if(m_txFrameQueue.isEmpty()){
|
||||||
|
bits |= Varicode::JS8CallLast;
|
||||||
|
}
|
||||||
|
|
||||||
if(frame.isEmpty()){
|
if(frame.isEmpty()){
|
||||||
ui->nextFreeTextMsg->clear();
|
ui->nextFreeTextMsg->clear();
|
||||||
updateTxButtonDisplay();
|
updateTxButtonDisplay();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
} else {
|
|
||||||
ui->nextFreeTextMsg->setText(frame);
|
|
||||||
m_i3bit = bits;
|
|
||||||
|
|
||||||
updateTxButtonDisplay();
|
|
||||||
|
|
||||||
// TODO: bump heartbeat
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// append this frame to the total message sent so far
|
||||||
|
auto dt = DecodedText(frame, bits, m_nSubMode);
|
||||||
|
m_totalTxMessage.append(dt.message());
|
||||||
|
ui->extFreeTextMsgEdit->setCharsSent(m_totalTxMessage.length());
|
||||||
|
m_txFrameCountSent += 1;
|
||||||
|
qDebug() << "total sent:" << m_txFrameCountSent << "\n" << m_totalTxMessage;
|
||||||
|
|
||||||
|
ui->nextFreeTextMsg->setText(frame);
|
||||||
|
m_i3bit = bits;
|
||||||
|
|
||||||
|
updateTxButtonDisplay();
|
||||||
|
|
||||||
|
// TODO: bump heartbeat
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MainWindow::isFreqOffsetFree(int f, int bw){
|
bool MainWindow::isFreqOffsetFree(int f, int bw){
|
||||||
@ -6618,16 +6622,17 @@ QString MainWindow::calculateDistance(QString const& value, int *pDistance, int
|
|||||||
void MainWindow::on_startTxButton_toggled(bool checked)
|
void MainWindow::on_startTxButton_toggled(bool checked)
|
||||||
{
|
{
|
||||||
if(checked){
|
if(checked){
|
||||||
auto text = ui->extFreeTextMsgEdit->toPlainText();
|
// auto text = ui->extFreeTextMsgEdit->toPlainText();
|
||||||
if(ensureCreateMessageReady(text)){
|
// if(ensureCreateMessageReady(text)){
|
||||||
|
//
|
||||||
auto txText = createMessage(text);
|
// auto txText = createMessage(text);
|
||||||
if(txText != text){
|
// if(txText != text){
|
||||||
ui->extFreeTextMsgEdit->setPlainText(txText);
|
// ui->extFreeTextMsgEdit->setPlainText(txText);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
startTx();
|
// startTx();
|
||||||
}
|
// }
|
||||||
|
startTx();
|
||||||
} else {
|
} else {
|
||||||
resetMessage();
|
resetMessage();
|
||||||
on_stopTxButton_clicked();
|
on_stopTxButton_clicked();
|
||||||
|
@ -791,6 +791,7 @@ private:
|
|||||||
bool m_rxDisplayDirty;
|
bool m_rxDisplayDirty;
|
||||||
int m_txFrameCountEstimate;
|
int m_txFrameCountEstimate;
|
||||||
int m_txFrameCount;
|
int m_txFrameCount;
|
||||||
|
int m_txFrameCountSent;
|
||||||
QTimer m_txTextDirtyDebounce;
|
QTimer m_txTextDirtyDebounce;
|
||||||
bool m_txTextDirty;
|
bool m_txTextDirty;
|
||||||
QString m_txTextDirtyLastText;
|
QString m_txTextDirtyLastText;
|
||||||
|
@ -2044,7 +2044,12 @@ QList<QPair<QString, int>> Varicode::buildMessageFrames(QString const& mycall,
|
|||||||
line = lstrip(line);
|
line = lstrip(line);
|
||||||
|
|
||||||
qDebug() << "before:" << line;
|
qDebug() << "before:" << line;
|
||||||
|
|
||||||
|
#if 1
|
||||||
int checksumSize = Varicode::isCommandChecksumed(dirCmd);
|
int checksumSize = Varicode::isCommandChecksumed(dirCmd);
|
||||||
|
#else
|
||||||
|
int checksumSize = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
if(checksumSize == 32){
|
if(checksumSize == 32){
|
||||||
line = line + " " + Varicode::checksum32(line);
|
line = line + " " + Varicode::checksum32(line);
|
||||||
@ -2111,7 +2116,7 @@ void BuildMessageFramesThread::run(){
|
|||||||
qDebug() << "frames:";
|
qDebug() << "frames:";
|
||||||
foreach(auto frame, results){
|
foreach(auto frame, results){
|
||||||
auto dt = DecodedText(frame.first, frame.second, m_submode);
|
auto dt = DecodedText(frame.first, frame.second, m_submode);
|
||||||
qDebug() << "->" << frame << dt.message() << Varicode::frameTypeString(dt.frameType()) << m_submode;
|
qDebug() << "->" << frame << dt.message() << Varicode::frameTypeString(dt.frameType()) << "submode:" << m_submode;
|
||||||
textList.append(dt.message());
|
textList.append(dt.message());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user