kopia lustrzana https://gitlab.com/eliggett/wfview
Fixed AF/RF/SQL level bug
rodzic
ab477db944
commit
908e928838
|
@ -510,11 +510,17 @@ void rigCommander::parseCommand()
|
|||
|
||||
void rigCommander::parseLevels()
|
||||
{
|
||||
qDebug() << "Received a level status readout: ";
|
||||
//qDebug() << "Received a level status readout: ";
|
||||
// printHex(payloadIn, false, true);
|
||||
|
||||
unsigned char level = (payloadIn[2] * 100) + payloadIn[03];
|
||||
qDebug() << "Level is: " << (int)level << " or " << 100.0*level/255.0 << "%";
|
||||
// wrong: unsigned char level = (payloadIn[2] * 100) + payloadIn[03];
|
||||
unsigned char hundreds = payloadIn[2];
|
||||
unsigned char tens = (payloadIn[3] & 0xf0) >> 4;
|
||||
unsigned char units = (payloadIn[3] & 0x0f);
|
||||
|
||||
unsigned char level = (100*hundreds) + (10*tens) + units;
|
||||
|
||||
//qDebug() << "Level is: " << (int)level << " or " << 100.0*level/255.0 << "%";
|
||||
|
||||
// Typical RF gain response (rather low setting):
|
||||
// "INDEX: 00 01 02 03 04 "
|
||||
|
@ -532,6 +538,7 @@ void rigCommander::parseLevels()
|
|||
break;
|
||||
case '\x03':
|
||||
// Squelch level
|
||||
emit haveSql(level);
|
||||
break;
|
||||
case '\x0A':
|
||||
// TX RF level
|
||||
|
@ -552,6 +559,13 @@ void rigCommander::getAfGain()
|
|||
prepDataAndSend(payload);
|
||||
}
|
||||
|
||||
void rigCommander::getSql()
|
||||
{
|
||||
// Squelch
|
||||
QByteArray payload("\x14\x03");
|
||||
prepDataAndSend(payload);
|
||||
}
|
||||
|
||||
void rigCommander::setRfGain(unsigned char level)
|
||||
{
|
||||
sendLevelCmd(0x02, level);
|
||||
|
@ -633,8 +647,8 @@ void rigCommander::parseRegisters1A()
|
|||
// 01: band stacking memory contents (last freq used is stored here per-band)
|
||||
// 03: filter width
|
||||
// 04: AGC rate
|
||||
qDebug() << "Looking at register 1A :";
|
||||
printHex(payloadIn, false, true);
|
||||
// qDebug() << "Looking at register 1A :";
|
||||
// printHex(payloadIn, false, true);
|
||||
|
||||
// "INDEX: 00 01 02 03 04 "
|
||||
// "DATA: 1a 06 01 03 fd " (data mode enabled, filter width 3 selected)
|
||||
|
|
|
@ -43,6 +43,7 @@ public slots:
|
|||
void getDataMode();
|
||||
void getRfGain();
|
||||
void getAfGain();
|
||||
void getSql();
|
||||
void setRfGain(unsigned char level);
|
||||
void setAfGain(unsigned char level);
|
||||
void startATU();
|
||||
|
@ -61,6 +62,7 @@ signals:
|
|||
void haveSpectrumBounds();
|
||||
void haveRfGain(unsigned char level);
|
||||
void haveAfGain(unsigned char level);
|
||||
void haveSql(unsigned char level);
|
||||
void haveTxPower(unsigned char level);
|
||||
void dataForComm(const QByteArray &outData);
|
||||
void getMoreDebug();
|
||||
|
|
38
wfmain.cpp
38
wfmain.cpp
|
@ -85,6 +85,8 @@ wfmain::wfmain(QWidget *parent) :
|
|||
connect(this, SIGNAL(setAfGain(unsigned char)), rig, SLOT(setAfGain(unsigned char)));
|
||||
connect(rig, SIGNAL(haveRfGain(unsigned char)), this, SLOT(receiveRfGain(unsigned char)));
|
||||
connect(rig, SIGNAL(haveAfGain(unsigned char)), this, SLOT(receiveAfGain(unsigned char)));
|
||||
connect(this, SIGNAL(getSql()), rig, SLOT(getSql()));
|
||||
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)));
|
||||
|
||||
|
@ -138,10 +140,18 @@ wfmain::wfmain(QWidget *parent) :
|
|||
ui->commPortDrop->addItem(serialPortInfo.portName());
|
||||
}
|
||||
|
||||
// Initial state of UI:
|
||||
// TODO: Use QSettings and/or argv to set.
|
||||
ui->fullScreenChk->setChecked(true);
|
||||
ui->useDarkThemeChk->setChecked(true);
|
||||
ui->drawPeakChk->setChecked(true);
|
||||
on_useDarkThemeChk_clicked(true);
|
||||
on_fullScreenChk_clicked(true);
|
||||
on_drawPeakChk_clicked(true);
|
||||
|
||||
getInitialRigState();
|
||||
oldFreqDialVal = ui->freqDial->value();
|
||||
|
||||
//tracer->visible();
|
||||
}
|
||||
|
||||
wfmain::~wfmain()
|
||||
|
@ -167,6 +177,7 @@ void wfmain::getInitialRigState()
|
|||
|
||||
cmdOutQue.append(cmdGetRxGain);
|
||||
cmdOutQue.append(cmdGetAfGain);
|
||||
cmdOutQue.append(cmdGetSql);
|
||||
|
||||
cmdOut = cmdNone;
|
||||
delayedCommand->start();
|
||||
|
@ -317,6 +328,9 @@ void wfmain::runDelayedCommand()
|
|||
case cmdGetAfGain:
|
||||
emit getAfGain();
|
||||
break;
|
||||
case cmdGetSql:
|
||||
emit getSql();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -505,7 +519,15 @@ void wfmain::on_debugBtn_clicked()
|
|||
// Temporary place to try code
|
||||
// emit getDebug();
|
||||
// emit getBandStackReg(0x11,1); // 20M, latest
|
||||
emit getRfGain();
|
||||
// emit getRfGain();
|
||||
|
||||
for(int a=0; a<100; a++)
|
||||
{
|
||||
cmdOutQue.append(cmdGetRxGain);
|
||||
cmdOutQue.append(cmdGetSql);
|
||||
}
|
||||
delayedCommand->start();
|
||||
|
||||
}
|
||||
|
||||
void wfmain::on_stopBtn_clicked()
|
||||
|
@ -1007,16 +1029,24 @@ void wfmain::on_afGainSlider_valueChanged(int value)
|
|||
|
||||
void wfmain::receiveRfGain(unsigned char level)
|
||||
{
|
||||
qDebug() << "Setting RF Gain value to " << (int)level;
|
||||
// qDebug() << "Receive RF level of" << (int)level << " = " << 100*level/255.0 << "%";
|
||||
ui->rfGainSlider->setValue(level);
|
||||
}
|
||||
|
||||
void wfmain::receiveAfGain(unsigned char level)
|
||||
{
|
||||
qDebug() << "Setting AF Gain value to " << (int)level;
|
||||
//qDebug() << "Receive AF level of" << (int)level << " = " << 100*level/255.0 << "%";
|
||||
ui->afGainSlider->setValue(level);
|
||||
}
|
||||
|
||||
void wfmain::receiveSql(unsigned char level)
|
||||
{
|
||||
qDebug() << "Receive SQL level of " << (int)level << " = " << 100*level/255.0 << "%";
|
||||
// ui->sqlSlider->setValue(level); // No SQL control so far
|
||||
}
|
||||
|
||||
|
||||
|
||||
void wfmain::on_drawTracerChk_toggled(bool checked)
|
||||
{
|
||||
tracer->setVisible(checked);
|
||||
|
|
5
wfmain.h
5
wfmain.h
|
@ -37,6 +37,7 @@ signals:
|
|||
void getBandStackReg(char band, char regCode);
|
||||
void getRfGain();
|
||||
void getAfGain();
|
||||
void getSql();
|
||||
void getDebug();
|
||||
void setRfGain(unsigned char level);
|
||||
void setAfGain(unsigned char level);
|
||||
|
@ -60,6 +61,7 @@ private slots:
|
|||
void receiveBandStackReg(float freq, char mode, bool dataOn); // freq, mode, (filter,) datamode
|
||||
void receiveRfGain(unsigned char level);
|
||||
void receiveAfGain(unsigned char level);
|
||||
void receiveSql(unsigned char level);
|
||||
|
||||
void handlePlotClick(QMouseEvent *);
|
||||
void handlePlotDoubleClick(QMouseEvent *);
|
||||
|
@ -206,7 +208,8 @@ private:
|
|||
double freqMhz;
|
||||
double knobFreqMhz;
|
||||
enum cmds {cmdNone, cmdGetFreq, cmdGetMode, cmdGetDataMode, cmdSetDataModeOn, cmdSetDataModeOff,
|
||||
cmdSpecOn, cmdSpecOff, cmdDispEnable, cmdDispDisable, cmdGetRxGain, cmdGetAfGain};
|
||||
cmdSpecOn, cmdSpecOff, cmdDispEnable, cmdDispDisable, cmdGetRxGain, cmdGetAfGain,
|
||||
cmdGetSql};
|
||||
cmds cmdOut;
|
||||
QVector <cmds> cmdOutQue;
|
||||
int oldFreqDialVal;
|
||||
|
|
10
wfmain.ui
10
wfmain.ui
|
@ -6,7 +6,7 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>589</width>
|
||||
<width>630</width>
|
||||
<height>582</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -18,7 +18,7 @@
|
|||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>3</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="mainTab">
|
||||
<attribute name="title">
|
||||
|
@ -1286,7 +1286,7 @@
|
|||
<item>
|
||||
<widget class="QLabel" name="tuneStatusLabel">
|
||||
<property name="text">
|
||||
<string> </string>
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -1329,8 +1329,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>589</width>
|
||||
<height>20</height>
|
||||
<width>630</width>
|
||||
<height>26</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
|
|
Ładowanie…
Reference in New Issue