Idle-Flush gefixt

This commit is contained in:
2026-08-05 20:44:42 +02:00
parent d3229c7b64
commit 72a2b7edd0
9 changed files with 467 additions and 413 deletions

View File

@@ -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;