mirror of
				https://github.com/f4exb/sdrangel.git
				synced 2025-10-31 04:50:29 -04:00 
			
		
		
		
	LimeSDR: cleaned up apply settings method code removing obsolete suspend/resume threads logic
This commit is contained in:
		
							parent
							
								
									8ddc852239
								
							
						
					
					
						commit
						46ec8e17d2
					
				| @ -625,10 +625,7 @@ bool LimeSDROutput::applySettings(const LimeSDROutputSettings& settings, bool fo | ||||
|     bool forwardChangeOwnDSP = false; | ||||
|     bool forwardChangeTxDSP  = false; | ||||
|     bool forwardChangeAllDSP = false; | ||||
|     bool suspendOwnThread    = false; | ||||
|     bool ownThreadWasRunning = false; | ||||
|     bool suspendTxThread     = false; | ||||
|     bool suspendAllThread    = false; | ||||
|     bool doCalibration       = false; | ||||
|     double clockGenFreq      = 0.0; | ||||
| //  QMutexLocker mutexLocker(&m_mutex);
 | ||||
| @ -642,62 +639,6 @@ bool LimeSDROutput::applySettings(const LimeSDROutputSettings& settings, bool fo | ||||
|         qDebug() << "LimeSDROutput::applySettings: clock gen frequency: " << clockGenFreq; | ||||
|     } | ||||
| 
 | ||||
|     // determine if buddies threads or own thread need to be suspended
 | ||||
| 
 | ||||
|     if ((m_settings.m_devSampleRate != settings.m_devSampleRate) || | ||||
|         (m_settings.m_log2HardInterp != settings.m_log2HardInterp) ||force) | ||||
|     { | ||||
|         suspendAllThread = false; | ||||
|     } | ||||
| 
 | ||||
|     if ((m_settings.m_centerFrequency != settings.m_centerFrequency) || force) | ||||
|     { | ||||
|         suspendTxThread = false; | ||||
|     } | ||||
| 
 | ||||
|     if ((m_settings.m_gain != settings.m_gain) || | ||||
|         (m_settings.m_lpfBW != settings.m_lpfBW) || | ||||
|         (m_settings.m_lpfFIRBW != settings.m_lpfFIRBW) || | ||||
|         (m_settings.m_lpfFIREnable != settings.m_lpfFIREnable) || | ||||
|         (m_settings.m_ncoEnable != settings.m_ncoEnable) || | ||||
|         (m_settings.m_ncoFrequency != settings.m_ncoFrequency) || | ||||
|         (m_settings.m_log2SoftInterp != settings.m_log2SoftInterp) || force) | ||||
|     { | ||||
|         suspendOwnThread = false; | ||||
|     } | ||||
| 
 | ||||
|     // suspend buddies threads or own thread
 | ||||
| 
 | ||||
|     if (suspendAllThread) | ||||
|     { | ||||
|         suspendRxBuddies(); | ||||
|         suspendTxBuddies(); | ||||
| 
 | ||||
|         if (m_limeSDROutputThread && m_limeSDROutputThread->isRunning()) | ||||
|         { | ||||
|             m_limeSDROutputThread->stopWork(); | ||||
|             ownThreadWasRunning = true; | ||||
|         } | ||||
|     } | ||||
|     else if (suspendTxThread) | ||||
|     { | ||||
|         suspendTxBuddies(); | ||||
| 
 | ||||
|         if (m_limeSDROutputThread && m_limeSDROutputThread->isRunning()) | ||||
|         { | ||||
|             m_limeSDROutputThread->stopWork(); | ||||
|             ownThreadWasRunning = true; | ||||
|         } | ||||
|     } | ||||
|     else if (suspendOwnThread) | ||||
|     { | ||||
|         if (m_limeSDROutputThread && m_limeSDROutputThread->isRunning()) | ||||
|         { | ||||
|             m_limeSDROutputThread->stopWork(); | ||||
|             ownThreadWasRunning = true; | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     // apply settings
 | ||||
| 
 | ||||
|     if ((m_settings.m_gain != settings.m_gain) || force) | ||||
| @ -928,32 +869,6 @@ bool LimeSDROutput::applySettings(const LimeSDROutputSettings& settings, bool fo | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     // resume buddies threads or own thread
 | ||||
| 
 | ||||
|     if (suspendAllThread) | ||||
|     { | ||||
|         resumeTxBuddies(); | ||||
|         resumeRxBuddies(); | ||||
| 
 | ||||
|         if (ownThreadWasRunning) { | ||||
|             m_limeSDROutputThread->startWork(); | ||||
|         } | ||||
|     } | ||||
|     else if (suspendTxThread) | ||||
|     { | ||||
|         resumeTxBuddies(); | ||||
| 
 | ||||
|         if (ownThreadWasRunning) { | ||||
|             m_limeSDROutputThread->startWork(); | ||||
|         } | ||||
|     } | ||||
|     else if (ownThreadWasRunning) | ||||
|     { | ||||
|         if (m_limeSDROutputThread) { | ||||
|             m_limeSDROutputThread->startWork(); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     // forward changes to buddies or oneself
 | ||||
| 
 | ||||
|     if (forwardChangeAllDSP) | ||||
|  | ||||
| @ -655,10 +655,7 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc | ||||
|     bool forwardChangeOwnDSP = false; | ||||
|     bool forwardChangeRxDSP  = false; | ||||
|     bool forwardChangeAllDSP = false; | ||||
|     bool suspendOwnThread    = false; | ||||
|     bool ownThreadWasRunning = false; | ||||
|     bool suspendRxThread     = false; | ||||
|     bool suspendAllThread    = false; | ||||
|     bool doCalibration = false; | ||||
|     bool setAntennaAuto = false; | ||||
|     double clockGenFreq      = 0.0; | ||||
| @ -673,68 +670,6 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc | ||||
|         qDebug() << "LimeSDRInput::applySettings: clock gen frequency: " << clockGenFreq; | ||||
|     } | ||||
| 
 | ||||
|     // determine if buddies threads or own thread need to be suspended
 | ||||
| 
 | ||||
|     if ((m_settings.m_devSampleRate != settings.m_devSampleRate) || | ||||
|         (m_settings.m_log2HardDecim != settings.m_log2HardDecim) || force) | ||||
|     { | ||||
|         suspendAllThread = false; | ||||
|     } | ||||
| 
 | ||||
|     if ((m_settings.m_centerFrequency != settings.m_centerFrequency) || force) | ||||
|     { | ||||
|         suspendRxThread = false; | ||||
|     } | ||||
| 
 | ||||
|     if ((m_settings.m_antennaPath != settings.m_antennaPath) && | ||||
|         (m_settings.m_antennaPath == 0)) | ||||
|     { | ||||
|         suspendRxThread = false; | ||||
|     } | ||||
| 
 | ||||
|     if ((m_settings.m_gain != settings.m_gain) || | ||||
|         (m_settings.m_lpfBW != settings.m_lpfBW) || | ||||
|         (m_settings.m_lpfFIRBW != settings.m_lpfFIRBW) || | ||||
|         (m_settings.m_lpfFIREnable != settings.m_lpfFIREnable) || | ||||
|         (m_settings.m_ncoEnable != settings.m_ncoEnable) || | ||||
|         (m_settings.m_ncoFrequency != settings.m_ncoFrequency) || | ||||
|         (m_settings.m_antennaPath != settings.m_antennaPath) || force) | ||||
|     { | ||||
|         suspendOwnThread = false; | ||||
|     } | ||||
| 
 | ||||
|     // suspend buddies threads or own thread
 | ||||
| 
 | ||||
|     if (suspendAllThread) | ||||
|     { | ||||
|         suspendRxBuddies(); | ||||
|         suspendTxBuddies(); | ||||
| 
 | ||||
|         if (m_limeSDRInputThread && m_limeSDRInputThread->isRunning()) | ||||
|         { | ||||
|             m_limeSDRInputThread->stopWork(); | ||||
|             ownThreadWasRunning = true; | ||||
|         } | ||||
|     } | ||||
|     else if (suspendRxThread) | ||||
|     { | ||||
|         suspendRxBuddies(); | ||||
| 
 | ||||
|         if (m_limeSDRInputThread && m_limeSDRInputThread->isRunning()) | ||||
|         { | ||||
|             m_limeSDRInputThread->stopWork(); | ||||
|             ownThreadWasRunning = true; | ||||
|         } | ||||
|     } | ||||
|     else if (suspendOwnThread) | ||||
|     { | ||||
|         if (m_limeSDRInputThread && m_limeSDRInputThread->isRunning()) | ||||
|         { | ||||
|             m_limeSDRInputThread->stopWork(); | ||||
|             ownThreadWasRunning = true; | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     // apply settings
 | ||||
| 
 | ||||
|     if ((m_settings.m_dcBlock != settings.m_dcBlock) || force) | ||||
| @ -1083,42 +1018,6 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     // resume buddies threads or own thread
 | ||||
| 
 | ||||
|     if (suspendAllThread) | ||||
|     { | ||||
|         resumeTxBuddies(); | ||||
|         resumeRxBuddies(); | ||||
| 
 | ||||
|         if (ownThreadWasRunning) { | ||||
|             m_limeSDRInputThread->startWork(); | ||||
|         } | ||||
|     } | ||||
|     else if (suspendRxThread) | ||||
|     { | ||||
|         const std::vector<DeviceSourceAPI*>& sourceBuddies = m_deviceAPI->getSourceBuddies(); | ||||
|         std::vector<DeviceSourceAPI*>::const_iterator itSource = sourceBuddies.begin(); | ||||
| 
 | ||||
|         for (; itSource != sourceBuddies.end(); ++itSource) | ||||
|         { | ||||
|             DeviceLimeSDRShared *buddySharedPtr = (DeviceLimeSDRShared *) (*itSource)->getBuddySharedPtr(); | ||||
| 
 | ||||
|             if (buddySharedPtr->m_threadWasRunning) { | ||||
|                 buddySharedPtr->m_thread->startWork(); | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         if (ownThreadWasRunning) { | ||||
|             m_limeSDRInputThread->startWork(); | ||||
|         } | ||||
|     } | ||||
|     else if (suspendOwnThread) | ||||
|     { | ||||
|         if (ownThreadWasRunning) { | ||||
|             m_limeSDRInputThread->startWork(); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     // forward changes to buddies or oneself
 | ||||
| 
 | ||||
|     if (forwardChangeAllDSP) | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user