From 303f3ad34146baeb2233fb7011e15fe99489914f Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Mon, 19 Apr 2021 22:18:45 -0700 Subject: [PATCH 1/2] Missing parenthesis --- wfmain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wfmain.cpp b/wfmain.cpp index be83b05..82549da 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -462,7 +462,7 @@ wfmain::wfmain(const QString serialPortCL, const QString hostCL, QWidget *parent connect(rig, SIGNAL(havePreamp(unsigned char)), this, SLOT(receivePreamp(unsigned char))); 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(this, SIGNAL(getAntenna()), rig, SLOT(getAntenna())); //connect(rig, SIGNAL(haveAntenna(unsigned char)), this, SLOT(receiveAntennaSel(unsigned char))); From 2e5a4f05a440961dfb7e4106d4d93be3f22f283e Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Mon, 19 Apr 2021 22:55:39 -0700 Subject: [PATCH 2/2] Preliminary commit for power-on and power-off functionality. Is not correct for most rigs. --- rigcommander.cpp | 29 +++++++++++++++++++++++++++++ rigcommander.h | 4 ++++ wfmain.cpp | 18 ++++++++++++++++++ wfmain.h | 9 +++++++++ wfmain.ui | 14 ++++++++++++++ 5 files changed, 74 insertions(+) diff --git a/rigcommander.cpp b/rigcommander.cpp index e3dca75..1f6e77d 100644 --- a/rigcommander.cpp +++ b/rigcommander.cpp @@ -233,6 +233,35 @@ void rigCommander::prepDataAndSend(QByteArray data) emit dataForComm(data); } +void rigCommander::powerOn() +{ + QByteArray payload; + + for(int i=0; i < 150; i++) + { + payload.append("\xFE"); + } + + payload.append(payloadPrefix); // FE FE 94 E1 + payload.append("\x18\x01"); + payload.append(payloadSuffix); // FD + +#ifdef QT_DEBUG + qDebug(logRig()) << "Power ON command in rigcommander to be sent to rig: "; + printHex(payload); +#endif + + emit dataForComm(payload); + +} + +void rigCommander::powerOff() +{ + QByteArray payload; + payload.setRawData("\x18\x00", 2); + prepDataAndSend(payload); +} + void rigCommander::enableSpectOutput() { QByteArray payload("\x27\x11\x01"); diff --git a/rigcommander.h b/rigcommander.h index 80e0879..958ac7f 100644 --- a/rigcommander.h +++ b/rigcommander.h @@ -59,6 +59,10 @@ public slots: void commSetup(unsigned char rigCivAddr, udpPreferences prefs); void closeComm(); + // Power: + void powerOn(); + void powerOff(); + // Spectrum: void enableSpectOutput(); void disableSpectOutput(); diff --git a/wfmain.cpp b/wfmain.cpp index 82549da..3be656d 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -347,6 +347,9 @@ wfmain::wfmain(const QString serialPortCL, const QString hostCL, QWidget *parent qRegisterMetaType(); qRegisterMetaType(); + connect(this, SIGNAL(sendPowerOn()), rig, SLOT(powerOn())); + connect(this, SIGNAL(sendPowerOff()), rig, SLOT(powerOff())); + connect(rig, SIGNAL(haveFrequency(freqt)), this, SLOT(receiveFreq(freqt))); connect(this, SIGNAL(getFrequency()), rig, SLOT(getFrequency())); connect(this, SIGNAL(getMode()), rig, SLOT(getMode())); @@ -3741,6 +3744,21 @@ void wfmain::receiveSpectrumSpan(freqt freqspan, bool isSub) } } +void wfmain::on_rigPowerOnBtn_clicked() +{ + emit sendPowerOn(); +} + +void wfmain::on_rigPowerOffBtn_clicked() +{ + QMessageBox::StandardButton reply; + reply = QMessageBox::question(this, "Power", "Power down the radio?", + QMessageBox::Yes|QMessageBox::No); + if (reply == QMessageBox::Yes) { + //emit sendPowerOff(); + } +} + // --- DEBUG FUNCTION --- void wfmain::on_debugBtn_clicked() { diff --git a/wfmain.h b/wfmain.h index c33d4e8..80d2dda 100644 --- a/wfmain.h +++ b/wfmain.h @@ -43,6 +43,11 @@ public: ~wfmain(); signals: + // Power + void sendPowerOn(); + void sendPowerOff(); + + // Frequency, mode, band: void getFrequency(); void setFrequency(freqt freq); void getMode(); @@ -398,6 +403,10 @@ private slots: void on_wfthemeCombo_activated(int index); + void on_rigPowerOnBtn_clicked(); + + void on_rigPowerOffBtn_clicked(); + private: Ui::wfmain *ui; QSettings settings; diff --git a/wfmain.ui b/wfmain.ui index 2e9af63..2f9bc18 100644 --- a/wfmain.ui +++ b/wfmain.ui @@ -1676,6 +1676,20 @@ + + + + Rig Power On + + + + + + + Rig Power Off + + +