1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-23 01:55:48 -05:00

Initial settings.

This commit is contained in:
John Greb 2014-12-02 15:39:37 +00:00
parent c364378824
commit 3ec45e00ad
3 changed files with 16 additions and 5 deletions

View File

@ -93,6 +93,9 @@ bool FCDInput::startInput(int device)
m_deviceDescription = QString("Funcube Dongle"); m_deviceDescription = QString("Funcube Dongle");
if (!applySettings(m_generalSettings, m_settings, true))
qCritical("FCD: Unable to set config at start");
qDebug("FCDInput: start"); qDebug("FCDInput: start");
return true; return true;
} }
@ -141,18 +144,25 @@ bool FCDInput::handleMessage(Message* message)
bool FCDInput::applySettings(const GeneralSettings& generalSettings, const Settings& settings, bool force) bool FCDInput::applySettings(const GeneralSettings& generalSettings, const Settings& settings, bool force)
{ {
QMutexLocker mutexLocker(&m_mutex); QMutexLocker mutexLocker(&m_mutex);
bool freqChange;
if(!m_FCDThread) if(!m_FCDThread)
return false; return false;
// TODO: Only call when changed if((m_generalSettings.m_centerFrequency != generalSettings.m_centerFrequency))
m_FCDThread->set_lna_gain(settings.gain); freqChange = true;
m_FCDThread->set_bias_t(settings.bias); else
freqChange = false;
if((m_generalSettings.m_centerFrequency != generalSettings.m_centerFrequency) || force) { if(freqChange || force) {
m_generalSettings.m_centerFrequency = generalSettings.m_centerFrequency; m_generalSettings.m_centerFrequency = generalSettings.m_centerFrequency;
m_FCDThread->set_center_freq( (double)(generalSettings.m_centerFrequency) ); m_FCDThread->set_center_freq( (double)(generalSettings.m_centerFrequency) );
} }
if(!freqChange || force) {
m_FCDThread->set_lna_gain(settings.gain);
m_FCDThread->set_bias_t(settings.bias);
}
return true; return true;
} }

View File

@ -41,11 +41,11 @@ void FCDThread::stopWork()
void FCDThread::run() void FCDThread::run()
{ {
m_running = true;
if ( !OpenSource("hw:CARD=V20") ) if ( !OpenSource("hw:CARD=V20") )
return; return;
// TODO: fallback to original fcd // TODO: fallback to original fcd
m_running = true;
while(m_running) { while(m_running) {
if ( work(BLOCKSIZE) < 0) if ( work(BLOCKSIZE) < 0)
break; break;

View File

@ -96,6 +96,7 @@ bool V4LInput::startInput(int device)
qDebug("V4LInput: start"); qDebug("V4LInput: start");
MsgReportV4L::create(m_gains)->submit(m_guiMessageQueue); MsgReportV4L::create(m_gains)->submit(m_guiMessageQueue);
applySettings(m_generalSettings, m_settings, true);
return true; return true;
} }