From 7e3f4a8ac20085d3edb2ea705f4ab14065cae6d4 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Mon, 12 Feb 2024 22:26:25 +0000 Subject: [PATCH] Fix parsing of received tone --- rigcommander.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/rigcommander.cpp b/rigcommander.cpp index 332b29f..2b7a431 100644 --- a/rigcommander.cpp +++ b/rigcommander.cpp @@ -513,20 +513,19 @@ toneInfo rigCommander::decodeTone(QByteArray eTone) // D(T)CS: 1B 01 TR 01 23 = T/R Invert bits + DCS code 123 toneInfo t; - - if (eTone.length() < 5) { + if (eTone.length() < 3) { return t; } - if((eTone.at(2) & 0x01) == 0x01) + if((eTone.at(0) & 0x01) == 0x01) t.tinv = true; - if((eTone.at(2) & 0x10) == 0x10) + if((eTone.at(0) & 0x10) == 0x10) t.rinv = true; - t.tone += (eTone.at(4) & 0x0f); - t.tone += ((eTone.at(4) & 0xf0) >> 4) * 10; - t.tone += (eTone.at(3) & 0x0f) * 100; - t.tone += ((eTone.at(3) & 0xf0) >> 4) * 1000; + t.tone += (eTone.at(2) & 0x0f); + t.tone += ((eTone.at(2) & 0xf0) >> 4) * 10; + t.tone += (eTone.at(1) & 0x0f) * 100; + t.tone += ((eTone.at(1) & 0xf0) >> 4) * 1000; return t; } @@ -717,7 +716,7 @@ void rigCommander::parseCommand() if (rigCaps.hasCommand29 && payloadIn[0] == '\x29') { vfo = static_cast(payloadIn[1]); - payloadIn.remove(0,2); + payloadIn.remove(0,2); } // As some commands bave both single and multi-byte options, start at 4 characters and work down to 1.