1
0
Fork 0
mirror of https://github.com/EdgeTX/edgetx.git synced 2025-07-25 17:25:10 +03:00

DebugOutput buffer increased and overflow message only printed once.

This commit is contained in:
Damjan Adamic 2017-02-16 10:21:18 +01:00
parent aecd7d15f1
commit 0e97d30363
2 changed files with 8 additions and 3 deletions

View file

@ -32,7 +32,7 @@
extern AppData g; // ensure what "g" means extern AppData g; // ensure what "g" means
DebugOutput * traceCallbackInstance = 0; DebugOutput * traceCallbackInstance = 0;
const int DebugOutput::m_dataBufferMaxSize = 100; // lines of text (this is not the display buffer) const int DebugOutput::m_dataBufferMaxSize = 500; // lines of text (this is not the display buffer)
const int DebugOutput::m_dataPrintFreqDefault = 10; // ms const int DebugOutput::m_dataPrintFreqDefault = 10; // ms
const quint16 DebugOutput::m_savedViewStateVersion = 1; const quint16 DebugOutput::m_savedViewStateVersion = 1;
@ -53,7 +53,8 @@ DebugOutput::DebugOutput(QWidget * parent, SimulatorInterface *simulator):
m_radioProfileId(g.sessionId()), m_radioProfileId(g.sessionId()),
m_dataPrintFreq(m_dataPrintFreqDefault), m_dataPrintFreq(m_dataPrintFreqDefault),
m_running(false), m_running(false),
m_filterExclude(true) m_filterExclude(true),
overflowReported(false)
{ {
ui->setupUi(this); ui->setupUi(this);
@ -178,7 +179,10 @@ void DebugOutput::traceCallback(const char * text)
m_dataBuffer.append(text); m_dataBuffer.append(text);
if (m_dataBuffer.size() > m_dataBufferMaxSize) { if (m_dataBuffer.size() > m_dataBufferMaxSize) {
m_dataBuffer.removeFirst(); m_dataBuffer.removeFirst();
qDebug() << __FILE__ << __LINE__ << "Line buffer overflow! size >" << m_dataBufferMaxSize; if (!overflowReported) {
overflowReported = true;
qDebug() << __FILE__ << __LINE__ << "Line buffer overflow! size >" << m_dataBufferMaxSize;
}
} }
m_mtxDataBuffer.unlock(); m_mtxDataBuffer.unlock();
} }

View file

@ -73,6 +73,7 @@ class DebugOutput : public QWidget
int m_dataPrintFreq; int m_dataPrintFreq;
bool m_running; bool m_running;
bool m_filterExclude; bool m_filterExclude;
bool overflowReported;
const static int m_dataBufferMaxSize; const static int m_dataBufferMaxSize;
const static int m_dataPrintFreqDefault; const static int m_dataPrintFreqDefault;