mirror of
				https://github.com/f4exb/sdrangel.git
				synced 2025-10-31 13:00:26 -04: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 | set(limesdrdevice_SOURCES | ||||||
|     devicelimesdr.cpp |     devicelimesdr.cpp | ||||||
|     devicelimesdrparam.cpp |     devicelimesdrparam.cpp | ||||||
|  |     devicelimesdrshared.cpp | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| set(limesdrdevice_HEADERS | set(limesdrdevice_HEADERS | ||||||
|     devicelimesdr.h |     devicelimesdr.h | ||||||
|     devicelimesdrparam.h |     devicelimesdrparam.h | ||||||
|  |     devicelimesdrshared.h | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| include_directories( | include_directories( | ||||||
|  | |||||||
| @ -19,12 +19,34 @@ | |||||||
| 
 | 
 | ||||||
| #include <cstddef> | #include <cstddef> | ||||||
| #include "devicelimesdrparam.h" | #include "devicelimesdrparam.h" | ||||||
|  | #include "util/message.h" | ||||||
| 
 | 
 | ||||||
| /**
 | /**
 | ||||||
|  * Structure shared by a buddy with other buddies |  * 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 |     class ThreadInterface | ||||||
|     { |     { | ||||||
|     public: |     public: | ||||||
| @ -37,13 +59,15 @@ struct DeviceLimeSDRShared | |||||||
|     ThreadInterface     *m_thread;       //!< holds the thread address if started else 0
 |     ThreadInterface     *m_thread;       //!< holds the thread address if started else 0
 | ||||||
|     int                 m_ncoFrequency; |     int                 m_ncoFrequency; | ||||||
|     uint64_t            m_centerFrequency; |     uint64_t            m_centerFrequency; | ||||||
|  |     uint32_t            m_log2Soft; | ||||||
| 
 | 
 | ||||||
|     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) |         m_centerFrequency(0), | ||||||
|  |         m_log2Soft(0) | ||||||
|     {} |     {} | ||||||
| 
 | 
 | ||||||
|     ~DeviceLimeSDRShared() |     ~DeviceLimeSDRShared() | ||||||
|  | |||||||
| @ -644,6 +644,7 @@ bool LimeSDROutput::applySettings(const LimeSDROutputSettings& settings, bool fo | |||||||
|     { |     { | ||||||
|         m_settings.m_log2SoftInterp = settings.m_log2SoftInterp; |         m_settings.m_log2SoftInterp = settings.m_log2SoftInterp; | ||||||
|         forwardChangeOwnDSP = true; |         forwardChangeOwnDSP = true; | ||||||
|  |         m_deviceShared.m_log2Soft = m_settings.m_log2SoftInterp; // for buddies
 | ||||||
| 
 | 
 | ||||||
|         if (m_limeSDROutputThread != 0) |         if (m_limeSDROutputThread != 0) | ||||||
|         { |         { | ||||||
| @ -755,11 +756,12 @@ bool LimeSDROutput::applySettings(const LimeSDROutputSettings& settings, bool fo | |||||||
|     { |     { | ||||||
|         qDebug("LimeSDROutput::applySettings: forward change to all buddies"); |         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; |         int ncoShift = m_settings.m_ncoEnable ? m_settings.m_ncoFrequency : 0; | ||||||
| 
 | 
 | ||||||
|         // send to self first
 |         // 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); |         m_deviceAPI->getDeviceInputMessageQueue()->push(notif); | ||||||
| 
 | 
 | ||||||
|         // send to sink buddies
 |         // send to sink buddies
 | ||||||
| @ -770,7 +772,10 @@ bool LimeSDROutput::applySettings(const LimeSDROutputSettings& settings, bool fo | |||||||
|         { |         { | ||||||
|             DeviceLimeSDRShared *buddySharedPtr = (DeviceLimeSDRShared *) (*itSink)->getBuddySharedPtr(); |             DeviceLimeSDRShared *buddySharedPtr = (DeviceLimeSDRShared *) (*itSink)->getBuddySharedPtr(); | ||||||
|             int buddyNCOFreq = buddySharedPtr->m_ncoFrequency; |             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); |             (*itSink)->getDeviceInputMessageQueue()->push(notif); | ||||||
|             MsgReportLimeSDRToGUI *report = MsgReportLimeSDRToGUI::create( |             MsgReportLimeSDRToGUI *report = MsgReportLimeSDRToGUI::create( | ||||||
|                     m_settings.m_centerFrequency, |                     m_settings.m_centerFrequency, | ||||||
| @ -788,12 +793,12 @@ bool LimeSDROutput::applySettings(const LimeSDROutputSettings& settings, bool fo | |||||||
|             DeviceLimeSDRShared *buddySharedPtr = (DeviceLimeSDRShared *) (*itSource)->getBuddySharedPtr(); |             DeviceLimeSDRShared *buddySharedPtr = (DeviceLimeSDRShared *) (*itSource)->getBuddySharedPtr(); | ||||||
|             uint64_t buddyCenterFreq = buddySharedPtr->m_centerFrequency; |             uint64_t buddyCenterFreq = buddySharedPtr->m_centerFrequency; | ||||||
|             int buddyNCOFreq = buddySharedPtr->m_ncoFrequency; |             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); |             (*itSource)->getDeviceInputMessageQueue()->push(notif); | ||||||
|             MsgReportLimeSDRToGUI *report = MsgReportLimeSDRToGUI::create( |             DeviceLimeSDRShared::MsgCrossReportToGUI *report = DeviceLimeSDRShared::MsgCrossReportToGUI::create(m_settings.m_devSampleRate); | ||||||
|                     buddyCenterFreq, |  | ||||||
|                     m_settings.m_devSampleRate, |  | ||||||
|                     m_settings.m_log2HardInterp); |  | ||||||
|             (*itSource)->getDeviceOutputMessageQueue()->push(report); |             (*itSource)->getDeviceOutputMessageQueue()->push(report); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -182,6 +182,20 @@ void LimeSDROutputGUI::handleMessagesToGUI() | |||||||
| 
 | 
 | ||||||
|             delete message; |             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)) |         else if (LimeSDROutput::MsgReportStreamInfo::match(*message)) | ||||||
|         { |         { | ||||||
|             LimeSDROutput::MsgReportStreamInfo *report = (LimeSDROutput::MsgReportStreamInfo *) message; |             LimeSDROutput::MsgReportStreamInfo *report = (LimeSDROutput::MsgReportStreamInfo *) message; | ||||||
|  | |||||||
| @ -26,6 +26,7 @@ | |||||||
| #include "limesdrinput.h" | #include "limesdrinput.h" | ||||||
| #include "limesdrinputthread.h" | #include "limesdrinputthread.h" | ||||||
| #include "limesdr/devicelimesdrparam.h" | #include "limesdr/devicelimesdrparam.h" | ||||||
|  | #include "limesdr/devicelimesdrshared.h" | ||||||
| #include "limesdr/devicelimesdr.h" | #include "limesdr/devicelimesdr.h" | ||||||
| 
 | 
 | ||||||
| MESSAGE_CLASS_DEFINITION(LimeSDRInput::MsgConfigureLimeSDR, Message) | 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; |         m_settings.m_log2SoftDecim = settings.m_log2SoftDecim; | ||||||
|         forwardChangeOwnDSP = true; |         forwardChangeOwnDSP = true; | ||||||
|  |         m_deviceShared.m_log2Soft = m_settings.m_log2SoftDecim; // for buddies
 | ||||||
| 
 | 
 | ||||||
|         if (m_limeSDRInputThread != 0) |         if (m_limeSDRInputThread != 0) | ||||||
|         { |         { | ||||||
| @ -777,11 +779,12 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc | |||||||
|     { |     { | ||||||
|         qDebug("LimeSDRInput::applySettings: forward change to all buddies"); |         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; |         int ncoShift = m_settings.m_ncoEnable ? m_settings.m_ncoFrequency : 0; | ||||||
| 
 | 
 | ||||||
|         // send to self first
 |         // 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); |         m_deviceAPI->getDeviceInputMessageQueue()->push(notif); | ||||||
| 
 | 
 | ||||||
|         // send to source buddies
 |         // send to source buddies
 | ||||||
| @ -792,7 +795,10 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc | |||||||
|         { |         { | ||||||
|             DeviceLimeSDRShared *buddySharedPtr = (DeviceLimeSDRShared *) (*itSource)->getBuddySharedPtr(); |             DeviceLimeSDRShared *buddySharedPtr = (DeviceLimeSDRShared *) (*itSource)->getBuddySharedPtr(); | ||||||
|             int buddyNCOFreq = buddySharedPtr->m_ncoFrequency; |             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); |             (*itSource)->getDeviceInputMessageQueue()->push(notif); | ||||||
|             MsgReportLimeSDRToGUI *report = MsgReportLimeSDRToGUI::create( |             MsgReportLimeSDRToGUI *report = MsgReportLimeSDRToGUI::create( | ||||||
|                     m_settings.m_centerFrequency, |                     m_settings.m_centerFrequency, | ||||||
| @ -810,12 +816,12 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc | |||||||
|             DeviceLimeSDRShared *buddySharedPtr = (DeviceLimeSDRShared *) (*itSink)->getBuddySharedPtr(); |             DeviceLimeSDRShared *buddySharedPtr = (DeviceLimeSDRShared *) (*itSink)->getBuddySharedPtr(); | ||||||
|             uint64_t buddyCenterFreq = buddySharedPtr->m_centerFrequency; |             uint64_t buddyCenterFreq = buddySharedPtr->m_centerFrequency; | ||||||
|             int buddyNCOFreq = buddySharedPtr->m_ncoFrequency; |             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); |             (*itSink)->getDeviceInputMessageQueue()->push(notif); | ||||||
|             MsgReportLimeSDRToGUI *report = MsgReportLimeSDRToGUI::create( |             DeviceLimeSDRShared::MsgCrossReportToGUI *report = DeviceLimeSDRShared::MsgCrossReportToGUI::create(m_settings.m_devSampleRate); | ||||||
|                     buddyCenterFreq, |  | ||||||
|                     m_settings.m_devSampleRate, |  | ||||||
|                     m_settings.m_log2HardDecim); |  | ||||||
|             (*itSink)->getDeviceOutputMessageQueue()->push(report); |             (*itSink)->getDeviceOutputMessageQueue()->push(report); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -185,6 +185,20 @@ void LimeSDRInputGUI::handleMessagesToGUI() | |||||||
| 
 | 
 | ||||||
|             delete message; |             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)) |         else if (LimeSDRInput::MsgReportStreamInfo::match(*message)) | ||||||
|         { |         { | ||||||
|             LimeSDRInput::MsgReportStreamInfo *report = (LimeSDRInput::MsgReportStreamInfo *) message; |             LimeSDRInput::MsgReportStreamInfo *report = (LimeSDRInput::MsgReportStreamInfo *) message; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user