mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-25 20:22:10 -05:00
LimeSDR: fixed reporting sample rate to buddies
This commit is contained in:
parent
5556e65503
commit
7ad6533b1f
@ -3,11 +3,13 @@ project(limesdrdevice)
|
||||
set(limesdrdevice_SOURCES
|
||||
devicelimesdr.cpp
|
||||
devicelimesdrparam.cpp
|
||||
devicelimesdrshared.cpp
|
||||
)
|
||||
|
||||
set(limesdrdevice_HEADERS
|
||||
devicelimesdr.h
|
||||
devicelimesdrparam.h
|
||||
devicelimesdrshared.h
|
||||
)
|
||||
|
||||
include_directories(
|
||||
|
@ -19,12 +19,34 @@
|
||||
|
||||
#include <cstddef>
|
||||
#include "devicelimesdrparam.h"
|
||||
#include "util/message.h"
|
||||
|
||||
/**
|
||||
* Structure shared by a buddy with other buddies
|
||||
*/
|
||||
struct DeviceLimeSDRShared
|
||||
class DeviceLimeSDRShared
|
||||
{
|
||||
public:
|
||||
class MsgCrossReportToGUI : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
|
||||
public:
|
||||
int getSampleRate() const { return m_sampleRate; }
|
||||
|
||||
static MsgCrossReportToGUI* create(int sampleRate)
|
||||
{
|
||||
return new MsgCrossReportToGUI(sampleRate);
|
||||
}
|
||||
|
||||
private:
|
||||
int m_sampleRate;
|
||||
|
||||
MsgCrossReportToGUI(int sampleRate) :
|
||||
Message(),
|
||||
m_sampleRate(sampleRate)
|
||||
{ }
|
||||
};
|
||||
|
||||
class ThreadInterface
|
||||
{
|
||||
public:
|
||||
@ -37,13 +59,15 @@ struct DeviceLimeSDRShared
|
||||
ThreadInterface *m_thread; //!< holds the thread address if started else 0
|
||||
int m_ncoFrequency;
|
||||
uint64_t m_centerFrequency;
|
||||
uint32_t m_log2Soft;
|
||||
|
||||
DeviceLimeSDRShared() :
|
||||
m_deviceParams(0),
|
||||
m_channel(-1),
|
||||
m_thread(0),
|
||||
m_ncoFrequency(0),
|
||||
m_centerFrequency(0)
|
||||
m_centerFrequency(0),
|
||||
m_log2Soft(0)
|
||||
{}
|
||||
|
||||
~DeviceLimeSDRShared()
|
||||
|
@ -644,6 +644,7 @@ bool LimeSDROutput::applySettings(const LimeSDROutputSettings& settings, bool fo
|
||||
{
|
||||
m_settings.m_log2SoftInterp = settings.m_log2SoftInterp;
|
||||
forwardChangeOwnDSP = true;
|
||||
m_deviceShared.m_log2Soft = m_settings.m_log2SoftInterp; // for buddies
|
||||
|
||||
if (m_limeSDROutputThread != 0)
|
||||
{
|
||||
@ -755,11 +756,12 @@ bool LimeSDROutput::applySettings(const LimeSDROutputSettings& settings, bool fo
|
||||
{
|
||||
qDebug("LimeSDROutput::applySettings: forward change to all buddies");
|
||||
|
||||
int sampleRate = m_settings.m_devSampleRate/(1<<m_settings.m_log2SoftInterp);
|
||||
int ncoShift = m_settings.m_ncoEnable ? m_settings.m_ncoFrequency : 0;
|
||||
|
||||
// send to self first
|
||||
DSPSignalNotification *notif = new DSPSignalNotification(sampleRate, m_settings.m_centerFrequency + ncoShift);
|
||||
DSPSignalNotification *notif = new DSPSignalNotification(
|
||||
m_settings.m_devSampleRate/(1<<m_settings.m_log2SoftInterp),
|
||||
m_settings.m_centerFrequency + ncoShift);
|
||||
m_deviceAPI->getDeviceInputMessageQueue()->push(notif);
|
||||
|
||||
// send to sink buddies
|
||||
@ -770,7 +772,10 @@ bool LimeSDROutput::applySettings(const LimeSDROutputSettings& settings, bool fo
|
||||
{
|
||||
DeviceLimeSDRShared *buddySharedPtr = (DeviceLimeSDRShared *) (*itSink)->getBuddySharedPtr();
|
||||
int buddyNCOFreq = buddySharedPtr->m_ncoFrequency;
|
||||
DSPSignalNotification *notif = new DSPSignalNotification(sampleRate, m_settings.m_centerFrequency + buddyNCOFreq); // do not change center frequency
|
||||
uint32_t buddyLog2SoftInterp = buddySharedPtr->m_log2Soft;
|
||||
DSPSignalNotification *notif = new DSPSignalNotification(
|
||||
m_settings.m_devSampleRate/(1<<buddyLog2SoftInterp),
|
||||
m_settings.m_centerFrequency + buddyNCOFreq); // do not change center frequency
|
||||
(*itSink)->getDeviceInputMessageQueue()->push(notif);
|
||||
MsgReportLimeSDRToGUI *report = MsgReportLimeSDRToGUI::create(
|
||||
m_settings.m_centerFrequency,
|
||||
@ -788,12 +793,12 @@ bool LimeSDROutput::applySettings(const LimeSDROutputSettings& settings, bool fo
|
||||
DeviceLimeSDRShared *buddySharedPtr = (DeviceLimeSDRShared *) (*itSource)->getBuddySharedPtr();
|
||||
uint64_t buddyCenterFreq = buddySharedPtr->m_centerFrequency;
|
||||
int buddyNCOFreq = buddySharedPtr->m_ncoFrequency;
|
||||
DSPSignalNotification *notif = new DSPSignalNotification(sampleRate, buddyCenterFreq + buddyNCOFreq);
|
||||
uint32_t buddyLog2SoftDecim = buddySharedPtr->m_log2Soft;
|
||||
DSPSignalNotification *notif = new DSPSignalNotification(
|
||||
m_settings.m_devSampleRate/(1<<buddyLog2SoftDecim),
|
||||
buddyCenterFreq + buddyNCOFreq);
|
||||
(*itSource)->getDeviceInputMessageQueue()->push(notif);
|
||||
MsgReportLimeSDRToGUI *report = MsgReportLimeSDRToGUI::create(
|
||||
buddyCenterFreq,
|
||||
m_settings.m_devSampleRate,
|
||||
m_settings.m_log2HardInterp);
|
||||
DeviceLimeSDRShared::MsgCrossReportToGUI *report = DeviceLimeSDRShared::MsgCrossReportToGUI::create(m_settings.m_devSampleRate);
|
||||
(*itSource)->getDeviceOutputMessageQueue()->push(report);
|
||||
}
|
||||
}
|
||||
|
@ -182,6 +182,20 @@ void LimeSDROutputGUI::handleMessagesToGUI()
|
||||
|
||||
delete message;
|
||||
}
|
||||
else if (DeviceLimeSDRShared::MsgCrossReportToGUI::match(*message))
|
||||
{
|
||||
DeviceLimeSDRShared::MsgCrossReportToGUI *report = (DeviceLimeSDRShared::MsgCrossReportToGUI *) message;
|
||||
m_settings.m_devSampleRate = report->getSampleRate();
|
||||
|
||||
blockApplySettings(true);
|
||||
displaySettings();
|
||||
blockApplySettings(false);
|
||||
|
||||
LimeSDROutput::MsgSetReferenceConfig* conf = LimeSDROutput::MsgSetReferenceConfig::create(m_settings);
|
||||
m_sampleSink->getInputMessageQueue()->push(conf);
|
||||
|
||||
delete message;
|
||||
}
|
||||
else if (LimeSDROutput::MsgReportStreamInfo::match(*message))
|
||||
{
|
||||
LimeSDROutput::MsgReportStreamInfo *report = (LimeSDROutput::MsgReportStreamInfo *) message;
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "limesdrinput.h"
|
||||
#include "limesdrinputthread.h"
|
||||
#include "limesdr/devicelimesdrparam.h"
|
||||
#include "limesdr/devicelimesdrshared.h"
|
||||
#include "limesdr/devicelimesdr.h"
|
||||
|
||||
MESSAGE_CLASS_DEFINITION(LimeSDRInput::MsgConfigureLimeSDR, Message)
|
||||
@ -666,6 +667,7 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
|
||||
{
|
||||
m_settings.m_log2SoftDecim = settings.m_log2SoftDecim;
|
||||
forwardChangeOwnDSP = true;
|
||||
m_deviceShared.m_log2Soft = m_settings.m_log2SoftDecim; // for buddies
|
||||
|
||||
if (m_limeSDRInputThread != 0)
|
||||
{
|
||||
@ -777,11 +779,12 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
|
||||
{
|
||||
qDebug("LimeSDRInput::applySettings: forward change to all buddies");
|
||||
|
||||
int sampleRate = m_settings.m_devSampleRate/(1<<m_settings.m_log2SoftDecim);
|
||||
int ncoShift = m_settings.m_ncoEnable ? m_settings.m_ncoFrequency : 0;
|
||||
|
||||
// send to self first
|
||||
DSPSignalNotification *notif = new DSPSignalNotification(sampleRate, m_settings.m_centerFrequency + ncoShift);
|
||||
DSPSignalNotification *notif = new DSPSignalNotification(
|
||||
m_settings.m_devSampleRate/(1<<m_settings.m_log2SoftDecim),
|
||||
m_settings.m_centerFrequency + ncoShift);
|
||||
m_deviceAPI->getDeviceInputMessageQueue()->push(notif);
|
||||
|
||||
// send to source buddies
|
||||
@ -792,7 +795,10 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
|
||||
{
|
||||
DeviceLimeSDRShared *buddySharedPtr = (DeviceLimeSDRShared *) (*itSource)->getBuddySharedPtr();
|
||||
int buddyNCOFreq = buddySharedPtr->m_ncoFrequency;
|
||||
DSPSignalNotification *notif = new DSPSignalNotification(sampleRate, m_settings.m_centerFrequency + buddyNCOFreq);
|
||||
uint32_t buddyLog2Decim = buddySharedPtr->m_log2Soft;
|
||||
DSPSignalNotification *notif = new DSPSignalNotification(
|
||||
m_settings.m_devSampleRate/(1<<buddyLog2Decim),
|
||||
m_settings.m_centerFrequency + buddyNCOFreq);
|
||||
(*itSource)->getDeviceInputMessageQueue()->push(notif);
|
||||
MsgReportLimeSDRToGUI *report = MsgReportLimeSDRToGUI::create(
|
||||
m_settings.m_centerFrequency,
|
||||
@ -810,12 +816,12 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
|
||||
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
|
||||
uint32_t buddyLog2Interp = buddySharedPtr->m_log2Soft;
|
||||
DSPSignalNotification *notif = new DSPSignalNotification(
|
||||
m_settings.m_devSampleRate/(1<<buddyLog2Interp),
|
||||
buddyCenterFreq + buddyNCOFreq); // do not change center frequency
|
||||
(*itSink)->getDeviceInputMessageQueue()->push(notif);
|
||||
MsgReportLimeSDRToGUI *report = MsgReportLimeSDRToGUI::create(
|
||||
buddyCenterFreq,
|
||||
m_settings.m_devSampleRate,
|
||||
m_settings.m_log2HardDecim);
|
||||
DeviceLimeSDRShared::MsgCrossReportToGUI *report = DeviceLimeSDRShared::MsgCrossReportToGUI::create(m_settings.m_devSampleRate);
|
||||
(*itSink)->getDeviceOutputMessageQueue()->push(report);
|
||||
}
|
||||
}
|
||||
|
@ -185,6 +185,20 @@ void LimeSDRInputGUI::handleMessagesToGUI()
|
||||
|
||||
delete message;
|
||||
}
|
||||
else if (DeviceLimeSDRShared::MsgCrossReportToGUI::match(*message))
|
||||
{
|
||||
DeviceLimeSDRShared::MsgCrossReportToGUI *report = (DeviceLimeSDRShared::MsgCrossReportToGUI *) message;
|
||||
m_settings.m_devSampleRate = report->getSampleRate();
|
||||
|
||||
blockApplySettings(true);
|
||||
displaySettings();
|
||||
blockApplySettings(false);
|
||||
|
||||
LimeSDRInput::MsgSetReferenceConfig* conf = LimeSDRInput::MsgSetReferenceConfig::create(m_settings);
|
||||
m_sampleSource->getInputMessageQueue()->push(conf);
|
||||
|
||||
delete message;
|
||||
}
|
||||
else if (LimeSDRInput::MsgReportStreamInfo::match(*message))
|
||||
{
|
||||
LimeSDRInput::MsgReportStreamInfo *report = (LimeSDRInput::MsgReportStreamInfo *) message;
|
||||
|
Loading…
Reference in New Issue
Block a user