From 8b59872d080e5261313a8185e176e49189a92f80 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Fri, 14 May 2021 08:50:53 +0100 Subject: [PATCH] Revert "Slight change to civ detection code" This reverts commit 6fba8c83288c31c4f70cf72a5a825bd9159a5763. --- pttyhandler.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pttyhandler.cpp b/pttyhandler.cpp index 3c7beb6..63b272a 100644 --- a/pttyhandler.cpp +++ b/pttyhandler.cpp @@ -190,11 +190,16 @@ void pttyHandler::receiveDataIn(int fd) { #endif int lastFE = inPortData.lastIndexOf((char)0xfe); - if (inPortData.length() > lastFE + 2 && (quint8)inPortData[lastFE + 2] > (quint8)0xdf && (quint8)inPortData[lastFE + 2] < (quint8)0xef) { + if (civId == 0 && inPortData.length() > lastFE + 2 && (quint8)inPortData[lastFE + 2] > (quint8)0xdf && (quint8)inPortData[lastFE + 2] < (quint8)0xef) { // This is (should be) the remotes CIV id. civId = (quint8)inPortData[lastFE + 2]; qDebug(logSerial()) << "pty detected remote CI-V:" << hex << civId; } + else if (civId != 0 && inPortData.length() > lastFE + 2 && (quint8)inPortData[lastFE + 2] != civId) + { + civId = (quint8)inPortData[lastFE + 2]; + qDebug(logSerial()) << "pty remote CI-V changed:" << hex << (quint8)civId; + } // filter 1A 05 01 12/27 = C-IV transceive command before forwarding on. if (inPortData.contains(QByteArrayLiteral("\x1a\x05\x01\x12")) || inPortData.contains(QByteArrayLiteral("\x1a\x05\x01\x27")))