mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-25 17:28:50 -05:00
Bias T.
This commit is contained in:
parent
f10a0b778d
commit
c364378824
@ -88,6 +88,9 @@ bool FCDGui::handleMessage(Message* message)
|
||||
void FCDGui::displaySettings()
|
||||
{
|
||||
ui->centerFrequency->setValue(m_generalSettings.m_centerFrequency / 1000);
|
||||
ui->checkBoxR->setChecked(m_settings.range);
|
||||
ui->checkBoxG->setChecked(m_settings.gain);
|
||||
ui->checkBoxB->setChecked(m_settings.bias);
|
||||
}
|
||||
|
||||
void FCDGui::sendSettings()
|
||||
@ -102,18 +105,6 @@ void FCDGui::on_centerFrequency_changed(quint64 value)
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
#if 0
|
||||
void FCDGui::on_gain_valueChanged(int value)
|
||||
{
|
||||
if(value > (int)m_gains.size())
|
||||
return;
|
||||
int gain = m_gains[value];
|
||||
ui->gainText->setText(tr("%1.%2").arg(gain / 10).arg(abs(gain % 10)));
|
||||
m_settings.m_gain = gain;
|
||||
sendSettings();
|
||||
}
|
||||
#endif
|
||||
|
||||
void FCDGui::updateHardware()
|
||||
{
|
||||
FCDInput::MsgConfigureFCD* message = FCDInput::MsgConfigureFCD::create(m_generalSettings, m_settings);
|
||||
@ -121,17 +112,38 @@ void FCDGui::updateHardware()
|
||||
m_updateTimer.stop();
|
||||
}
|
||||
|
||||
void FCDGui::on_checkBox_stateChanged(int state) {
|
||||
if (state == Qt::Checked){
|
||||
void FCDGui::on_checkBoxR_stateChanged(int state)
|
||||
{
|
||||
if (state == Qt::Checked) {
|
||||
ui->centerFrequency->setValueRange(7, 150U, 240000U);
|
||||
ui->centerFrequency->setValue(7000);
|
||||
m_generalSettings.m_centerFrequency = 7000 * 1000;
|
||||
m_settings.range = 1;
|
||||
}
|
||||
else {
|
||||
ui->centerFrequency->setValueRange(7, 420000U, 1900000U);
|
||||
ui->centerFrequency->setValue(434450);
|
||||
m_generalSettings.m_centerFrequency = 434450 * 1000;
|
||||
m_settings.range = 0;
|
||||
}
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void FCDGui::on_checkBoxG_stateChanged(int state)
|
||||
{
|
||||
if (state == Qt::Checked) {
|
||||
m_settings.gain = 1;
|
||||
} else {
|
||||
m_settings.gain = 0;
|
||||
}
|
||||
sendSettings();
|
||||
}
|
||||
void FCDGui::on_checkBoxB_stateChanged(int state)
|
||||
{
|
||||
if (state == Qt::Checked) {
|
||||
m_settings.bias = 1;
|
||||
} else {
|
||||
m_settings.bias = 0;
|
||||
}
|
||||
sendSettings();
|
||||
}
|
||||
|
@ -44,9 +44,9 @@ private:
|
||||
|
||||
private slots:
|
||||
void on_centerFrequency_changed(quint64 value);
|
||||
//void on_gain_valueChanged(int value);
|
||||
//void on_samplerate_valueChanged(int value);
|
||||
void on_checkBox_stateChanged(int state);
|
||||
void on_checkBoxR_stateChanged(int state);
|
||||
void on_checkBoxG_stateChanged(int state);
|
||||
void on_checkBoxB_stateChanged(int state);
|
||||
void updateHardware();
|
||||
};
|
||||
|
||||
|
@ -100,148 +100,36 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<!--item>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<property name="spacing">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSlider" name="samplerate">
|
||||
<property name="toolTip">
|
||||
<string>Device Samplerate</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="pageStep">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Rate</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="samplerateText">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>288k</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<property name="spacing">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Gain</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSlider" name="gain">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>LNA amplification</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="pageStep">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="gainText">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item-->
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<layout class="QHBoxLayout" name="horizontalLayoutR">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox">
|
||||
<widget class="QCheckBox" name="checkBoxR">
|
||||
<property name="text">
|
||||
<string>Low Range</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayoutG">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<widget class="QCheckBox" name="checkBoxG">
|
||||
<property name="text">
|
||||
<string>LNA Gain</string>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayoutB">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBoxB">
|
||||
<property name="text">
|
||||
<string>Bias T</string>
|
||||
</property>
|
||||
</spacer>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
|
@ -25,22 +25,38 @@
|
||||
MESSAGE_CLASS_DEFINITION(FCDInput::MsgConfigureFCD, Message)
|
||||
//MESSAGE_CLASS_DEFINITION(FCDInput::MsgReportFCD, Message)
|
||||
|
||||
FCDInput::Settings::Settings()
|
||||
FCDInput::Settings::Settings() :
|
||||
range(0),
|
||||
gain(0),
|
||||
bias(0)
|
||||
{
|
||||
}
|
||||
|
||||
void FCDInput::Settings::resetToDefaults()
|
||||
{
|
||||
range = 0;
|
||||
gain = 0;
|
||||
bias = 0;
|
||||
}
|
||||
|
||||
QByteArray FCDInput::Settings::serialize() const
|
||||
{
|
||||
SimpleSerializer s(1);
|
||||
s.writeS32(1, range);
|
||||
s.writeS32(2, gain);
|
||||
s.writeS32(3, bias);
|
||||
return s.final();
|
||||
}
|
||||
|
||||
bool FCDInput::Settings::deserialize(const QByteArray& data)
|
||||
{
|
||||
SimpleDeserializer d(data);
|
||||
if(d.isValid() && d.getVersion() == 1) {
|
||||
d.readS32(1, &range, 0);
|
||||
d.readS32(2, &gain, 0);
|
||||
d.readS32(3, &bias, 0);
|
||||
return true;
|
||||
}
|
||||
resetToDefaults();
|
||||
return true;
|
||||
}
|
||||
@ -126,10 +142,17 @@ bool FCDInput::applySettings(const GeneralSettings& generalSettings, const Setti
|
||||
{
|
||||
QMutexLocker mutexLocker(&m_mutex);
|
||||
|
||||
if(!m_FCDThread)
|
||||
return false;
|
||||
|
||||
// TODO: Only call when changed
|
||||
m_FCDThread->set_lna_gain(settings.gain);
|
||||
m_FCDThread->set_bias_t(settings.bias);
|
||||
|
||||
if((m_generalSettings.m_centerFrequency != generalSettings.m_centerFrequency) || force) {
|
||||
m_generalSettings.m_centerFrequency = generalSettings.m_centerFrequency;
|
||||
if(m_FCDThread)
|
||||
m_FCDThread->set_center_freq( (double)(generalSettings.m_centerFrequency) );
|
||||
m_FCDThread->set_center_freq( (double)(generalSettings.m_centerFrequency) );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -32,6 +32,9 @@ class FCDInput : public SampleSource {
|
||||
public:
|
||||
struct Settings {
|
||||
Settings();
|
||||
qint32 range;
|
||||
qint32 gain;
|
||||
qint32 bias;
|
||||
void resetToDefaults();
|
||||
QByteArray serialize() const;
|
||||
bool deserialize(const QByteArray& data);
|
||||
|
@ -7,11 +7,11 @@
|
||||
|
||||
const PluginDescriptor FCDPlugin::m_pluginDescriptor = {
|
||||
QString("FunCube Input"),
|
||||
QString("---"),
|
||||
QString("V20"),
|
||||
QString("(c) John Greb"),
|
||||
QString("http://funcubedongle.com"),
|
||||
true,
|
||||
QString("___________")
|
||||
QString("http://www.oz9aec.net/index.php/funcube-dongle")
|
||||
};
|
||||
|
||||
FCDPlugin::FCDPlugin(QObject* parent) :
|
||||
|
@ -49,7 +49,21 @@ void FCDThread::CloseSource()
|
||||
void FCDThread::set_center_freq(double freq)
|
||||
{
|
||||
if (fcdAppSetFreq(freq) == FCD_MODE_NONE)
|
||||
qCritical("No FCD HID found for frquency change");
|
||||
qDebug("No FCD HID found for frquency change");
|
||||
}
|
||||
|
||||
void FCDThread::set_bias_t(bool on)
|
||||
{
|
||||
quint8 cmd = on ? 1 : 0;
|
||||
|
||||
fcdAppSetParam(FCD_CMD_APP_SET_BIAS_TEE, &cmd, 1);
|
||||
}
|
||||
|
||||
void FCDThread::set_lna_gain(bool on)
|
||||
{
|
||||
quint8 cmd = on ? 1 : 0;
|
||||
|
||||
fcdAppSetParam(FCD_CMD_APP_SET_LNA_GAIN, &cmd, 1);
|
||||
}
|
||||
|
||||
int FCDThread::work(int n_items)
|
||||
@ -63,6 +77,10 @@ int FCDThread::work(int n_items)
|
||||
l = snd_pcm_mmap_readi(fcd_handle, out, (snd_pcm_uframes_t)n_items);
|
||||
if (l > 0)
|
||||
m_sampleFifo->write(it, it + l);
|
||||
if (l == -EPIPE) {
|
||||
qDebug("FCD: Overrun detected");
|
||||
return 0;
|
||||
}
|
||||
return l;
|
||||
}
|
||||
|
||||
|
@ -39,6 +39,8 @@ public:
|
||||
bool OpenSource(const char *filename);
|
||||
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);
|
||||
private:
|
||||
snd_pcm_format_t fcd_format;
|
||||
|
Loading…
Reference in New Issue
Block a user