mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-23 01:55:48 -05:00
PlutoSDR: set FIR filter (3)
This commit is contained in:
parent
11b657a841
commit
e4d1aa121c
@ -162,7 +162,7 @@ bool DevicePlutoSDRBox::get_param(DeviceType devType, const std::string ¶m,
|
||||
}
|
||||
}
|
||||
|
||||
void DevicePlutoSDRBox::set_filter(const std::string &filterConfigStr)
|
||||
void DevicePlutoSDRBox::setFilter(const std::string &filterConfigStr)
|
||||
{
|
||||
int ret;
|
||||
|
||||
@ -445,15 +445,15 @@ void DevicePlutoSDRBox::setFIR(DeviceUse use, uint32_t intdec, uint32_t bw, int
|
||||
|
||||
void DevicePlutoSDRBox::formatFIRHeader(std::ostringstream& ostr, DeviceUse use, uint32_t intdec, int32_t gain)
|
||||
{
|
||||
ostr << use == USE_RX ? "RX 1" : "TX 1" << " GAIN " << gain << " DEC " << intdec << std::endl;
|
||||
ostr << (use == USE_RX ? "RX 1" : "TX 1") << " GAIN " << gain << " DEC " << intdec << std::endl;
|
||||
}
|
||||
|
||||
void DevicePlutoSDRBox::formatFIRCoefficients(std::ostringstream& ostr, uint32_t nbTaps, double normalizedBW)
|
||||
{
|
||||
double fcoeffs = new double[nbTaps];
|
||||
double *fcoeffs = new double[nbTaps];
|
||||
WFIR::BasicFIR(fcoeffs, nbTaps, WFIR::LPF, 0.0, normalizedBW, WFIR::wtBLACKMAN_HARRIS, 0.0);
|
||||
|
||||
for (int i = 0; i < nbTaps; i++) {
|
||||
for (unsigned int i = 0; i < nbTaps; i++) {
|
||||
ostr << (uint16_t) (fcoeffs[i] * 32768.0) << std::endl;
|
||||
}
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ private:
|
||||
bool m_valid;
|
||||
|
||||
bool parseSampleRates(const std::string& rateStr, SampleRates& sampleRates);
|
||||
void set_filter(const std::string& filterConfigStr);
|
||||
void setFilter(const std::string& filterConfigStr);
|
||||
void formatFIRHeader(std::ostringstream& str, DeviceUse use, uint32_t intdec, int32_t gain);
|
||||
void formatFIRCoefficients(std::ostringstream& str, uint32_t nbTaps, double normalizedBW);
|
||||
};
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include <QDebug>
|
||||
|
||||
#include "dsp/filerecord.h"
|
||||
#include "dsp/dspcommands.h"
|
||||
#include "device/devicesourceapi.h"
|
||||
#include "device/devicesinkapi.h"
|
||||
#include "plutosdr/deviceplutosdrparams.h"
|
||||
@ -324,7 +325,7 @@ bool PlutoSDRInput::applySettings(const PlutoSDRInputSettings& settings, bool fo
|
||||
|| (m_settings.m_rateGovernor != settings.m_rateGovernor)
|
||||
|| (m_settings.m_lpfFIRlog2Decim != settings.m_lpfFIRlog2Decim))) || force)
|
||||
{
|
||||
plutoBox->set_filterBW(DevicePlutoSDRBox::USE_RX, (1<<settings.m_lpfFIRlog2Decim), settings.m_lpfFIRBW, settings.m_lpfFIRGain);
|
||||
plutoBox->setFIR(DevicePlutoSDRBox::USE_RX, (1<<settings.m_lpfFIRlog2Decim), settings.m_lpfFIRBW, settings.m_lpfFIRGain);
|
||||
firFilterSet = true;
|
||||
}
|
||||
|
||||
@ -332,7 +333,7 @@ bool PlutoSDRInput::applySettings(const PlutoSDRInputSettings& settings, bool fo
|
||||
if (((settings.m_lpfFIRBW != m_settings.m_lpfFIRBW) ||
|
||||
(settings.m_lpfFIRGain != m_settings.m_lpfFIRGain)) && !firFilterSet)
|
||||
{
|
||||
plutoBox->set_filterBW(DevicePlutoSDRBox::USE_RX, (1<<settings.m_lpfFIRlog2Decim), settings.m_lpfFIRBW, settings.m_lpfFIRGain);
|
||||
plutoBox->setFIR(DevicePlutoSDRBox::USE_RX, (1<<settings.m_lpfFIRlog2Decim), settings.m_lpfFIRBW, settings.m_lpfFIRGain);
|
||||
firFilterSet = true;
|
||||
}
|
||||
|
||||
@ -377,6 +378,12 @@ bool PlutoSDRInput::applySettings(const PlutoSDRInputSettings& settings, bool fo
|
||||
|
||||
m_settings = settings;
|
||||
|
||||
// TODO: calibration
|
||||
if (doCalibration)
|
||||
{
|
||||
qDebug("PlutoSDRInput::applySettings: doCalibration");
|
||||
}
|
||||
|
||||
if (suspendAllOtherThreads)
|
||||
{
|
||||
const std::vector<DeviceSinkAPI*>& sinkBuddies = m_deviceAPI->getSinkBuddies();
|
||||
@ -400,6 +407,10 @@ bool PlutoSDRInput::applySettings(const PlutoSDRInputSettings& settings, bool fo
|
||||
}
|
||||
|
||||
// TODO: forward changes to other (Tx) DSP
|
||||
if (forwardChangeOtherDSP)
|
||||
{
|
||||
qDebug("PlutoSDRInput::applySettings: forwardChangeOtherDSP");
|
||||
}
|
||||
|
||||
if (forwardChangeOwnDSP)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user