mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-22 17:45:48 -05:00
Change settings from main context.
This commit is contained in:
parent
9d18a9a1e9
commit
6704651786
@ -93,8 +93,7 @@ bool FCDInput::startInput(int device)
|
|||||||
|
|
||||||
m_deviceDescription = QString("Funcube Dongle");
|
m_deviceDescription = QString("Funcube Dongle");
|
||||||
|
|
||||||
// if (!applySettings(m_generalSettings, m_settings, true))
|
applySettings(m_generalSettings, m_settings, true);
|
||||||
// qCritical("FCD: Unable to set config at start");
|
|
||||||
|
|
||||||
qDebug("FCDInput: start");
|
qDebug("FCDInput: start");
|
||||||
return true;
|
return true;
|
||||||
@ -132,8 +131,7 @@ bool FCDInput::handleMessage(Message* message)
|
|||||||
{
|
{
|
||||||
if(MsgConfigureFCD::match(message)) {
|
if(MsgConfigureFCD::match(message)) {
|
||||||
MsgConfigureFCD* conf = (MsgConfigureFCD*)message;
|
MsgConfigureFCD* conf = (MsgConfigureFCD*)message;
|
||||||
if(!applySettings(conf->getGeneralSettings(), conf->getSettings(), false))
|
applySettings(conf->getGeneralSettings(), conf->getSettings(), false);
|
||||||
qDebug("FCD config error");
|
|
||||||
message->completed();
|
message->completed();
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
@ -141,14 +139,10 @@ bool FCDInput::handleMessage(Message* message)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FCDInput::applySettings(const GeneralSettings& generalSettings, const Settings& settings, bool force)
|
void FCDInput::applySettings(const GeneralSettings& generalSettings, const Settings& settings, bool force)
|
||||||
{
|
{
|
||||||
QMutexLocker mutexLocker(&m_mutex);
|
|
||||||
bool freqChange;
|
bool freqChange;
|
||||||
|
|
||||||
if(!m_FCDThread)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if((m_generalSettings.m_centerFrequency != generalSettings.m_centerFrequency))
|
if((m_generalSettings.m_centerFrequency != generalSettings.m_centerFrequency))
|
||||||
freqChange = true;
|
freqChange = true;
|
||||||
else
|
else
|
||||||
@ -156,13 +150,14 @@ bool FCDInput::applySettings(const GeneralSettings& generalSettings, const Setti
|
|||||||
|
|
||||||
if(freqChange || 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) );
|
set_center_freq( (double)(generalSettings.m_centerFrequency) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!freqChange || force) {
|
if(!freqChange || force) {
|
||||||
m_FCDThread->set_lna_gain(settings.gain);
|
set_lna_gain(settings.gain);
|
||||||
m_FCDThread->set_bias_t(settings.bias);
|
set_bias_t(settings.bias);
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -72,6 +72,9 @@ public:
|
|||||||
|
|
||||||
const QString& getDeviceDescription() const;
|
const QString& getDeviceDescription() const;
|
||||||
int getSampleRate() const;
|
int getSampleRate() const;
|
||||||
|
void set_center_freq(double freq);
|
||||||
|
void set_bias_t(bool on);
|
||||||
|
void set_lna_gain(bool on);
|
||||||
quint64 getCenterFrequency() const;
|
quint64 getCenterFrequency() const;
|
||||||
bool handleMessage(Message* message);
|
bool handleMessage(Message* message);
|
||||||
|
|
||||||
@ -80,7 +83,7 @@ private:
|
|||||||
Settings m_settings;
|
Settings m_settings;
|
||||||
FCDThread* m_FCDThread;
|
FCDThread* m_FCDThread;
|
||||||
QString m_deviceDescription;
|
QString m_deviceDescription;
|
||||||
bool applySettings(const GeneralSettings& generalSettings, const Settings& settings, bool force);
|
void applySettings(const GeneralSettings& generalSettings, const Settings& settings, bool force);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // INCLUDE_FCD_H
|
#endif // INCLUDE_FCD_H
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
* it under the terms of the GNU General Public Licence version 3.
|
* it under the terms of the GNU General Public Licence version 3.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "fcdinput.h"
|
||||||
#include "fcdthread.h"
|
#include "fcdthread.h"
|
||||||
#include "hid-libusb.h"
|
#include "hid-libusb.h"
|
||||||
#include "qthid.h"
|
#include "qthid.h"
|
||||||
@ -54,20 +55,20 @@ void FCDThread::CloseSource()
|
|||||||
fcd_handle = NULL;
|
fcd_handle = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FCDThread::set_center_freq(double freq)
|
void FCDInput::set_center_freq(double freq)
|
||||||
{
|
{
|
||||||
if (fcdAppSetFreq(freq) == FCD_MODE_NONE)
|
if (fcdAppSetFreq(freq) == FCD_MODE_NONE)
|
||||||
qDebug("No FCD HID found for frquency change");
|
qDebug("No FCD HID found for frquency change");
|
||||||
}
|
}
|
||||||
|
|
||||||
void FCDThread::set_bias_t(bool on)
|
void FCDInput::set_bias_t(bool on)
|
||||||
{
|
{
|
||||||
quint8 cmd = on ? 1 : 0;
|
quint8 cmd = on ? 1 : 0;
|
||||||
|
|
||||||
fcdAppSetParam(FCD_CMD_APP_SET_BIAS_TEE, &cmd, 1);
|
fcdAppSetParam(FCD_CMD_APP_SET_BIAS_TEE, &cmd, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FCDThread::set_lna_gain(bool on)
|
void FCDInput::set_lna_gain(bool on)
|
||||||
{
|
{
|
||||||
quint8 cmd = on ? 1 : 0;
|
quint8 cmd = on ? 1 : 0;
|
||||||
|
|
||||||
|
@ -38,9 +38,6 @@ public:
|
|||||||
void stopWork();
|
void stopWork();
|
||||||
bool OpenSource(const char *filename);
|
bool OpenSource(const char *filename);
|
||||||
void CloseSource();
|
void CloseSource();
|
||||||
void set_center_freq(double freq);
|
|
||||||
void set_bias_t(bool on);
|
|
||||||
void set_lna_gain(bool on);
|
|
||||||
int work(int n_items);
|
int work(int n_items);
|
||||||
private:
|
private:
|
||||||
snd_pcm_format_t fcd_format;
|
snd_pcm_format_t fcd_format;
|
||||||
|
Loading…
Reference in New Issue
Block a user