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

LimeSDR input: handle center frequency and NCO for Tx buddies

This commit is contained in:
f4exb 2017-04-21 00:14:55 +02:00
parent 5c8732dc66
commit 688ca8ab46
2 changed files with 23 additions and 24 deletions

View File

@ -29,12 +29,14 @@ struct DeviceLimeSDRShared
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; int m_ncoFrequency;
uint64_t m_centerFrequency;
DeviceLimeSDRShared() : DeviceLimeSDRShared() :
m_deviceParams(0), m_deviceParams(0),
m_channel(-1), m_channel(-1),
m_thread(0), m_thread(0),
m_ncoFrequency(0) m_ncoFrequency(0),
m_centerFrequency(0)
{} {}
~DeviceLimeSDRShared() ~DeviceLimeSDRShared()

View File

@ -378,6 +378,8 @@ bool LimeSDRInput::handleMessage(const Message& message)
MsgSetReferenceConfig& conf = (MsgSetReferenceConfig&) message; MsgSetReferenceConfig& conf = (MsgSetReferenceConfig&) message;
qDebug() << "LimeSDRInput::handleMessage: MsgSetReferenceConfig"; qDebug() << "LimeSDRInput::handleMessage: MsgSetReferenceConfig";
m_settings = conf.getSettings(); m_settings = conf.getSettings();
m_deviceShared.m_ncoFrequency = m_settings.m_ncoEnable ? m_settings.m_ncoFrequency : 0; // for buddies
m_deviceShared.m_centerFrequency = m_settings.m_centerFrequency; // for buddies
return true; return true;
} }
else if (MsgGetStreamInfo::match(message)) else if (MsgGetStreamInfo::match(message))
@ -385,11 +387,10 @@ bool LimeSDRInput::handleMessage(const Message& message)
// qDebug() << "LimeSDRInput::handleMessage: MsgGetStreamInfo"; // qDebug() << "LimeSDRInput::handleMessage: MsgGetStreamInfo";
lms_stream_status_t status; lms_stream_status_t status;
if (m_streamId.handle && (LMS_GetStreamStatus(&m_streamId, &status) < 0)) if (m_streamId.handle && (LMS_GetStreamStatus(&m_streamId, &status) == 0))
{ {
// qDebug("LimeSDRInput::handleMessage: canot get stream status");
MsgReportStreamInfo *report = MsgReportStreamInfo::create( MsgReportStreamInfo *report = MsgReportStreamInfo::create(
false, // Success true, // Success
status.active, status.active,
status.fifoFilledCount, status.fifoFilledCount,
status.fifoSize, status.fifoSize,
@ -403,25 +404,17 @@ bool LimeSDRInput::handleMessage(const Message& message)
} }
else else
{ {
// qDebug() << "LimeSDRInput::handleMessage: got stream status at: " << status.timestamp
// << " fifoFilledCount: " << status.fifoFilledCount
// << " fifoSize: " << status.fifoSize
// << " underrun: " << status.underrun
// << " overrun: " << status.overrun
// << " droppedPackets: " << status.droppedPackets
// << " sampleRate: " << status.sampleRate
// << " linkRate: " << status.linkRate;
MsgReportStreamInfo *report = MsgReportStreamInfo::create( MsgReportStreamInfo *report = MsgReportStreamInfo::create(
true, // Success false, // Success
status.active, false, // status.active,
status.fifoFilledCount, 0, // status.fifoFilledCount,
status.fifoSize, 16384, // status.fifoSize,
status.underrun, 0, // status.underrun,
status.overrun, 0, // status.overrun,
status.droppedPackets, 0, // status.droppedPackets,
status.sampleRate, 0, // status.sampleRate,
status.linkRate, 0, // status.linkRate,
status.timestamp); 0); // status.timestamp);
m_deviceAPI->getDeviceOutputMessageQueue()->push(report); m_deviceAPI->getDeviceOutputMessageQueue()->push(report);
} }
@ -705,13 +698,14 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
if (LMS_SetLOFrequency(m_deviceShared.m_deviceParams->getDevice(), if (LMS_SetLOFrequency(m_deviceShared.m_deviceParams->getDevice(),
LMS_CH_RX, LMS_CH_RX,
m_deviceShared.m_channel, // same for both channels anyway but switches antenna port automatically m_deviceShared.m_channel, // same for both channels anyway but switches antenna port automatically
m_settings.m_centerFrequency ) < 0) m_settings.m_centerFrequency) < 0)
{ {
qCritical("LimeSDRInput::applySettings: could not set frequency to %lu", m_settings.m_centerFrequency); qCritical("LimeSDRInput::applySettings: could not set frequency to %lu", m_settings.m_centerFrequency);
} }
else else
{ {
doCalibration = true; doCalibration = true;
m_deviceShared.m_centerFrequency = m_settings.m_centerFrequency; // for buddies
qDebug("LimeSDRInput::applySettings: frequency set to %lu", m_settings.m_centerFrequency); qDebug("LimeSDRInput::applySettings: frequency set to %lu", m_settings.m_centerFrequency);
} }
} }
@ -832,7 +826,10 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
for (; itSink != sinkBuddies.end(); ++itSink) for (; itSink != sinkBuddies.end(); ++itSink)
{ {
DSPSignalNotification *notif = new DSPSignalNotification(sampleRate, m_settings.m_centerFrequency); DeviceLimeSDRShared *buddySharedPtr = (DeviceLimeSDRShared *) (*itSink)->getBuddySharedPtr();
uint64_t buddyCenterFreq = buddySharedPtr->m_centerFrequency;
int buddyNCOFreq = buddySharedPtr->m_ncoFrequency;
DSPSignalNotification *notif = new DSPSignalNotification(sampleRate, buddyCenterFreq + buddyNCOFreq); // do not change center frequency
(*itSink)->getDeviceInputMessageQueue()->push(notif); (*itSink)->getDeviceInputMessageQueue()->push(notif);
MsgReportLimeSDRToGUI *report = MsgReportLimeSDRToGUI::create( MsgReportLimeSDRToGUI *report = MsgReportLimeSDRToGUI::create(
m_settings.m_centerFrequency, m_settings.m_centerFrequency,