Fixed issues with frame counting

This commit is contained in:
Jordan Sherer 2018-11-01 02:19:48 -04:00
parent ecf14dcb5c
commit f406553a5f
3 changed files with 15 additions and 25 deletions

View File

@ -8544,7 +8544,7 @@ void MainWindow::updateTextDisplay(){
#if __APPLE__
#define USE_SYNC_FRAME_COUNT 1
#define USE_SYNC_FRAME_COUNT 0
#else
#define USE_SYNC_FRAME_COUNT 0
#endif
@ -8600,28 +8600,14 @@ void MainWindow::refreshTextDisplay(){
);
connect(t, &BuildMessageFramesThread::finished, t, &QObject::deleteLater);
connect(t, &BuildMessageFramesThread::resultReady, this, [this, text](QStringList frames, QList<int> bits){
QStringList textList;
qDebug() << "frames:";
int i = 0;
foreach(auto frame, frames){
auto dt = DecodedText(frame, bits.at(i));
qDebug() << "->" << frame << dt.message() << Varicode::frameTypeString(dt.frameType());
textList.append(dt.message());
i++;
}
auto transmitText = textList.join("");
auto count = frames.length();
connect(t, &BuildMessageFramesThread::resultReady, this, [this, text](QString transmitText, int frames){
// ugh...i hate these globals
m_txTextDirtyLastSelectedCall = callsignSelected(true);
m_txTextDirtyLastText = text;
m_txFrameCountEstimate = count;
m_txFrameCountEstimate = frames;
m_txTextDirty = false;
updateTextStatsDisplay(transmitText, count);
updateTextStatsDisplay(transmitText, frames);
updateTxButtonDisplay();
});

View File

@ -27,6 +27,7 @@
#include "varicode.h"
#include "jsc.h"
#include "decodedtext.h"
#include <cmath>
@ -1892,12 +1893,15 @@ void BuildMessageFramesThread::run(){
m_text
);
QList<QString> frames;
QList<int> bits;
foreach(auto pair, results){
frames.append(pair.first);
bits.append(pair.second);
// TODO: jsherer - we wouldn't normally use decodedtext.h here... but it's useful for computing the actual frames transmitted.
QStringList textList;
qDebug() << "frames:";
foreach(auto frame, results){
auto dt = DecodedText(frame.first, frame.second);
qDebug() << "->" << frame << dt.message() << Varicode::frameTypeString(dt.frameType());
textList.append(dt.message());
}
emit resultReady(frames, bits);
auto transmitText = textList.join("");
emit resultReady(transmitText, results.length());
}

View File

@ -174,7 +174,7 @@ public:
QObject *parent=nullptr);
void run() override;
signals:
void resultReady(QStringList, QList<int>);
void resultReady(QString, int);
private:
QString m_mycall;