From e4dea630296e3bb3d168f37786aae1cf05684482 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Fri, 16 Jul 2021 19:33:15 +0100 Subject: [PATCH] Get antenna status on start-up and slow poll for it. --- rigcommander.cpp | 3 +++ rigcommander.h | 2 +- wfmain.cpp | 11 ++++++++++- wfmain.h | 2 +- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/rigcommander.cpp b/rigcommander.cpp index d2741c0..47dc9d1 100644 --- a/rigcommander.cpp +++ b/rigcommander.cpp @@ -1222,6 +1222,9 @@ void rigCommander::parseCommand() case '\x11': emit haveAttenuator((unsigned char)payloadIn.at(1)); break; + case '\x12': + //qInfo(logRig()) << QString("Have Antenna: %1 %2").arg(payloadIn.at(1)).arg(payloadIn.at(2)); + emit haveAntenna((unsigned char)payloadIn.at(1), (bool)payloadIn.at(2)); case '\x14': // read levels parseLevels(); diff --git a/rigcommander.h b/rigcommander.h index 730bcd9..0199547 100644 --- a/rigcommander.h +++ b/rigcommander.h @@ -344,7 +344,7 @@ signals: void haveATUStatus(unsigned char status); void haveAttenuator(unsigned char att); void havePreamp(unsigned char pre); - void haveAntenna(unsigned char ant); + void haveAntenna(unsigned char ant,bool rx); // Rig State void stateInfo(rigStateStruct* state); diff --git a/wfmain.cpp b/wfmain.cpp index 8467db3..f5e4a98 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -345,7 +345,7 @@ void wfmain::rigConnections() connect(this, SIGNAL(getAttenuator()), rig, SLOT(getAttenuator())); connect(rig, SIGNAL(haveAttenuator(unsigned char)), this, SLOT(receiveAttenuator(unsigned char))); connect(this, SIGNAL(getAntenna()), rig, SLOT(getAntenna())); - //connect(rig, SIGNAL(haveAntenna(unsigned char)), this, SLOT(receiveAntennaSel(unsigned char))); + connect(rig, SIGNAL(haveAntenna(unsigned char,bool)), this, SLOT(receiveAntennaSel(unsigned char,bool))); // Speech (emitted from rig speaker) @@ -2954,6 +2954,9 @@ void wfmain::initPeriodicCommands() insertSlowPeriodicCommand(cmdGetAttenuator, 128); insertSlowPeriodicCommand(cmdGetPTT, 128); insertSlowPeriodicCommand(cmdGetPreamp, 128); + if (rigCaps.hasRXAntenna) { + insertSlowPeriodicCommand(cmdGetAntenna, 128); + } } void wfmain::insertPeriodicCommand(cmds cmd, unsigned char priority) @@ -4751,6 +4754,12 @@ void wfmain::receiveAttenuator(unsigned char att) ui->attSelCombo->setCurrentIndex(attindex); } +void wfmain::receiveAntennaSel(unsigned char ant, bool rx) +{ + ui->antennaSelCombo->setCurrentIndex(ant); + ui->rxAntennaCheck->setChecked(rx); +} + void wfmain::receiveSpectrumSpan(freqt freqspan, bool isSub) { if(!isSub) diff --git a/wfmain.h b/wfmain.h index a1ae809..3d5d561 100644 --- a/wfmain.h +++ b/wfmain.h @@ -234,7 +234,7 @@ private slots: void receiveATUStatus(unsigned char atustatus); void receivePreamp(unsigned char pre); void receiveAttenuator(unsigned char att); - //void receiveAntennaSel(unsigned char ant); + void receiveAntennaSel(unsigned char ant, bool rx); void receiveRigID(rigCapabilities rigCaps); void receiveFoundRigID(rigCapabilities rigCaps); void receiveSerialPortError(QString port, QString errorText);