Idle-Flush gefixt
This commit is contained in:
@@ -47,9 +47,11 @@ private slots:
|
||||
void onReadyRead();
|
||||
void onPortError(QSerialPort::SerialPortError err);
|
||||
void tryReconnect();
|
||||
void flushScanTail();
|
||||
|
||||
private:
|
||||
void processRawData(const QByteArray &data);
|
||||
void appendToLineBuffer(const QByteArray &toProcess);
|
||||
void processLine(const QString &line);
|
||||
void scheduleReconnect();
|
||||
|
||||
@@ -59,6 +61,16 @@ private:
|
||||
QString m_buffer;
|
||||
QByteArray m_scanTail; // carries partial ANSI sequences across reads
|
||||
|
||||
// If no further bytes arrive shortly after some data was held back in
|
||||
// m_scanTail (to safely detect a possibly-split ANSI sequence), this
|
||||
// timer fires and flushes that tail through the normal line-processing
|
||||
// path anyway. Without this, the last line(s) of a burst can sit stuck
|
||||
// in m_scanTail indefinitely if the sender goes quiet (e.g. a device
|
||||
// that streams a final line and then stops) and only surface once new
|
||||
// bytes eventually arrive (e.g. after a reboot).
|
||||
QTimer *m_idleFlushTimer = nullptr;
|
||||
static constexpr int kIdleFlushMs = 50;
|
||||
|
||||
QTimer *m_reconnectTimer = nullptr;
|
||||
bool m_autoReconnect = true;
|
||||
bool m_userDisconnected = false;
|
||||
|
||||
Reference in New Issue
Block a user