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

LimeSDR input: handle NCO for buddies

This commit is contained in:
f4exb 2017-04-20 23:43:24 +02:00
parent 099aa72fa2
commit 5c8732dc66
2 changed files with 14 additions and 7 deletions

View File

@ -28,11 +28,13 @@ struct DeviceLimeSDRShared
DeviceLimeSDRParams *m_deviceParams; //!< unique hardware device parameters DeviceLimeSDRParams *m_deviceParams; //!< unique hardware device parameters
std::size_t m_channel; //!< logical device channel number (-1 if none) std::size_t m_channel; //!< logical device channel number (-1 if none)
void *m_thread; //!< anonymous pointer that will hold the thread address if started else 0 void *m_thread; //!< anonymous pointer that will hold the thread address if started else 0
int m_ncoFrequency;
DeviceLimeSDRShared() : DeviceLimeSDRShared() :
m_deviceParams(0), m_deviceParams(0),
m_channel(-1), m_channel(-1),
m_thread(0) m_thread(0),
m_ncoFrequency(0)
{} {}
~DeviceLimeSDRShared() ~DeviceLimeSDRShared()

View File

@ -669,6 +669,7 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
{ {
doCalibration = true; doCalibration = true;
forwardChangeOwnDSP = true; forwardChangeOwnDSP = true;
m_deviceShared.m_ncoFrequency = m_settings.m_ncoEnable ? m_settings.m_ncoFrequency : 0; // for buddies
qDebug("LimeSDRInput::applySettings: %sd and set NCO to %d Hz", qDebug("LimeSDRInput::applySettings: %sd and set NCO to %d Hz",
m_settings.m_ncoEnable ? "enable" : "disable", m_settings.m_ncoEnable ? "enable" : "disable",
m_settings.m_ncoFrequency); m_settings.m_ncoFrequency);
@ -814,7 +815,9 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
// send to source buddies // send to source buddies
for (; itSource != sourceBuddies.end(); ++itSource) for (; itSource != sourceBuddies.end(); ++itSource)
{ {
DSPSignalNotification *notif = new DSPSignalNotification(sampleRate, m_settings.m_centerFrequency); DeviceLimeSDRShared *buddySharedPtr = (DeviceLimeSDRShared *) (*itSource)->getBuddySharedPtr();
int buddyNCOFreq = buddySharedPtr->m_ncoFrequency;
DSPSignalNotification *notif = new DSPSignalNotification(sampleRate, m_settings.m_centerFrequency + buddyNCOFreq);
(*itSource)->getDeviceInputMessageQueue()->push(notif); (*itSource)->getDeviceInputMessageQueue()->push(notif);
MsgReportLimeSDRToGUI *report = MsgReportLimeSDRToGUI::create( MsgReportLimeSDRToGUI *report = MsgReportLimeSDRToGUI::create(
m_settings.m_centerFrequency, m_settings.m_centerFrequency,
@ -843,7 +846,7 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
qDebug("LimeSDRInput::applySettings: forward change to Rx buddies"); qDebug("LimeSDRInput::applySettings: forward change to Rx buddies");
const std::vector<DeviceSourceAPI*>& sourceBuddies = m_deviceAPI->getSourceBuddies(); const std::vector<DeviceSourceAPI*>& sourceBuddies = m_deviceAPI->getSourceBuddies();
std::vector<DeviceSourceAPI*>::const_iterator it = sourceBuddies.begin(); std::vector<DeviceSourceAPI*>::const_iterator itSource = sourceBuddies.begin();
int sampleRate = m_settings.m_devSampleRate/(1<<m_settings.m_log2SoftDecim); int sampleRate = m_settings.m_devSampleRate/(1<<m_settings.m_log2SoftDecim);
int ncoShift = m_settings.m_ncoEnable ? m_settings.m_ncoFrequency : 0; int ncoShift = m_settings.m_ncoEnable ? m_settings.m_ncoFrequency : 0;
@ -852,15 +855,17 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
m_deviceAPI->getDeviceInputMessageQueue()->push(notif); m_deviceAPI->getDeviceInputMessageQueue()->push(notif);
// send to source buddies // send to source buddies
for (; it != sourceBuddies.end(); ++it) for (; itSource != sourceBuddies.end(); ++itSource)
{ {
DSPSignalNotification *notif = new DSPSignalNotification(sampleRate, m_settings.m_centerFrequency); DeviceLimeSDRShared *buddySharedPtr = (DeviceLimeSDRShared *) (*itSource)->getBuddySharedPtr();
(*it)->getDeviceInputMessageQueue()->push(notif); int buddyNCOFreq = buddySharedPtr->m_ncoFrequency;
DSPSignalNotification *notif = new DSPSignalNotification(sampleRate, m_settings.m_centerFrequency + buddyNCOFreq);
(*itSource)->getDeviceInputMessageQueue()->push(notif);
MsgReportLimeSDRToGUI *report = MsgReportLimeSDRToGUI::create( MsgReportLimeSDRToGUI *report = MsgReportLimeSDRToGUI::create(
m_settings.m_centerFrequency, m_settings.m_centerFrequency,
m_settings.m_devSampleRate, m_settings.m_devSampleRate,
m_settings.m_log2HardDecim); m_settings.m_log2HardDecim);
(*it)->getDeviceOutputMessageQueue()->push(report); (*itSource)->getDeviceOutputMessageQueue()->push(report);
} }
} }
else if (forwardChangeOwnDSP) else if (forwardChangeOwnDSP)