From 9e50b2e037ff1169be6eae096780c84d81a3b9e6 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Thu, 20 Dec 2018 10:56:54 -0800 Subject: [PATCH] Fixed ATU status return. --- rigcommander.cpp | 13 +++++++------ wfmain.cpp | 9 +++++++++ wfmain.h | 1 + 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/rigcommander.cpp b/rigcommander.cpp index 1291508..82851e2 100644 --- a/rigcommander.cpp +++ b/rigcommander.cpp @@ -654,7 +654,7 @@ void rigCommander::parseRegisters1C() // PTT lives here // Not sure if 02 is the right place to switch. // TODO: test this function - switch(payloadIn[02]) + switch(payloadIn[01]) { case '\x00': parsePTT(); @@ -670,12 +670,12 @@ void rigCommander::parseRegisters1C() void rigCommander::parseATU() { + // qDebug() << "Have ATU status from radio. Emitting."; // Expect: - // [0]: - // [1]: 0x1c - // [2]: 0x01 - // [3]: 0 = off, 0x01 = on, 0x02 = tuning in-progress - emit haveATUStatus((unsigned char) payloadIn[3]); + // [0]: 0x1c + // [1]: 0x01 + // [2]: 0 = off, 0x01 = on, 0x02 = tuning in-progress + emit haveATUStatus((unsigned char) payloadIn[2]); } void rigCommander::parsePTT() @@ -1040,6 +1040,7 @@ void rigCommander::setATU(bool enabled) void rigCommander::getATUStatus() { + qDebug() << "Sending out for ATU status in RC."; QByteArray payload("\x1C\x01"); prepDataAndSend(payload); } diff --git a/wfmain.cpp b/wfmain.cpp index f3eafae..d2b1e06 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -150,7 +150,9 @@ wfmain::wfmain(QWidget *parent) : connect(rig, SIGNAL(haveSql(unsigned char)), this, SLOT(receiveSql(unsigned char))); connect(this, SIGNAL(startATU()), rig, SLOT(startATU())); connect(this, SIGNAL(setATU(bool)), rig, SLOT(setATU(bool))); + connect(this, SIGNAL(getATUStatus()), rig, SLOT(getATUStatus())); connect(this, SIGNAL(getRigID()), rig, SLOT(getRigID())); + connect(rig, SIGNAL(haveATUStatus(unsigned char)), this, SLOT(receiveATUStatus(unsigned char))); // Plot user interaction @@ -655,6 +657,9 @@ void wfmain::runDelayedCommand() case cmdGetSql: emit getSql(); break; + case cmdGetATUStatus: + emit getATUStatus(); + break; default: break; } @@ -1491,6 +1496,7 @@ void wfmain::on_saveSettingsBtn_clicked() void wfmain::receiveATUStatus(unsigned char atustatus) { + qDebug() << "Received ATU status update: " << (unsigned int) atustatus; switch(atustatus) { case 0x00: @@ -1510,10 +1516,13 @@ void wfmain::receiveATUStatus(unsigned char atustatus) case 0x02: // ATU tuning in-progress. // Add command queue to check again and update status bar + qDebug() << "Received ATU status update that *tuning* is taking place"; showStatusBarText("Tuning..."); cmdOutQue.append(cmdGetATUStatus); delayedCommand->start(); break; + default: + qDebug() << "Did not understand ATU status: " << (unsigned int) atustatus; } } diff --git a/wfmain.h b/wfmain.h index 9f4c692..3888262 100644 --- a/wfmain.h +++ b/wfmain.h @@ -46,6 +46,7 @@ signals: void setAfGain(unsigned char level); void startATU(); void setATU(bool atuEnabled); + void getATUStatus(); void getRigID(); void spectOutputEnable(); void spectOutputDisable();