Changed transceiver adjustments to be horizontal. Added passband width

control to the transceiver adjustments.
half-duplex
Elliott Liggett 2023-01-19 23:02:54 -08:00
rodzic 18281798d6
commit 1e79d5d32d
4 zmienionych plików z 298 dodań i 120 usunięć

Wyświetl plik

@ -6,7 +6,8 @@ transceiverAdjustments::transceiverAdjustments(QWidget *parent) :
ui(new Ui::transceiverAdjustments) ui(new Ui::transceiverAdjustments)
{ {
ui->setupUi(this); ui->setupUi(this);
#ifndef QT_DEBUG
// ---- These controls aren't finished yet:
ui->transmitterControlsGroupBox->setVisible(false); // no controls available so far ui->transmitterControlsGroupBox->setVisible(false); // no controls available so far
ui->bassRxLabel->setVisible(false); ui->bassRxLabel->setVisible(false);
ui->bassRxSlider->setVisible(false); ui->bassRxSlider->setVisible(false);
@ -20,10 +21,13 @@ transceiverAdjustments::transceiverAdjustments(QWidget *parent) :
ui->NBRxChkBox->setVisible(false); ui->NBRxChkBox->setVisible(false);
ui->NBRxSlider->setVisible(false); ui->NBRxSlider->setVisible(false);
ui->bandwidthGroupBox->setVisible(false); ui->bandwidthGroupBox->setVisible(false);
ui->otherGrpBox->setVisible(false);
// ----
// Resize to fit new visible contents:
this->window()->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); this->window()->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
this->window()->resize(QSizePolicy::Minimum, QSizePolicy::Minimum); this->window()->resize(QSizePolicy::Minimum, QSizePolicy::Minimum);
#endif
this->setWindowTitle("TransceiverAdjustments"); this->setWindowTitle("TransceiverAdjustments");
} }
@ -37,6 +41,15 @@ transceiverAdjustments::~transceiverAdjustments()
delete ui; delete ui;
} }
void transceiverAdjustments::setMaxPassband(quint16 maxHzAllowed)
{
if( (maxHzAllowed <= 10E3) && (maxHzAllowed != 0) )
{
maxHz = maxHzAllowed;
updatePassband(lastKnownPassband);
}
}
void transceiverAdjustments::on_IFShiftSlider_valueChanged(int value) void transceiverAdjustments::on_IFShiftSlider_valueChanged(int value)
{ {
if(rigCaps.hasIFShift) if(rigCaps.hasIFShift)
@ -104,6 +117,17 @@ void transceiverAdjustments::updateTPBFOuter(unsigned char level)
ui->TPBFOuterSlider->blockSignals(false); ui->TPBFOuterSlider->blockSignals(false);
} }
void transceiverAdjustments::updatePassband(quint16 passbandHz)
{
lastKnownPassband = passbandHz;
float l = 2.0*passbandHz/maxHz;
int val = exp10f(l);
//qDebug() << "Updating slider passband to " << passbandHz << "Hz using 1-100 value:" << val << "with l=" << l << "and max=" << maxHz;
ui->passbandWidthSlider->blockSignals(true);
ui->passbandWidthSlider->setValue(val);
ui->passbandWidthSlider->blockSignals(false);
}
void transceiverAdjustments::on_resetPBTbtn_clicked() void transceiverAdjustments::on_resetPBTbtn_clicked()
{ {
ui->TPBFInnerSlider->setValue(128); ui->TPBFInnerSlider->setValue(128);
@ -112,3 +136,18 @@ void transceiverAdjustments::on_resetPBTbtn_clicked()
ui->IFShiftSlider->setValue(128); ui->IFShiftSlider->setValue(128);
ui->IFShiftSlider->blockSignals(false); ui->IFShiftSlider->blockSignals(false);
} }
void transceiverAdjustments::on_passbandWidthSlider_valueChanged(int value)
{
// value is 1-100
//float maxHz = 10E3;
float l = log10f(value);
float p = l*maxHz/2.0;
quint16 pbHz = (quint16)p;
if(pbHz != 0)
{
//qDebug() << "Setting passband, maxHZ" << maxHz << ", value: " << value << ", l:" << l << ", p:" << p << ", pbHz: " << pbHz;
lastKnownPassband = pbHz;
emit setPassband(pbHz);
}
}

Wyświetl plik

@ -4,8 +4,10 @@
#include <QtGlobal> #include <QtGlobal>
#include <QWidget> #include <QWidget>
#include <math.h>
#include "rigidentities.h" #include "rigidentities.h"
@ -20,17 +22,20 @@ class transceiverAdjustments : public QWidget
public: public:
explicit transceiverAdjustments(QWidget *parent = 0); explicit transceiverAdjustments(QWidget *parent = 0);
~transceiverAdjustments(); ~transceiverAdjustments();
void setMaxPassband(quint16 maxHzAllowed);
signals: signals:
void setIFShift(unsigned char level); void setIFShift(unsigned char level);
void setTPBFInner(unsigned char level); void setTPBFInner(unsigned char level);
void setTPBFOuter(unsigned char level); void setTPBFOuter(unsigned char level);
void setPassband(quint16 passbandHz);
public slots: public slots:
void setRig(rigCapabilities rig); void setRig(rigCapabilities rig);
void updateIFShift(unsigned char level); void updateIFShift(unsigned char level);
void updateTPBFInner(unsigned char level); void updateTPBFInner(unsigned char level);
void updateTPBFOuter(unsigned char level); void updateTPBFOuter(unsigned char level);
void updatePassband(quint16 passbandHz);
private slots: private slots:
@ -42,11 +47,15 @@ private slots:
void on_resetPBTbtn_clicked(); void on_resetPBTbtn_clicked();
void on_passbandWidthSlider_valueChanged(int value);
private: private:
Ui::transceiverAdjustments *ui; Ui::transceiverAdjustments *ui;
rigCapabilities rigCaps; rigCapabilities rigCaps;
bool haveRigCaps = false; bool haveRigCaps = false;
int previousIFShift = 128; int previousIFShift = 128;
float maxHz = 10E3;
quint16 lastKnownPassband = 3500;
}; };
#endif // TRANSCEIVERADJUSTMENTS_H #endif // TRANSCEIVERADJUSTMENTS_H

Wyświetl plik

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>832</width> <width>961</width>
<height>342</height> <height>370</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -166,9 +166,219 @@
<item> <item>
<widget class="QGroupBox" name="receiverControlsGroupBox"> <widget class="QGroupBox" name="receiverControlsGroupBox">
<property name="title"> <property name="title">
<string>Receiver</string> <string>Receiver Passband Controls</string>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_3"> <layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="TPBFOuterLabel">
<property name="minimumSize">
<size>
<width>70</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>70</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>PBF Outer</string>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="TPBFOuterSlider">
<property name="minimumSize">
<size>
<width>230</width>
<height>20</height>
</size>
</property>
<property name="maximum">
<number>255</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="TPBFInnerLabel">
<property name="minimumSize">
<size>
<width>70</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>70</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>PBF Inner</string>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="TPBFInnerSlider">
<property name="minimumSize">
<size>
<width>230</width>
<height>20</height>
</size>
</property>
<property name="maximum">
<number>255</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QLabel" name="IFShiftLabel">
<property name="minimumSize">
<size>
<width>70</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>70</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>IF Shift</string>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="IFShiftSlider">
<property name="minimumSize">
<size>
<width>230</width>
<height>20</height>
</size>
</property>
<property name="maximum">
<number>255</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_9">
<item>
<widget class="QLabel" name="label">
<property name="minimumSize">
<size>
<width>70</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>70</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Filter Width</string>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="passbandWidthSlider">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<widget class="QPushButton" name="resetPBTbtn">
<property name="text">
<string>Reset PBT</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="otherGrpBox">
<property name="title">
<string>Other</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item> <item>
<layout class="QVBoxLayout" name="bassRxVertLayout"> <layout class="QVBoxLayout" name="bassRxVertLayout">
<item> <item>
@ -229,111 +439,6 @@
</item> </item>
</layout> </layout>
</item> </item>
<item>
<layout class="QVBoxLayout" name="IFShiftVertLayout">
<item>
<widget class="QSlider" name="IFShiftSlider">
<property name="minimumSize">
<size>
<width>0</width>
<height>230</height>
</size>
</property>
<property name="maximum">
<number>255</number>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="IFShiftLabel">
<property name="text">
<string>IF Shift</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="PBFInnerVertLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QSlider" name="TPBFInnerSlider">
<property name="minimumSize">
<size>
<width>0</width>
<height>230</height>
</size>
</property>
<property name="maximum">
<number>255</number>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="TPBFInnerLabel">
<property name="text">
<string>PBF Inner</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="TPBFOuterVertLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QSlider" name="TPBFOuterSlider">
<property name="minimumSize">
<size>
<width>0</width>
<height>230</height>
</size>
</property>
<property name="maximum">
<number>255</number>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="TPBFOuterLabel">
<property name="text">
<string>PBF Outer</string>
</property>
</widget>
</item>
</layout>
</item>
<item> <item>
<layout class="QVBoxLayout" name="NRRxVertLayout"> <layout class="QVBoxLayout" name="NRRxVertLayout">
<item> <item>
@ -468,13 +573,6 @@
<property name="topMargin"> <property name="topMargin">
<number>0</number> <number>0</number>
</property> </property>
<item>
<widget class="QPushButton" name="resetPBTbtn">
<property name="text">
<string>Reset PBT</string>
</property>
</widget>
</item>
<item> <item>
<spacer name="horizontalSpacer"> <spacer name="horizontalSpacer">
<property name="orientation"> <property name="orientation">

Wyświetl plik

@ -1039,6 +1039,9 @@ void wfmain::setupMainUI()
connect(this->trxadj, &transceiverAdjustments::setTPBFOuter, connect(this->trxadj, &transceiverAdjustments::setTPBFOuter,
[=](const unsigned char &newValue) { issueCmdUniquePriority(cmdSetTPBFOuter, newValue);} [=](const unsigned char &newValue) { issueCmdUniquePriority(cmdSetTPBFOuter, newValue);}
); );
connect(this->trxadj, &transceiverAdjustments::setPassband,
[=](const quint16 &passbandHz) { issueCmdUniquePriority(cmdSetPassband, passbandHz);}
);
} }
void wfmain::prepareSettingsWindow() void wfmain::prepareSettingsWindow()
@ -4725,7 +4728,7 @@ void wfmain::handlePlotMouseMove(QMouseEvent *me)
if(me->buttons() == Qt::LeftButton && textItem==nullptr && prefs.clickDragTuningEnable) if(me->buttons() == Qt::LeftButton && textItem==nullptr && prefs.clickDragTuningEnable)
{ {
double delta = plot->xAxis->pixelToCoord(me->pos().x()) - mousePressFreq; double delta = plot->xAxis->pixelToCoord(me->pos().x()) - mousePressFreq;
qInfo(logGui()) << "Mouse moving delta: " << delta; qDebug(logGui()) << "Mouse moving delta: " << delta;
if( (( delta < -0.0001 ) || (delta > 0.0001)) && ((delta < 0.501) && (delta > -0.501)) ) if( (( delta < -0.0001 ) || (delta > 0.0001)) && ((delta < 0.501) && (delta > -0.501)) )
{ {
freqt freqGo; freqt freqGo;
@ -4842,6 +4845,34 @@ void wfmain::receiveMode(unsigned char mode, unsigned char filter)
ui->modeFilterCombo->blockSignals(false); ui->modeFilterCombo->blockSignals(false);
} }
quint16 maxPassbandHz = 0;
switch(currentMode)
{
case modeUSB:
case modeLSB:
case modeCW:
case modeCW_R:
case modePSK:
case modePSK_R:
maxPassbandHz = 3600;
break;
case modeRTTY:
case modeRTTY_R:
maxPassbandHz = 2700;
break;
case modeAM:
maxPassbandHz = 10E3;
break;
case modeFM:
maxPassbandHz = 10E3;
break;
default:
break;
}
if(maxPassbandHz != 0)
{
trxadj->setMaxPassband(maxPassbandHz);
}
// Note: we need to know if the DATA mode is active to reach mode-D // Note: we need to know if the DATA mode is active to reach mode-D
// some kind of queued query: // some kind of queued query:
if (rigCaps.hasDataModes && rigCaps.hasTransmit) if (rigCaps.hasDataModes && rigCaps.hasTransmit)
@ -6077,6 +6108,7 @@ void wfmain::receivePassband(quint16 pass)
{ {
if (passBand != (double)(pass / 1000000.0)) { if (passBand != (double)(pass / 1000000.0)) {
passBand = (double)(pass / 1000000.0); passBand = (double)(pass / 1000000.0);
trxadj->updatePassband(pass);
showStatusBarText(QString("IF filter width %1 Hz").arg(pass)); showStatusBarText(QString("IF filter width %1 Hz").arg(pass));
} }
} }