mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-10 18:43:28 -05:00
Added shift to channel marker to take RIT into account
This commit is contained in:
parent
c99f2e1914
commit
51870a2ae1
@ -271,6 +271,7 @@ void WDSPRxGUI::on_rit_toggled(bool checked)
|
||||
{
|
||||
m_settings.m_rit = checked;
|
||||
m_settings.m_profiles[m_settings.m_profileIndex].m_rit = m_settings.m_rit;
|
||||
m_channelMarker.setShift(checked ? m_settings.m_ritFrequency: 0);
|
||||
applySettings();
|
||||
}
|
||||
|
||||
@ -278,6 +279,7 @@ void WDSPRxGUI::on_ritFrequency_valueChanged(int value)
|
||||
{
|
||||
m_settings.m_ritFrequency = value;
|
||||
ui->ritFrequencyText->setText(tr("%1").arg(value));
|
||||
m_channelMarker.setShift(m_settings.m_rit ? value: 0);
|
||||
applySettings();
|
||||
}
|
||||
|
||||
@ -742,7 +744,11 @@ void WDSPRxGUI::applyBandwidths(unsigned int spanLog2, bool force)
|
||||
m_channelMarker.setBandwidth(bw * 200);
|
||||
m_channelMarker.setSidebands(dsb ? ChannelMarker::dsb : bw < 0 ? ChannelMarker::lsb : ChannelMarker::usb);
|
||||
ui->dsb->setIcon(bw < 0 ? m_iconDSBLSB: m_iconDSBUSB);
|
||||
if (!dsb) { m_channelMarker.setLowCutoff(lw * 100); }
|
||||
|
||||
if (!dsb) {
|
||||
m_channelMarker.setLowCutoff(lw * 100);
|
||||
}
|
||||
|
||||
blockApplySettings(wasBlocked);
|
||||
}
|
||||
|
||||
@ -753,6 +759,10 @@ void WDSPRxGUI::displaySettings()
|
||||
m_channelMarker.setBandwidth(m_settings.m_profiles[m_settings.m_profileIndex].m_highCutoff * 2);
|
||||
m_channelMarker.setTitle(m_settings.m_title);
|
||||
m_channelMarker.setLowCutoff(m_settings.m_profiles[m_settings.m_profileIndex].m_lowCutoff);
|
||||
int shift = m_settings.m_profiles[m_settings.m_profileIndex].m_rit ?
|
||||
m_settings.m_profiles[m_settings.m_profileIndex].m_ritFrequency :
|
||||
0;
|
||||
m_channelMarker.setShift(shift);
|
||||
|
||||
if (m_deviceUISet->m_deviceMIMOEngine)
|
||||
{
|
||||
|
@ -52,6 +52,7 @@ ChannelMarker::ChannelMarker(QObject* parent) :
|
||||
m_bandwidth(0),
|
||||
m_oppositeBandwidth(0),
|
||||
m_lowCutoff(0),
|
||||
m_shift(0),
|
||||
m_sidebands(dsb),
|
||||
m_visible(false),
|
||||
m_highlighted(false),
|
||||
@ -107,6 +108,12 @@ void ChannelMarker::setLowCutoff(int lowCutoff)
|
||||
emit changedByAPI();
|
||||
}
|
||||
|
||||
void ChannelMarker::setShift(int shift)
|
||||
{
|
||||
m_shift = shift;
|
||||
emit changedByAPI();
|
||||
}
|
||||
|
||||
void ChannelMarker::setSidebands(sidebands_t sidebands)
|
||||
{
|
||||
m_sidebands = sidebands;
|
||||
|
@ -69,6 +69,9 @@ public:
|
||||
void setLowCutoff(int lowCutoff);
|
||||
int getLowCutoff() const { return m_lowCutoff; }
|
||||
|
||||
void setShift(int shift);
|
||||
int getShift() const { return m_shift; }
|
||||
|
||||
void setSidebands(sidebands_t sidebands);
|
||||
sidebands_t getSidebands() const { return m_sidebands; }
|
||||
|
||||
@ -118,6 +121,7 @@ protected:
|
||||
int m_bandwidth;
|
||||
int m_oppositeBandwidth;
|
||||
int m_lowCutoff;
|
||||
int m_shift;
|
||||
sidebands_t m_sidebands;
|
||||
bool m_visible;
|
||||
bool m_highlighted;
|
||||
|
@ -564,9 +564,17 @@ void GLSpectrumView::setUseCalibration(bool useCalibration)
|
||||
update();
|
||||
}
|
||||
|
||||
void GLSpectrumView::setMeasurementParams(SpectrumSettings::Measurement measurement,
|
||||
int centerFrequencyOffset, int bandwidth, int chSpacing, int adjChBandwidth,
|
||||
int harmonics, int peaks, bool highlight, int precision)
|
||||
void GLSpectrumView::setMeasurementParams(
|
||||
SpectrumSettings::Measurement measurement,
|
||||
int centerFrequencyOffset,
|
||||
int bandwidth,
|
||||
int chSpacing,
|
||||
int adjChBandwidth,
|
||||
int harmonics,
|
||||
int peaks,
|
||||
bool highlight,
|
||||
int precision
|
||||
)
|
||||
{
|
||||
m_mutex.lock();
|
||||
m_measurement = measurement;
|
||||
@ -1280,7 +1288,7 @@ void GLSpectrumView::paintGL()
|
||||
GLfloat h = m_frequencyPixmap.height() / (GLfloat) m_waterfallHeight;
|
||||
|
||||
GLfloat vtx1[] = {
|
||||
-l, -h,
|
||||
-l, - h,
|
||||
1.0f+r, -h,
|
||||
1.0f+r, 0.0f,
|
||||
-l, 0.0f
|
||||
@ -2201,13 +2209,22 @@ void GLSpectrumView::measurePeak()
|
||||
findPeak(power, frequency);
|
||||
|
||||
drawTextsRight(
|
||||
{"Peak: ", ""},
|
||||
{
|
||||
"Peak: ",
|
||||
""
|
||||
},
|
||||
{
|
||||
displayPower(power, m_linear ? 'e' : 'f', m_linear ? 3 : 1),
|
||||
displayFull(frequency)
|
||||
},
|
||||
{m_peakPowerMaxStr, m_peakFrequencyMaxStr},
|
||||
{m_peakPowerUnits, "Hz"}
|
||||
{
|
||||
m_peakPowerMaxStr,
|
||||
m_peakFrequencyMaxStr
|
||||
},
|
||||
{
|
||||
m_peakPowerUnits,
|
||||
"Hz"
|
||||
}
|
||||
);
|
||||
if (m_measurements) {
|
||||
m_measurements->setPeak(0, frequency, power);
|
||||
@ -3032,23 +3049,31 @@ void GLSpectrumView::applyChanges()
|
||||
xc = m_centerFrequency + dv->m_channelMarker->getCenterFrequency(); // marker center frequency
|
||||
dsbw = dv->m_channelMarker->getBandwidth();
|
||||
|
||||
if (sidebands == ChannelMarker::usb) {
|
||||
nw = dv->m_channelMarker->getLowCutoff(); // negative bandwidth
|
||||
if (sidebands == ChannelMarker::usb)
|
||||
{
|
||||
nw = dv->m_channelMarker->getLowCutoff() + dv->m_channelMarker->getShift(); // negative bandwidth
|
||||
int bw = dv->m_channelMarker->getBandwidth() / 2;
|
||||
pw = (qreal) bw; // positive bandwidth
|
||||
} else if (sidebands == ChannelMarker::lsb) {
|
||||
pw = dv->m_channelMarker->getLowCutoff();
|
||||
pw = (qreal) bw + dv->m_channelMarker->getShift(); // positive bandwidth
|
||||
}
|
||||
else if (sidebands == ChannelMarker::lsb)
|
||||
{
|
||||
pw = dv->m_channelMarker->getLowCutoff() + dv->m_channelMarker->getShift();
|
||||
int bw = dv->m_channelMarker->getBandwidth() / 2;
|
||||
nw = (qreal) bw;
|
||||
} else if (sidebands == ChannelMarker::vusb) {
|
||||
nw = -dv->m_channelMarker->getOppositeBandwidth(); // negative bandwidth
|
||||
pw = dv->m_channelMarker->getBandwidth(); // positive bandwidth
|
||||
} else if (sidebands == ChannelMarker::vlsb) {
|
||||
pw = dv->m_channelMarker->getOppositeBandwidth(); // positive bandwidth
|
||||
nw = -dv->m_channelMarker->getBandwidth(); // negative bandwidth
|
||||
} else {
|
||||
pw = dsbw / 2;
|
||||
nw = -pw;
|
||||
nw = (qreal) bw + dv->m_channelMarker->getShift();
|
||||
}
|
||||
else if (sidebands == ChannelMarker::vusb)
|
||||
{
|
||||
nw = -dv->m_channelMarker->getOppositeBandwidth() + dv->m_channelMarker->getShift(); // negative bandwidth
|
||||
pw = dv->m_channelMarker->getBandwidth() + dv->m_channelMarker->getShift(); // positive bandwidth
|
||||
}
|
||||
else if (sidebands == ChannelMarker::vlsb) {
|
||||
pw = dv->m_channelMarker->getOppositeBandwidth() + dv->m_channelMarker->getShift(); // positive bandwidth
|
||||
nw = -dv->m_channelMarker->getBandwidth() + dv->m_channelMarker->getShift(); // negative bandwidth
|
||||
}
|
||||
else
|
||||
{
|
||||
pw = (dsbw / 2) + dv->m_channelMarker->getShift();
|
||||
nw = -(dsbw / 2) + dv->m_channelMarker->getShift();
|
||||
}
|
||||
|
||||
// draw the DSB rectangle
|
||||
|
Loading…
Reference in New Issue
Block a user