1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2025-09-03 13:47:50 -04:00

LimeSDR: pass center frequency change to buddies of same type

This commit is contained in:
f4exb 2017-10-25 01:38:39 +02:00
parent cd5f0c361a
commit 8b93c5f48d
6 changed files with 63 additions and 38 deletions

View File

@ -16,7 +16,7 @@
#include "devicelimesdrshared.h" #include "devicelimesdrshared.h"
MESSAGE_CLASS_DEFINITION(DeviceLimeSDRShared::MsgReportSampleRateDirChange, Message) MESSAGE_CLASS_DEFINITION(DeviceLimeSDRShared::MsgReportBuddyChange, Message)
MESSAGE_CLASS_DEFINITION(DeviceLimeSDRShared::MsgReportDeviceInfo, Message) MESSAGE_CLASS_DEFINITION(DeviceLimeSDRShared::MsgReportDeviceInfo, Message)
const float DeviceLimeSDRShared::m_sampleFifoLengthInSeconds = 0.25; const float DeviceLimeSDRShared::m_sampleFifoLengthInSeconds = 0.25;

View File

@ -27,28 +27,43 @@
class DeviceLimeSDRShared class DeviceLimeSDRShared
{ {
public: public:
class MsgReportSampleRateDirChange : public Message { class MsgReportBuddyChange : public Message {
MESSAGE_CLASS_DECLARATION MESSAGE_CLASS_DECLARATION
public: public:
int getDevSampleRate() const { return m_devSampleRate; } int getDevSampleRate() const { return m_devSampleRate; }
int getLog2HardDecimInterp() const { return m_log2HardDecimInterp; } int getLog2HardDecimInterp() const { return m_log2HardDecimInterp; }
uint64_t getCenterFrequency() const { return m_centerFrequency; }
bool getRxElseTx() const { return m_rxElseTx; } bool getRxElseTx() const { return m_rxElseTx; }
static MsgReportSampleRateDirChange* create(int devSampleRate, int log2HardDecimInterp, bool rxElseTx) static MsgReportBuddyChange* create(
int devSampleRate,
int log2HardDecimInterp,
uint64_t centerFrequency,
bool rxElseTx)
{ {
return new MsgReportSampleRateDirChange(devSampleRate, log2HardDecimInterp, rxElseTx); return new MsgReportBuddyChange(
devSampleRate,
log2HardDecimInterp,
centerFrequency,
rxElseTx);
} }
private: private:
int m_devSampleRate; //!< device/host sample rate int m_devSampleRate; //!< device/host sample rate
int m_log2HardDecimInterp; //!< log2 of hardware decimation or interpolation int m_log2HardDecimInterp; //!< log2 of hardware decimation or interpolation
bool m_rxElseTx; //!< tells which side initiated the message uint64_t m_centerFrequency; //!< Center frequency
bool m_rxElseTx; //!< tells which side initiated the message
MsgReportSampleRateDirChange(int devSampleRate, int log2HardDecimInterp, bool rxElseTx) : MsgReportBuddyChange(
int devSampleRate,
int log2HardDecimInterp,
uint64_t centerFrequency,
bool rxElseTx) :
Message(), Message(),
m_devSampleRate(devSampleRate), m_devSampleRate(devSampleRate),
m_log2HardDecimInterp(log2HardDecimInterp), m_log2HardDecimInterp(log2HardDecimInterp),
m_centerFrequency(centerFrequency),
m_rxElseTx(rxElseTx) m_rxElseTx(rxElseTx)
{ } { }
}; };

View File

@ -441,9 +441,9 @@ bool LimeSDROutput::handleMessage(const Message& message)
return true; return true;
} }
else if (DeviceLimeSDRShared::MsgReportSampleRateDirChange::match(message)) else if (DeviceLimeSDRShared::MsgReportBuddyChange::match(message))
{ {
DeviceLimeSDRShared::MsgReportSampleRateDirChange& report = (DeviceLimeSDRShared::MsgReportSampleRateDirChange&) message; DeviceLimeSDRShared::MsgReportBuddyChange& report = (DeviceLimeSDRShared::MsgReportBuddyChange&) message;
if (report.getRxElseTx()) if (report.getRxElseTx())
{ {
@ -452,8 +452,9 @@ bool LimeSDROutput::handleMessage(const Message& message)
} }
else else
{ {
m_settings.m_devSampleRate = report.getDevSampleRate(); m_settings.m_devSampleRate = report.getDevSampleRate();
m_settings.m_log2HardInterp = report.getLog2HardDecimInterp(); m_settings.m_log2HardInterp = report.getLog2HardDecimInterp();
m_settings.m_centerFrequency = report.getCenterFrequency();
} }
if (m_settings.m_ncoEnable) // need to reset NCO after sample rate change if (m_settings.m_ncoEnable) // need to reset NCO after sample rate change
@ -468,8 +469,8 @@ bool LimeSDROutput::handleMessage(const Message& message)
m_settings.m_centerFrequency + ncoShift); m_settings.m_centerFrequency + ncoShift);
m_deviceAPI->getDeviceEngineInputMessageQueue()->push(notif); m_deviceAPI->getDeviceEngineInputMessageQueue()->push(notif);
DeviceLimeSDRShared::MsgReportSampleRateDirChange *reportToGUI = DeviceLimeSDRShared::MsgReportSampleRateDirChange::create( DeviceLimeSDRShared::MsgReportBuddyChange *reportToGUI = DeviceLimeSDRShared::MsgReportBuddyChange::create(
m_settings.m_devSampleRate, m_settings.m_log2HardInterp, false); m_settings.m_devSampleRate, m_settings.m_log2HardInterp, m_settings.m_centerFrequency, false);
getMessageQueueToGUI()->push(reportToGUI); getMessageQueueToGUI()->push(reportToGUI);
return true; return true;
@ -888,8 +889,8 @@ bool LimeSDROutput::applySettings(const LimeSDROutputSettings& settings, bool fo
for (; itSink != sinkBuddies.end(); ++itSink) for (; itSink != sinkBuddies.end(); ++itSink)
{ {
DeviceLimeSDRShared::MsgReportSampleRateDirChange *report = DeviceLimeSDRShared::MsgReportSampleRateDirChange::create( DeviceLimeSDRShared::MsgReportBuddyChange *report = DeviceLimeSDRShared::MsgReportBuddyChange::create(
m_settings.m_devSampleRate, m_settings.m_log2HardInterp, false); m_settings.m_devSampleRate, m_settings.m_log2HardInterp, m_settings.m_centerFrequency, false);
(*itSink)->getSampleSinkInputMessageQueue()->push(report); (*itSink)->getSampleSinkInputMessageQueue()->push(report);
} }
@ -899,8 +900,8 @@ bool LimeSDROutput::applySettings(const LimeSDROutputSettings& settings, bool fo
for (; itSource != sourceBuddies.end(); ++itSource) for (; itSource != sourceBuddies.end(); ++itSource)
{ {
DeviceLimeSDRShared::MsgReportSampleRateDirChange *report = DeviceLimeSDRShared::MsgReportSampleRateDirChange::create( DeviceLimeSDRShared::MsgReportBuddyChange *report = DeviceLimeSDRShared::MsgReportBuddyChange::create(
m_settings.m_devSampleRate, m_settings.m_log2HardInterp, false); m_settings.m_devSampleRate, m_settings.m_log2HardInterp, m_settings.m_centerFrequency, false);
(*itSource)->getSampleSourceInputMessageQueue()->push(report); (*itSource)->getSampleSourceInputMessageQueue()->push(report);
} }
} }
@ -921,8 +922,8 @@ bool LimeSDROutput::applySettings(const LimeSDROutputSettings& settings, bool fo
for (; itSink != sinkBuddies.end(); ++itSink) for (; itSink != sinkBuddies.end(); ++itSink)
{ {
DeviceLimeSDRShared::MsgReportSampleRateDirChange *report = DeviceLimeSDRShared::MsgReportSampleRateDirChange::create( DeviceLimeSDRShared::MsgReportBuddyChange *report = DeviceLimeSDRShared::MsgReportBuddyChange::create(
m_settings.m_devSampleRate, m_settings.m_log2HardInterp, false); m_settings.m_devSampleRate, m_settings.m_log2HardInterp, m_settings.m_centerFrequency, false);
(*itSink)->getSampleSinkInputMessageQueue()->push(report); (*itSink)->getSampleSinkInputMessageQueue()->push(report);
} }
} }

View File

@ -141,12 +141,16 @@ bool LimeSDROutputGUI::deserialize(const QByteArray& data)
bool LimeSDROutputGUI::handleMessage(const Message& message) bool LimeSDROutputGUI::handleMessage(const Message& message)
{ {
if (DeviceLimeSDRShared::MsgReportSampleRateDirChange::match(message)) if (DeviceLimeSDRShared::MsgReportBuddyChange::match(message))
{ {
DeviceLimeSDRShared::MsgReportSampleRateDirChange& report = (DeviceLimeSDRShared::MsgReportSampleRateDirChange&) message; DeviceLimeSDRShared::MsgReportBuddyChange& report = (DeviceLimeSDRShared::MsgReportBuddyChange&) message;
m_settings.m_devSampleRate = report.getDevSampleRate(); m_settings.m_devSampleRate = report.getDevSampleRate();
m_settings.m_log2HardInterp = report.getLog2HardDecimInterp(); m_settings.m_log2HardInterp = report.getLog2HardDecimInterp();
if (!report.getRxElseTx()) {
m_settings.m_centerFrequency = report.getCenterFrequency();
}
blockApplySettings(true); blockApplySettings(true);
displaySettings(); displaySettings();
blockApplySettings(false); blockApplySettings(false);

View File

@ -426,14 +426,15 @@ bool LimeSDRInput::handleMessage(const Message& message)
return true; return true;
} }
else if (DeviceLimeSDRShared::MsgReportSampleRateDirChange::match(message)) else if (DeviceLimeSDRShared::MsgReportBuddyChange::match(message))
{ {
DeviceLimeSDRShared::MsgReportSampleRateDirChange& report = (DeviceLimeSDRShared::MsgReportSampleRateDirChange&) message; DeviceLimeSDRShared::MsgReportBuddyChange& report = (DeviceLimeSDRShared::MsgReportBuddyChange&) message;
if (report.getRxElseTx()) if (report.getRxElseTx())
{ {
m_settings.m_devSampleRate = report.getDevSampleRate(); m_settings.m_devSampleRate = report.getDevSampleRate();
m_settings.m_log2HardDecim = report.getLog2HardDecimInterp(); m_settings.m_log2HardDecim = report.getLog2HardDecimInterp();
m_settings.m_centerFrequency = report.getCenterFrequency();
} }
else else
{ {
@ -453,8 +454,8 @@ bool LimeSDRInput::handleMessage(const Message& message)
m_settings.m_centerFrequency + ncoShift); m_settings.m_centerFrequency + ncoShift);
m_deviceAPI->getDeviceEngineInputMessageQueue()->push(notif); m_deviceAPI->getDeviceEngineInputMessageQueue()->push(notif);
DeviceLimeSDRShared::MsgReportSampleRateDirChange *reportToGUI = DeviceLimeSDRShared::MsgReportSampleRateDirChange::create( DeviceLimeSDRShared::MsgReportBuddyChange *reportToGUI = DeviceLimeSDRShared::MsgReportBuddyChange::create(
m_settings.m_devSampleRate, m_settings.m_log2HardDecim, true); m_settings.m_devSampleRate, m_settings.m_log2HardDecim, m_settings.m_centerFrequency, true);
getMessageQueueToGUI()->push(reportToGUI); getMessageQueueToGUI()->push(reportToGUI);
return true; return true;
@ -1047,8 +1048,8 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
for (; itSource != sourceBuddies.end(); ++itSource) for (; itSource != sourceBuddies.end(); ++itSource)
{ {
DeviceLimeSDRShared::MsgReportSampleRateDirChange *report = DeviceLimeSDRShared::MsgReportSampleRateDirChange::create( DeviceLimeSDRShared::MsgReportBuddyChange *report = DeviceLimeSDRShared::MsgReportBuddyChange::create(
m_settings.m_devSampleRate, m_settings.m_log2HardDecim, true); m_settings.m_devSampleRate, m_settings.m_log2HardDecim, m_settings.m_centerFrequency, true);
(*itSource)->getSampleSourceInputMessageQueue()->push(report); (*itSource)->getSampleSourceInputMessageQueue()->push(report);
} }
@ -1058,8 +1059,8 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
for (; itSink != sinkBuddies.end(); ++itSink) for (; itSink != sinkBuddies.end(); ++itSink)
{ {
DeviceLimeSDRShared::MsgReportSampleRateDirChange *report = DeviceLimeSDRShared::MsgReportSampleRateDirChange::create( DeviceLimeSDRShared::MsgReportBuddyChange *report = DeviceLimeSDRShared::MsgReportBuddyChange::create(
m_settings.m_devSampleRate, m_settings.m_log2HardDecim, true); m_settings.m_devSampleRate, m_settings.m_log2HardDecim, m_settings.m_centerFrequency, true);
(*itSink)->getSampleSinkInputMessageQueue()->push(report); (*itSink)->getSampleSinkInputMessageQueue()->push(report);
} }
} }
@ -1080,8 +1081,8 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
for (; itSource != sourceBuddies.end(); ++itSource) for (; itSource != sourceBuddies.end(); ++itSource)
{ {
DeviceLimeSDRShared::MsgReportSampleRateDirChange *report = DeviceLimeSDRShared::MsgReportSampleRateDirChange::create( DeviceLimeSDRShared::MsgReportBuddyChange *report = DeviceLimeSDRShared::MsgReportBuddyChange::create(
m_settings.m_devSampleRate, m_settings.m_log2HardDecim, true); m_settings.m_devSampleRate, m_settings.m_log2HardDecim, m_settings.m_centerFrequency, true);
(*itSource)->getSampleSourceInputMessageQueue()->push(report); (*itSource)->getSampleSourceInputMessageQueue()->push(report);
} }
} }

View File

@ -139,12 +139,16 @@ bool LimeSDRInputGUI::deserialize(const QByteArray& data)
bool LimeSDRInputGUI::handleMessage(const Message& message) bool LimeSDRInputGUI::handleMessage(const Message& message)
{ {
if (DeviceLimeSDRShared::MsgReportSampleRateDirChange::match(message)) if (DeviceLimeSDRShared::MsgReportBuddyChange::match(message))
{ {
DeviceLimeSDRShared::MsgReportSampleRateDirChange& report = (DeviceLimeSDRShared::MsgReportSampleRateDirChange&) message; DeviceLimeSDRShared::MsgReportBuddyChange& report = (DeviceLimeSDRShared::MsgReportBuddyChange&) message;
m_settings.m_devSampleRate = report.getDevSampleRate(); m_settings.m_devSampleRate = report.getDevSampleRate();
m_settings.m_log2HardDecim = report.getLog2HardDecimInterp(); m_settings.m_log2HardDecim = report.getLog2HardDecimInterp();
if (report.getRxElseTx()) {
m_settings.m_centerFrequency = report.getCenterFrequency();
}
blockApplySettings(true); blockApplySettings(true);
displaySettings(); displaySettings();
blockApplySettings(false); blockApplySettings(false);