1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 09:48:45 -05:00

LimeSDR: use LMS_GetSampleRate to get the actual rates when MsgReportBuddyChange comes from an opposite buddy

This commit is contained in:
f4exb 2017-10-26 01:47:43 +02:00
parent 50123f90a4
commit ca14e41e1c
2 changed files with 54 additions and 4 deletions

View File

@ -532,8 +532,34 @@ bool LimeSDROutput::handleMessage(const Message& message)
if (report.getRxElseTx())
{
int adcdac_rate = report.getDevSampleRate() * (1<<report.getLog2HardDecimInterp());
m_settings.m_devSampleRate = adcdac_rate / (1<<m_settings.m_log2HardInterp); // new device to host sample rate
double host_Hz;
double rf_Hz;
if (LMS_GetSampleRate(m_deviceShared.m_deviceParams->getDevice(),
LMS_CH_TX,
m_deviceShared.m_channel,
&host_Hz,
&rf_Hz) < 0)
{
qDebug("LimeSDROutput::handleMessage: MsgReportBuddyChange: LMS_GetSampleRate() failed");
}
else
{
m_settings.m_devSampleRate = roundf(host_Hz);
int hard = roundf(rf_Hz) / m_settings.m_devSampleRate;
m_settings.m_log2HardInterp = log2(hard);
qDebug() << "LimeSDROutput::handleMessage: MsgReportBuddyChange:"
<< " host_Hz: " << host_Hz
<< " rf_Hz: " << rf_Hz
<< " m_devSampleRate: " << m_settings.m_devSampleRate
<< " log2Hard: " << hard
<< " m_log2HardInterp: " << m_settings.m_log2HardInterp;
// int adcdac_rate = report.getDevSampleRate() * (1<<report.getLog2HardDecimInterp());
// m_settings.m_devSampleRate = adcdac_rate / (1<<m_settings.m_log2HardInterp); // new device to host sample rate
}
}
else
{

View File

@ -548,8 +548,32 @@ bool LimeSDRInput::handleMessage(const Message& message)
}
else
{
int adcdac_rate = report.getDevSampleRate() * (1<<report.getLog2HardDecimInterp());
m_settings.m_devSampleRate = adcdac_rate / (1<<m_settings.m_log2HardDecim); // new device to host sample rate
double host_Hz;
double rf_Hz;
if (LMS_GetSampleRate(m_deviceShared.m_deviceParams->getDevice(),
LMS_CH_RX,
m_deviceShared.m_channel,
&host_Hz,
&rf_Hz) < 0)
{
qDebug("LimeSDRInput::handleMessage: MsgReportBuddyChange: LMS_GetSampleRate() failed");
}
else
{
m_settings.m_devSampleRate = roundf(host_Hz);
int hard = roundf(rf_Hz) / m_settings.m_devSampleRate;
m_settings.m_log2HardDecim = log2(hard);
qDebug() << "LimeSDRInput::handleMessage: MsgReportBuddyChange:"
<< " host_Hz: " << host_Hz
<< " rf_Hz: " << rf_Hz
<< " m_devSampleRate: " << m_settings.m_devSampleRate
<< " log2Hard: " << hard
<< " m_log2HardDecim: " << m_settings.m_log2HardDecim;
// int adcdac_rate = report.getDevSampleRate() * (1<<report.getLog2HardDecimInterp());
// m_settings.m_devSampleRate = adcdac_rate / (1<<m_settings.m_log2HardDecim); // new device to host sample rate
}
}
if (m_settings.m_ncoEnable) // need to reset NCO after sample rate change