SpectrumVis and DeviceUISet: add possibility to change spectrum scaling factor for Rx/Tx same spectrum commutation (MIMO)

This commit is contained in:
f4exb 2019-10-26 22:30:53 +02:00
parent 8412260d5a
commit 31a7a0fdde
4 changed files with 43 additions and 0 deletions

View File

@ -70,6 +70,11 @@ DeviceUISet::~DeviceUISet()
delete m_spectrum;
}
void DeviceUISet::setSpectrumScalingFactor(float scalef)
{
m_spectrumVis->setScalef(m_spectrumVis->getInputMessageQueue(), scalef);
}
void DeviceUISet::addChannelMarker(ChannelMarker* channelMarker)
{
m_spectrum->addChannelMarker(channelMarker);

View File

@ -55,6 +55,7 @@ public:
~DeviceUISet();
GLSpectrum *getSpectrum() { return m_spectrum; } //!< Direct spectrum getter
void setSpectrumScalingFactor(float scalef);
void addChannelMarker(ChannelMarker* channelMarker); //!< Add channel marker to spectrum
void addRollupWidget(QWidget *widget); //!< Add rollup widget to channel window

View File

@ -13,6 +13,7 @@ inline double log2f(double n)
#endif
MESSAGE_CLASS_DEFINITION(SpectrumVis::MsgConfigureSpectrumVis, Message)
MESSAGE_CLASS_DEFINITION(SpectrumVis::MsgConfigureScalingFactor, Message)
const Real SpectrumVis::m_mult = (10.0f / log2f(10.0f));
@ -53,6 +54,12 @@ void SpectrumVis::configure(MessageQueue* msgQueue,
msgQueue->push(cmd);
}
void SpectrumVis::setScalef(MessageQueue* msgQueue, Real scalef)
{
MsgConfigureScalingFactor* cmd = new MsgConfigureScalingFactor(scalef);
getInputMessageQueue()->push(cmd);
}
void SpectrumVis::feedTriggered(const SampleVector::const_iterator& triggerPoint, const SampleVector::const_iterator& end, bool positiveOnly)
{
feed(triggerPoint, end, positiveOnly); // normal feed from trigger point
@ -322,6 +329,12 @@ bool SpectrumVis::handleMessage(const Message& message)
conf.getLinear());
return true;
}
else if (MsgConfigureScalingFactor::match(message))
{
MsgConfigureScalingFactor& conf = (MsgConfigureScalingFactor&) message;
handleScalef(conf.getScalef());
return true;
}
else
{
return false;
@ -376,3 +389,9 @@ void SpectrumVis::handleConfigure(int fftSize,
m_ofs = 20.0f * log10f(1.0f / m_fftSize);
m_powFFTDiv = m_fftSize*m_fftSize;
}
void SpectrumVis::handleScalef(Real scalef)
{
QMutexLocker mutexLocker(&m_mutex);
m_scalef = scalef;
}

View File

@ -61,6 +61,22 @@ public:
bool m_linear;
};
class MsgConfigureScalingFactor : public Message
{
MESSAGE_CLASS_DECLARATION
public:
MsgConfigureScalingFactor(Real scalef) :
Message(),
m_scalef(scalef)
{}
Real getScalef() const { return m_scalef; }
private:
Real m_scalef;
};
SpectrumVis(Real scalef, GLSpectrum* glSpectrum = 0);
virtual ~SpectrumVis();
@ -71,6 +87,7 @@ public:
AvgMode averagingMode,
FFTWindow::Function window,
bool m_linear);
void setScalef(MessageQueue* msgQueue, Real scalef);
virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool positiveOnly);
void feedTriggered(const SampleVector::const_iterator& triggerPoint, const SampleVector::const_iterator& end, bool positiveOnly);
@ -113,6 +130,7 @@ private:
AvgMode averagingMode,
FFTWindow::Function window,
bool linear);
void handleScalef(Real scalef);
};
#endif // INCLUDE_SPECTRUMVIS_H