1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-23 01:55:48 -05:00

LimeSDR: Rx/Tx interaction

This commit is contained in:
f4exb 2017-09-20 18:25:54 +02:00
parent 73d9cfec6e
commit d1061a3c2f
6 changed files with 113 additions and 6 deletions

View File

@ -16,5 +16,7 @@
#include "deviceplutosdrshared.h" #include "deviceplutosdrshared.h"
MESSAGE_CLASS_DEFINITION(DevicePlutoSDRShared::MsgCrossReportToBuddy, Message)
const float DevicePlutoSDRShared::m_sampleFifoLengthInSeconds = 0.25; const float DevicePlutoSDRShared::m_sampleFifoLengthInSeconds = 0.25;
const int DevicePlutoSDRShared::m_sampleFifoMinSize = 48000; // 192kS/s knee const int DevicePlutoSDRShared::m_sampleFifoMinSize = 48000; // 192kS/s knee

View File

@ -48,34 +48,40 @@ public:
uint32_t getLpfFirbw() const { return m_lpfFIRBW; } uint32_t getLpfFirbw() const { return m_lpfFIRBW; }
bool isLpfFirEnable() const { return m_lpfFIREnable; } bool isLpfFirEnable() const { return m_lpfFIREnable; }
uint32_t getLpfFiRlog2IntDec() const { return m_lpfFIRlogIntDec; } uint32_t getLpfFiRlog2IntDec() const { return m_lpfFIRlogIntDec; }
int32_t getLoPPMTenths() const { return m_loPPMTenths; }
static MsgCrossReportToBuddy *create(uint64_t devSampleRate, static MsgCrossReportToBuddy *create(uint64_t devSampleRate,
bool lpfFIREnable, bool lpfFIREnable,
uint32_t lpfFIRlog2Interp, uint32_t lpfFIRlog2Interp,
uint32_t lpfFIRBW) uint32_t lpfFIRBW,
int32_t loPPMTenths)
{ {
return new MsgCrossReportToBuddy(devSampleRate, return new MsgCrossReportToBuddy(devSampleRate,
lpfFIREnable, lpfFIREnable,
lpfFIRlog2Interp, lpfFIRlog2Interp,
lpfFIRBW); lpfFIRBW,
loPPMTenths);
} }
private: private:
MsgCrossReportToBuddy(uint64_t devSampleRate, MsgCrossReportToBuddy(uint64_t devSampleRate,
bool lpfFIREnable, bool lpfFIREnable,
uint32_t lpfFIRlog2IntDec, uint32_t lpfFIRlog2IntDec,
uint32_t lpfFIRBW) : uint32_t lpfFIRBW,
int32_t loPPMTenths) :
Message(), Message(),
m_devSampleRate(devSampleRate), m_devSampleRate(devSampleRate),
m_lpfFIREnable(lpfFIREnable), m_lpfFIREnable(lpfFIREnable),
m_lpfFIRlogIntDec(lpfFIRlog2IntDec), m_lpfFIRlogIntDec(lpfFIRlog2IntDec),
m_lpfFIRBW(lpfFIRBW) m_lpfFIRBW(lpfFIRBW),
m_loPPMTenths(loPPMTenths)
{ } { }
uint64_t m_devSampleRate; uint64_t m_devSampleRate;
bool m_lpfFIREnable; bool m_lpfFIREnable;
uint32_t m_lpfFIRlogIntDec; uint32_t m_lpfFIRlogIntDec;
uint32_t m_lpfFIRBW; uint32_t m_lpfFIRBW;
int32_t m_loPPMTenths;
}; };
DevicePlutoSDRParams *m_deviceParams; //!< unique hardware device parameters DevicePlutoSDRParams *m_deviceParams; //!< unique hardware device parameters

View File

@ -128,6 +128,17 @@ bool PlutoSDROutput::handleMessage(const Message& message)
return true; return true;
} }
else if (DevicePlutoSDRShared::MsgCrossReportToBuddy::match(message)) // message from buddy
{
DevicePlutoSDRShared::MsgCrossReportToBuddy& conf = (DevicePlutoSDRShared::MsgCrossReportToBuddy&) message;
m_settings.m_devSampleRate = conf.getDevSampleRate();
m_settings.m_lpfFIRlog2Interp = conf.getLpfFiRlog2IntDec();
m_settings.m_lpfFIRBW = conf.getLpfFirbw();
m_settings.m_LOppmTenths = conf.getLoPPMTenths();
PlutoSDROutputSettings newSettings = m_settings;
newSettings.m_lpfFIREnable = conf.isLpfFirEnable();
applySettings(newSettings);
}
else else
{ {
return false; return false;
@ -391,6 +402,27 @@ bool PlutoSDROutput::applySettings(const PlutoSDROutputSettings& settings, bool
if (forwardChangeOtherDSP) if (forwardChangeOtherDSP)
{ {
qDebug("PlutoSDROutput::applySettings: forwardChangeOtherDSP"); qDebug("PlutoSDROutput::applySettings: forwardChangeOtherDSP");
const std::vector<DeviceSourceAPI*>& sourceBuddies = m_deviceAPI->getSourceBuddies();
std::vector<DeviceSourceAPI*>::const_iterator itSource = sourceBuddies.begin();
for (; itSource != sourceBuddies.end(); ++itSource)
{
DevicePlutoSDRShared::MsgCrossReportToBuddy *msg = DevicePlutoSDRShared::MsgCrossReportToBuddy::create(
settings.m_devSampleRate,
settings.m_lpfFIREnable,
settings.m_lpfFIRlog2Interp,
settings.m_lpfFIRBW,
settings.m_LOppmTenths);
if ((*itSource)->getSampleSourceGUIMessageQueue())
{
DevicePlutoSDRShared::MsgCrossReportToBuddy *msgToGUI = new DevicePlutoSDRShared::MsgCrossReportToBuddy(*msg);
(*itSource)->getSampleSourceGUIMessageQueue()->push(msgToGUI);
}
(*itSource)->getSampleSourceInputMessageQueue()->push(msg);
}
} }
if (forwardChangeOwnDSP) if (forwardChangeOwnDSP)

View File

@ -130,7 +130,24 @@ bool PlutoSDROutputGUI::deserialize(const QByteArray& data)
bool PlutoSDROutputGUI::handleMessage(const Message& message __attribute__((unused))) bool PlutoSDROutputGUI::handleMessage(const Message& message __attribute__((unused)))
{ {
return false; if (DevicePlutoSDRShared::MsgCrossReportToBuddy::match(message)) // message from buddy
{
DevicePlutoSDRShared::MsgCrossReportToBuddy& conf = (DevicePlutoSDRShared::MsgCrossReportToBuddy&) message;
m_settings.m_devSampleRate = conf.getDevSampleRate();
m_settings.m_lpfFIRlog2Interp = conf.getLpfFiRlog2IntDec();
m_settings.m_lpfFIRBW = conf.getLpfFirbw();
m_settings.m_LOppmTenths = conf.getLoPPMTenths();
m_settings.m_lpfFIREnable = conf.isLpfFirEnable();
blockApplySettings(true);
displaySettings();
blockApplySettings(false);
return true;
}
else
{
return false;
}
} }
void PlutoSDROutputGUI::on_startStop_toggled(bool checked) void PlutoSDROutputGUI::on_startStop_toggled(bool checked)

View File

@ -150,6 +150,17 @@ bool PlutoSDRInput::handleMessage(const Message& message)
return true; return true;
} }
else if (DevicePlutoSDRShared::MsgCrossReportToBuddy::match(message)) // message from buddy
{
DevicePlutoSDRShared::MsgCrossReportToBuddy& conf = (DevicePlutoSDRShared::MsgCrossReportToBuddy&) message;
m_settings.m_devSampleRate = conf.getDevSampleRate();
m_settings.m_lpfFIRlog2Decim = conf.getLpfFiRlog2IntDec();
m_settings.m_lpfFIRBW = conf.getLpfFirbw();
m_settings.m_LOppmTenths = conf.getLoPPMTenths();
PlutoSDRInputSettings newSettings = m_settings;
newSettings.m_lpfFIREnable = conf.isLpfFirEnable();
applySettings(newSettings);
}
else else
{ {
return false; return false;
@ -438,7 +449,29 @@ bool PlutoSDRInput::applySettings(const PlutoSDRInputSettings& settings, bool fo
// TODO: forward changes to other (Tx) DSP // TODO: forward changes to other (Tx) DSP
if (forwardChangeOtherDSP) if (forwardChangeOtherDSP)
{ {
qDebug("PlutoSDRInput::applySettings: forwardChangeOtherDSP"); qDebug("PlutoSDRInput::applySettings: forwardChangeOtherDSP");
const std::vector<DeviceSinkAPI*>& sinkBuddies = m_deviceAPI->getSinkBuddies();
std::vector<DeviceSinkAPI*>::const_iterator itSink = sinkBuddies.begin();
for (; itSink != sinkBuddies.end(); ++itSink)
{
DevicePlutoSDRShared::MsgCrossReportToBuddy *msg = DevicePlutoSDRShared::MsgCrossReportToBuddy::create(
settings.m_devSampleRate,
settings.m_lpfFIREnable,
settings.m_lpfFIRlog2Decim,
settings.m_lpfFIRBW,
settings.m_LOppmTenths);
if ((*itSink)->getSampleSinkGUIMessageQueue())
{
DevicePlutoSDRShared::MsgCrossReportToBuddy *msgToGUI = new DevicePlutoSDRShared::MsgCrossReportToBuddy(*msg);
(*itSink)->getSampleSinkGUIMessageQueue()->push(msgToGUI);
}
(*itSink)->getSampleSinkInputMessageQueue()->push(msg);
}
} }
if (forwardChangeOwnDSP) if (forwardChangeOwnDSP)

View File

@ -130,7 +130,24 @@ bool PlutoSDRInputGui::deserialize(const QByteArray& data)
bool PlutoSDRInputGui::handleMessage(const Message& message __attribute__((unused))) bool PlutoSDRInputGui::handleMessage(const Message& message __attribute__((unused)))
{ {
return false; if (DevicePlutoSDRShared::MsgCrossReportToBuddy::match(message)) // message from buddy
{
DevicePlutoSDRShared::MsgCrossReportToBuddy& conf = (DevicePlutoSDRShared::MsgCrossReportToBuddy&) message;
m_settings.m_devSampleRate = conf.getDevSampleRate();
m_settings.m_lpfFIRlog2Decim = conf.getLpfFiRlog2IntDec();
m_settings.m_lpfFIRBW = conf.getLpfFirbw();
m_settings.m_LOppmTenths = conf.getLoPPMTenths();
m_settings.m_lpfFIREnable = conf.isLpfFirEnable();
blockApplySettings(true);
displaySettings();
blockApplySettings(false);
return true;
}
else
{
return false;
}
} }
void PlutoSDRInputGui::on_startStop_toggled(bool checked) void PlutoSDRInputGui::on_startStop_toggled(bool checked)