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)
void *m_thread; //!< anonymous pointer that will hold the thread address if started else 0
int m_ncoFrequency;
uint64_t m_centerFrequency;
DeviceLimeSDRShared() :
m_deviceParams(0),
m_channel(-1),
m_thread(0),
m_ncoFrequency(0)
m_ncoFrequency(0),
m_centerFrequency(0)
{}
~DeviceLimeSDRShared()

View File

@ -378,6 +378,8 @@ bool LimeSDRInput::handleMessage(const Message& message)
MsgSetReferenceConfig& conf = (MsgSetReferenceConfig&) message;
qDebug() << "LimeSDRInput::handleMessage: MsgSetReferenceConfig";
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;
}
else if (MsgGetStreamInfo::match(message))
@ -385,11 +387,10 @@ bool LimeSDRInput::handleMessage(const Message& message)
// qDebug() << "LimeSDRInput::handleMessage: MsgGetStreamInfo";
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(
false, // Success
true, // Success
status.active,
status.fifoFilledCount,
status.fifoSize,
@ -403,25 +404,17 @@ bool LimeSDRInput::handleMessage(const Message& message)
}
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(
true, // Success
status.active,
status.fifoFilledCount,
status.fifoSize,
status.underrun,
status.overrun,
status.droppedPackets,
status.sampleRate,
status.linkRate,
status.timestamp);
false, // Success
false, // status.active,
0, // status.fifoFilledCount,
16384, // status.fifoSize,
0, // status.underrun,
0, // status.overrun,
0, // status.droppedPackets,
0, // status.sampleRate,
0, // status.linkRate,
0); // status.timestamp);
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(),
LMS_CH_RX,
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);
}
else
{
doCalibration = true;
m_deviceShared.m_centerFrequency = m_settings.m_centerFrequency; // for buddies
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)
{
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);
MsgReportLimeSDRToGUI *report = MsgReportLimeSDRToGUI::create(
m_settings.m_centerFrequency,