diff --git a/rigcommander.cpp b/rigcommander.cpp index 29c3cf8..d900810 100644 --- a/rigcommander.cpp +++ b/rigcommander.cpp @@ -813,6 +813,7 @@ void rigCommander::parseLevels() if(payloadIn[0] = '\x14') { + qDebug() <<__func__<< ": in payload[0] is 0x14"; switch(payloadIn[1]) { case '\x01': @@ -821,6 +822,7 @@ void rigCommander::parseLevels() break; case '\x02': // RX RF Gain + qDebug() << __func__ << ": RF Gain: " << level; emit haveRfGain(level); break; case '\x03': @@ -862,6 +864,7 @@ void rigCommander::parseLevels() if(payloadIn[0] = '\x15') { + qDebug() <<__func__<< ": in payload[0] is 0x15"; switch(payloadIn[1]) { case '\x02': @@ -962,15 +965,15 @@ void rigCommander::getLevels() { // Function to grab all levels qDebug() << __func__ << ": grabbing all levels supported."; - getRfGain(); - getAfGain(); - getSql(); - getTxLevel(); - getMicGain(); - getCompLevel(); - getMonitorLevel(); - getVoxGain(); - getAntiVoxGain(); + getRfGain(); //0x02 + getAfGain(); // 0x01 + getSql(); // 0x03 + getTxLevel(); // 0x0A + getMicGain(); // 0x0B + getCompLevel(); // 0x0E +// getMonitorLevel(); // 0x15 +// getVoxGain(); // 0x16 +// getAntiVoxGain(); // 0x17 } void rigCommander::getMeters(bool transmitting) diff --git a/wfmain.cpp b/wfmain.cpp index fa9f911..7de4920 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -286,6 +286,9 @@ wfmain::wfmain(const QString serialPortCL, const QString hostCL, QWidget *parent connect(this, SIGNAL(setScopeFixedEdge(double,double,unsigned char)), rig, SLOT(setSpectrumBounds(double,double,unsigned char))); connect(this, SIGNAL(setMode(unsigned char, unsigned char)), rig, SLOT(setMode(unsigned char, unsigned char))); + + // Levels (read and write) + connect(this, SIGNAL(getLevels()), rig, SLOT(getLevels())); connect(this, SIGNAL(getRfGain()), rig, SLOT(getRfGain())); connect(this, SIGNAL(getAfGain()), rig, SLOT(getAfGain())); connect(this, SIGNAL(setRfGain(unsigned char)), rig, SLOT(setRfGain(unsigned char))); @@ -295,6 +298,9 @@ wfmain::wfmain(const QString serialPortCL, const QString hostCL, QWidget *parent connect(this, SIGNAL(getSql()), rig, SLOT(getSql())); connect(rig, SIGNAL(haveSql(unsigned char)), this, SLOT(receiveSql(unsigned char))); connect(this, SIGNAL(setSql(unsigned char)), rig, SLOT(setSquelch(unsigned char))); + connect(rig, SIGNAL(haveTxPower(unsigned char)), this, SLOT(receiveTxPower(unsigned char))); + connect(rig, SIGNAL(haveMicGain(unsigned char)), this, SLOT(receiveMicGain(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())); @@ -324,6 +330,8 @@ wfmain::wfmain(const QString serialPortCL, const QString hostCL, QWidget *parent connect(wf, SIGNAL(mouseWheel(QWheelEvent*)), this, SLOT(handleWFScroll(QWheelEvent*))); connect(plot, SIGNAL(mouseWheel(QWheelEvent*)), this, SLOT(handlePlotScroll(QWheelEvent*))); + // Metering + connect(this, SIGNAL(getMeters(bool)), rig, SLOT(getMeters(bool))); ui->plot->addGraph(); // primary ui->plot->addGraph(0, 0); // secondary, peaks, same axis as first? @@ -2214,7 +2222,7 @@ void wfmain::on_afGainSlider_valueChanged(int value) void wfmain::receiveRfGain(unsigned char level) { - // qDebug() << "Receive RF level of" << (int)level << " = " << 100*level/255.0 << "%"; + qDebug() << "Receive RF level of" << (int)level << " = " << 100*level/255.0 << "%"; ui->rfGainSlider->blockSignals(true); ui->rfGainSlider->setValue(level); ui->rfGainSlider->blockSignals(false); @@ -2520,6 +2528,46 @@ void wfmain::on_satOpsBtn_clicked() sat->show(); } +void wfmain::changeSliderQuietly(QSlider *slider, int value) +{ + slider->blockSignals(true); + slider->setValue(value); + slider->blockSignals(false); + +} + +void wfmain::receiveTxPower(unsigned char power) +{ + changeSliderQuietly(ui->txPowerSlider, power); +} + +void wfmain::receiveMicGain(unsigned char gain) +{ + changeSliderQuietly(ui->micGainSlider, gain); +} + +void wfmain::receiveCompLevel(unsigned char compLevel) +{ + (void)compLevel; +} + +void wfmain::receiveMonitorGain(unsigned char monitorGain) +{ + (void)monitorGain; +} + +void wfmain::receiveVoxGain(unsigned char voxGain) +{ + (void)voxGain; +} + +void wfmain::receiveAntiVoxGain(unsigned char antiVoxGain) +{ + (void)antiVoxGain; +} + + + // --- DEBUG FUNCTION --- void wfmain::on_debugBtn_clicked() { @@ -2530,5 +2578,8 @@ void wfmain::on_debugBtn_clicked() //emit getScopeEdge(); // 1,2,3 only in "fixed" mode //emit getScopeSpan(); // in khz, only in "center" mode + emit getLevels(); + // emit getMeters(amTransmitting); + } diff --git a/wfmain.h b/wfmain.h index 9049a50..57c3064 100644 --- a/wfmain.h +++ b/wfmain.h @@ -54,6 +54,11 @@ signals: void setRfGain(unsigned char level); void setAfGain(unsigned char level); void setSql(unsigned char level); + + void getLevels(); + void getMeters(bool isTransmitting); + + void startATU(); void setATU(bool atuEnabled); void getATUStatus(); @@ -125,9 +130,20 @@ private slots: void receivePTTstatus(bool pttOn); void receiveDataModeStatus(bool dataOn); void receiveBandStackReg(float freq, char mode, bool dataOn); // freq, mode, (filter,) datamode + + // Levels: void receiveRfGain(unsigned char level); void receiveAfGain(unsigned char level); void receiveSql(unsigned char level); + void receiveTxPower(unsigned char power); + void receiveMicGain(unsigned char gain); + void receiveCompLevel(unsigned char compLevel); + void receiveMonitorGain(unsigned char monitorGain); + void receiveVoxGain(unsigned char voxGain); + void receiveAntiVoxGain(unsigned char antiVoxGain); + + // Meters: + void receiveATUStatus(unsigned char atustatus); void receiveRigID(rigCapabilities rigCaps); void receiveFoundRigID(rigCapabilities rigCaps); @@ -450,6 +466,7 @@ private: void changeTxBtn(); void issueDelayedCommand(cmds cmd); void issueDelayedCommandPriority(cmds cmd); + void changeSliderQuietly(QSlider *slider, int value); int oldFreqDialVal;