mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-29 19:28:47 -05:00
Deep redesign: Better support for FCD dongles #3: Fixed frequency change at startup (apply settings with force). Aligned startup code with BladeRF's one (startWork method in thread)
This commit is contained in:
parent
6910ea7e22
commit
01feb31a9e
@ -143,8 +143,6 @@ bool FCDInput::start(int device)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_deviceDescription = QString("Funcube Dongle");
|
|
||||||
|
|
||||||
qDebug("FCDInput::start");
|
qDebug("FCDInput::start");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -198,7 +196,7 @@ void FCDInput::applySettings(const Settings& settings, bool force)
|
|||||||
{
|
{
|
||||||
bool signalChange = false;
|
bool signalChange = false;
|
||||||
|
|
||||||
if ((m_settings.centerFrequency != settings.centerFrequency))
|
if ((m_settings.centerFrequency != settings.centerFrequency) || force)
|
||||||
{
|
{
|
||||||
qDebug() << "FCDInput::applySettings: fc: " << settings.centerFrequency;
|
qDebug() << "FCDInput::applySettings: fc: " << settings.centerFrequency;
|
||||||
m_settings.centerFrequency = settings.centerFrequency;
|
m_settings.centerFrequency = settings.centerFrequency;
|
||||||
|
@ -145,11 +145,14 @@ bool FCDInput::start(int device)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_deviceDescription = QString("Funcube Dongle");
|
||||||
|
|
||||||
/* Apply settings before streaming to avoid bus contention;
|
/* Apply settings before streaming to avoid bus contention;
|
||||||
* there is very little spare bandwidth on a full speed USB device.
|
* there is very little spare bandwidth on a full speed USB device.
|
||||||
* Failure is harmless if no device is found */
|
* Failure is harmless if no device is found
|
||||||
|
* ... This is rubbish...*/
|
||||||
|
|
||||||
applySettings(m_settings, true);
|
//applySettings(m_settings, true);
|
||||||
|
|
||||||
if(!m_sampleFifo.setSize(96000*4))
|
if(!m_sampleFifo.setSize(96000*4))
|
||||||
{
|
{
|
||||||
@ -163,7 +166,10 @@ bool FCDInput::start(int device)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_deviceDescription = QString("Funcube Dongle");
|
m_FCDThread->startWork();
|
||||||
|
|
||||||
|
mutexLocker.unlock();
|
||||||
|
applySettings(m_settings, true);
|
||||||
|
|
||||||
qDebug("FCDInput::started");
|
qDebug("FCDInput::started");
|
||||||
return true;
|
return true;
|
||||||
@ -221,7 +227,7 @@ void FCDInput::applySettings(const Settings& settings, bool force)
|
|||||||
{
|
{
|
||||||
bool signalChange = false;
|
bool signalChange = false;
|
||||||
|
|
||||||
if ((m_settings.centerFrequency != settings.centerFrequency))
|
if ((m_settings.centerFrequency != settings.centerFrequency) || force)
|
||||||
{
|
{
|
||||||
qDebug() << "FCDInput::applySettings: fc: " << settings.centerFrequency;
|
qDebug() << "FCDInput::applySettings: fc: " << settings.centerFrequency;
|
||||||
m_settings.centerFrequency = settings.centerFrequency;
|
m_settings.centerFrequency = settings.centerFrequency;
|
||||||
|
@ -36,6 +36,20 @@ FCDThread::~FCDThread()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FCDThread::startWork()
|
||||||
|
{
|
||||||
|
m_startWaitMutex.lock();
|
||||||
|
|
||||||
|
start();
|
||||||
|
|
||||||
|
while(!m_running)
|
||||||
|
{
|
||||||
|
m_startWaiter.wait(&m_startWaitMutex, 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_startWaitMutex.unlock();
|
||||||
|
}
|
||||||
|
|
||||||
void FCDThread::stopWork()
|
void FCDThread::stopWork()
|
||||||
{
|
{
|
||||||
m_running = false;
|
m_running = false;
|
||||||
|
@ -35,10 +35,11 @@ public:
|
|||||||
FCDThread(SampleFifo* sampleFifo, QObject* parent = NULL);
|
FCDThread(SampleFifo* sampleFifo, QObject* parent = NULL);
|
||||||
~FCDThread();
|
~FCDThread();
|
||||||
|
|
||||||
|
void startWork();
|
||||||
void stopWork();
|
void stopWork();
|
||||||
bool OpenSource(const char *filename);
|
bool OpenSource(const char *filename);
|
||||||
void CloseSource();
|
void CloseSource();
|
||||||
int work(int n_items);
|
|
||||||
private:
|
private:
|
||||||
snd_pcm_format_t fcd_format;
|
snd_pcm_format_t fcd_format;
|
||||||
snd_pcm_t* fcd_handle;
|
snd_pcm_t* fcd_handle;
|
||||||
@ -51,6 +52,6 @@ private:
|
|||||||
SampleFifo* m_sampleFifo;
|
SampleFifo* m_sampleFifo;
|
||||||
|
|
||||||
void run();
|
void run();
|
||||||
|
int work(int n_items);
|
||||||
};
|
};
|
||||||
#endif // INCLUDE_FCDTHREAD_H
|
#endif // INCLUDE_FCDTHREAD_H
|
||||||
|
Loading…
Reference in New Issue
Block a user