1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-25 01:18:38 -05:00

Support of FCD Pro dongles part #2: basic gui, input and serialization

This commit is contained in:
f4exb 2015-09-07 04:55:55 +02:00
parent 655ba362c9
commit cf68879962
8 changed files with 744 additions and 349 deletions

View File

@ -46,218 +46,4 @@
#define FCDPRO_HID_CMD_I2C_SEND_BYTE 200
#define FCDPRO_HID_CMD_I2C_RECEIVE_BYTE 201
typedef enum
{
TLGE_N5_0DB=0,
TLGE_N2_5DB=1,
TLGE_P0_0DB=4,
TLGE_P2_5DB=5,
TLGE_P5_0DB=6,
TLGE_P7_5DB=7,
TLGE_P10_0DB=8,
TLGE_P12_5DB=9,
TLGE_P15_0DB=10,
TLGE_P17_5DB=11,
TLGE_P20_0DB=12,
TLGE_P25_0DB=13,
TLGE_P30_0DB=14
} fcdpro_tuner_lna_gains;
typedef enum
{
TLEE_OFF=0,
TLEE_0=1,
TLEE_1=3,
TLEE_2=5,
TLEE_3=7
} fcdpro_lna_enhance;
typedef enum
{
TBE_VHF2,
TBE_VHF3,
TBE_UHF,
TBE_LBAND
} fcdpro_tuner_bands;
typedef enum
{
// Band 0, VHF II
TRFE_LPF268MHZ=0,
TRFE_LPF299MHZ=8,
// Band 1, VHF III
TRFE_LPF509MHZ=0,
TRFE_LPF656MHZ=8,
// Band 2, UHF
TRFE_BPF360MHZ=0,
TRFE_BPF380MHZ=1,
TRFE_BPF405MHZ=2,
TRFE_BPF425MHZ=3,
TRFE_BPF450MHZ=4,
TRFE_BPF475MHZ=5,
TRFE_BPF505MHZ=6,
TRFE_BPF540MHZ=7,
TRFE_BPF575MHZ=8,
TRFE_BPF615MHZ=9,
TRFE_BPF670MHZ=10,
TRFE_BPF720MHZ=11,
TRFE_BPF760MHZ=12,
TRFE_BPF840MHZ=13,
TRFE_BPF890MHZ=14,
TRFE_BPF970MHZ=15,
// Band 2, L band
TRFE_BPF1300MHZ=0,
TRFE_BPF1320MHZ=1,
TRFE_BPF1360MHZ=2,
TRFE_BPF1410MHZ=3,
TRFE_BPF1445MHZ=4,
TRFE_BPF1460MHZ=5,
TRFE_BPF1490MHZ=6,
TRFE_BPF1530MHZ=7,
TRFE_BPF1560MHZ=8,
TRFE_BPF1590MHZ=9,
TRFE_BPF1640MHZ=10,
TRFE_BPF1660MHZ=11,
TRFE_BPF1680MHZ=12,
TRFE_BPF1700MHZ=13,
TRFE_BPF1720MHZ=14,
TRFE_BPF1750MHZ=15
} fcdpro_rf_filters;
typedef enum
{
TMGE_P4_0DB=0,
TMGE_P12_0DB=1
} fcdpro_tuner_mixer_gains;
typedef enum
{
TBCE_LBAND=0,
TBCE_1=1,
TBCE_2=2,
TBCE_VUBAND=3
} fcdpro_tuner_bias_currents;
typedef enum
{
TMFE_27_0MHZ=0,
TMFE_4_6MHZ=8,
TMFE_4_2MHZ=9,
TMFE_3_8MHZ=10,
TMFE_3_4MHZ=11,
TMFE_3_0MHZ=12,
TMFE_2_7MHZ=13,
TMFE_2_3MHZ=14,
TMFE_1_9MHZ=15
} fcdpro_tuner_mixer_filters;
typedef enum
{
TIG1E_N3_0DB=0,
TIG1E_P6_0DB=1
} fcdpro_tuner_if_gains1;
typedef enum
{
TIGME_LINEARITY=0,
TIGME_SENSITIVITY=1
} fcdpro_tuner_if_gain_modes;
typedef enum
{
TIRFE_21_4MHZ=0,
TIRFE_21_0MHZ=1,
TIRFE_17_6MHZ=2,
TIRFE_14_7MHZ=3,
TIRFE_12_4MHZ=4,
TIRFE_10_6MHZ=5,
TIRFE_9_0MHZ=6,
TIRFE_7_7MHZ=7,
TIRFE_6_4MHZ=8,
TIRFE_5_3MHZ=9,
TIRFE_4_4MHZ=10,
TIRFE_3_4MHZ=11,
TIRFE_2_6MHZ=12,
TIRFE_1_8MHZ=13,
TIRFE_1_2MHZ=14,
TIRFE_1_0MHZ=15
} fcdpro_tuner_if_rc_filters;
typedef enum
{
TIG2E_P0_0DB=0,
TIG2E_P3_0DB=1,
TIG2E_P6_0DB=2,
TIG2E_P9_0DB=3
} fcdpro_tuner_if_gains2;
typedef enum
{
TIG3E_P0_0DB=0,
TIG3E_P3_0DB=1,
TIG3E_P6_0DB=2,
TIG3E_P9_0DB=3
} fcdpro_tuner_if_gains3;
typedef enum
{
TIG4E_P0_0DB=0,
TIG4E_P1_0DB=1,
TIG4E_P2_0DB=2
} fcdpro_tuner_if_gains4;
typedef enum
{
TIFE_5_50MHZ=0,
TIFE_5_30MHZ=1,
TIFE_5_00MHZ=2,
TIFE_4_80MHZ=3,
TIFE_4_60MHZ=4,
TIFE_4_40MHZ=5,
TIFE_4_30MHZ=6,
TIFE_4_10MHZ=7,
TIFE_3_90MHZ=8,
TIFE_3_80MHZ=9,
TIFE_3_70MHZ=10,
TIFE_3_60MHZ=11,
TIFE_3_40MHZ=12,
TIFE_3_30MHZ=13,
TIFE_3_20MHZ=14,
TIFE_3_10MHZ=15,
TIFE_3_00MHZ=16,
TIFE_2_95MHZ=17,
TIFE_2_90MHZ=18,
TIFE_2_80MHZ=19,
TIFE_2_75MHZ=20,
TIFE_2_70MHZ=21,
TIFE_2_60MHZ=22,
TIFE_2_55MHZ=23,
TIFE_2_50MHZ=24,
TIFE_2_45MHZ=25,
TIFE_2_40MHZ=26,
TIFE_2_30MHZ=27,
TIFE_2_28MHZ=28,
TIFE_2_24MHZ=29,
TIFE_2_20MHZ=30,
TIFE_2_15MHZ=31
} fcdpro_tuner_if_filters;
typedef enum
{
TIG5E_P3_0DB=0,
TIG5E_P6_0DB=1,
TIG5E_P9_0DB=2,
TIG5E_P12_0DB=3,
TIG5E_P15_0DB=4
} fcdpro_tuner_if_gains5;
typedef enum
{
TIG6E_P3_0DB=0,
TIG6E_P6_0DB=1,
TIG6E_P9_0DB=2,
TIG6E_P12_0DB=3,
TIG6E_P15_0DB=4
} fcdpro_tuner_if_gains6;
#endif // _FCDPRO_HID_CMD_H_

View File

@ -81,9 +81,7 @@ bool FCDProGui::handleMessage(const Message& message)
void FCDProGui::displaySettings()
{
ui->centerFrequency->setValue(m_settings.centerFrequency / 1000);
ui->checkBoxR->setChecked(m_settings.range);
ui->checkBoxG->setChecked(m_settings.gain);
ui->checkBoxB->setChecked(m_settings.bias);
ui->checkBoxB->setChecked(m_settings.biasT);
}
void FCDProGui::sendSettings()
@ -98,44 +96,10 @@ void FCDProGui::on_centerFrequency_changed(quint64 value)
sendSettings();
}
void FCDProGui::updateHardware()
void FCDProGui::on_ppm_valueChanged(int value)
{
FCDProInput::MsgConfigureFCD* message = FCDProInput::MsgConfigureFCD::create(m_settings);
m_sampleSource->getInputMessageQueue()->push(message);
m_updateTimer.stop();
}
void FCDProGui::on_checkBoxR_stateChanged(int state)
{
if (state == Qt::Checked) // FIXME: this is for the Pro+ version only!
{
ui->centerFrequency->setValueRange(7, 150U, 240000U);
ui->centerFrequency->setValue(7000);
m_settings.centerFrequency = 7000 * 1000;
m_settings.range = 1;
}
else
{
ui->centerFrequency->setValueRange(7, 64000U, 1900000U);
ui->centerFrequency->setValue(435000);
m_settings.centerFrequency = 435000 * 1000;
m_settings.range = 0;
}
sendSettings();
}
void FCDProGui::on_checkBoxG_stateChanged(int state)
{
if (state == Qt::Checked)
{
m_settings.gain = 1;
}
else
{
m_settings.gain = 0;
}
m_settings.LOppmTenths = value;
displaySettings();
sendSettings();
}
@ -143,12 +107,100 @@ void FCDProGui::on_checkBoxB_stateChanged(int state)
{
if (state == Qt::Checked)
{
m_settings.bias = 1;
m_settings.biasT = 1;
}
else
{
m_settings.bias = 0;
m_settings.biasT = 0;
}
sendSettings();
}
void FCDProGui::on_lnaGain_currentIndexChanged(int index)
{
}
void FCDProGui::on_rfFilter_currentIndexChanged(int index)
{
}
void FCDProGui::on_lnaEnhance_currentIndexChanged(int index)
{
}
void FCDProGui::on_band_currentIndexChanged(int index)
{
}
void FCDProGui::on_mixGain_currentIndexChanged(int index)
{
}
void FCDProGui::on_mixFilter_currentIndexChanged(int index)
{
}
void FCDProGui::on_bias_currentIndexChanged(int index)
{
}
void FCDProGui::on_mode_currentIndexChanged(int index)
{
}
void FCDProGui::on_gain1_currentIndexChanged(int index)
{
}
void FCDProGui::on_rcFilter_currentIndexChanged(int index)
{
}
void FCDProGui::on_gain2_currentIndexChanged(int index)
{
}
void FCDProGui::on_gain3_currentIndexChanged(int index)
{
}
void FCDProGui::on_gain4_currentIndexChanged(int index)
{
}
void FCDProGui::on_ifFilter_currentIndexChanged(int index)
{
}
void FCDProGui::on_gain5_currentIndexChanged(int index)
{
}
void FCDProGui::on_gain6_currentIndexChanged(int index)
{
}
void FCDProGui::updateHardware()
{
FCDProInput::MsgConfigureFCD* message = FCDProInput::MsgConfigureFCD::create(m_settings);
m_sampleSource->getInputMessageQueue()->push(message);
m_updateTimer.stop();
}

View File

@ -44,9 +44,25 @@ private:
private slots:
void on_centerFrequency_changed(quint64 value);
void on_checkBoxR_stateChanged(int state);
void on_checkBoxG_stateChanged(int state);
void on_ppm_valueChanged(int value);
void on_checkBoxB_stateChanged(int state);
// TOOD: defaults push button
void on_lnaGain_currentIndexChanged(int index);
void on_rfFilter_currentIndexChanged(int index);
void on_lnaEnhance_currentIndexChanged(int index);
void on_band_currentIndexChanged(int index);
void on_mixGain_currentIndexChanged(int index);
void on_mixFilter_currentIndexChanged(int index);
void on_bias_currentIndexChanged(int index);
void on_mode_currentIndexChanged(int index);
void on_gain1_currentIndexChanged(int index);
void on_rcFilter_currentIndexChanged(int index);
void on_gain2_currentIndexChanged(int index);
void on_gain3_currentIndexChanged(int index);
void on_gain4_currentIndexChanged(int index);
void on_ifFilter_currentIndexChanged(int index);
void on_gain5_currentIndexChanged(int index);
void on_gain6_currentIndexChanged(int index);
void updateHardware();
};

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>165</width>
<height>119</height>
<width>259</width>
<height>324</height>
</rect>
</property>
<property name="sizePolicy">
@ -36,7 +36,7 @@
<number>2</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<layout class="QHBoxLayout" name="layoutFrequency">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
@ -101,25 +101,44 @@
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayoutR">
<layout class="QHBoxLayout" name="layoutPPM">
<item>
<widget class="QCheckBox" name="checkBoxR">
<widget class="QLabel" name="ppmLabal">
<property name="text">
<string>Low Range</string>
<string>LO ppm</string>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="ppm">
<property name="toolTip">
<string>LO ppm correction</string>
</property>
<property name="minimum">
<number>-1000</number>
</property>
<property name="maximum">
<number>1000</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>0.0</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayoutG">
<item>
<widget class="QCheckBox" name="checkBoxG">
<property name="text">
<string>LNA Gain</string>
</property>
</widget>
</item>
<layout class="QHBoxLayout" name="layoutBiasT">
<item>
<widget class="QCheckBox" name="checkBoxB">
<property name="text">
@ -127,6 +146,205 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="defaultsButton">
<property name="text">
<string>Defaults</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="layoutLNA">
<item>
<widget class="QLabel" name="lnaGainLabel">
<property name="text">
<string>LNA G</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="lnaGain"/>
</item>
<item>
<widget class="QLabel" name="rfFilterLabel">
<property name="text">
<string>RF filt</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="rfFilter"/>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="layoutBand">
<item>
<widget class="QLabel" name="lnaEnhanceLabel">
<property name="text">
<string>LNA En</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="lnaEnhance"/>
</item>
<item>
<widget class="QLabel" name="bandLabel">
<property name="text">
<string>Band</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="band"/>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="layoutMixer">
<item>
<widget class="QLabel" name="mixGainLabel">
<property name="text">
<string>Mix G</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="mixGain"/>
</item>
<item>
<widget class="QLabel" name="mixFilterLabel">
<property name="text">
<string>Mix filt</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="mixFilter"/>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="layoutBias">
<item>
<widget class="QLabel" name="biasLabel">
<property name="text">
<string>Bias</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="bias"/>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Mode</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="mode"/>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="layoutGain1">
<item>
<widget class="QLabel" name="gain1Label">
<property name="text">
<string>Gain1</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="gain1"/>
</item>
<item>
<widget class="QLabel" name="rcFilterLabel">
<property name="text">
<string>RC filt</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="rcFilter"/>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="layoutGain2">
<item>
<widget class="QLabel" name="gain2Label">
<property name="text">
<string>Gain2</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="gain2"/>
</item>
<item>
<widget class="QLabel" name="gain3Label">
<property name="text">
<string>Gain3</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="gain3"/>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="layoutGain4">
<item>
<widget class="QLabel" name="gain4Label">
<property name="text">
<string>Gain4</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="gain4"/>
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>IF filt</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="ifFilter"/>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="layoutGain5">
<item>
<widget class="QLabel" name="gain5Label">
<property name="text">
<string>Gain5</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="gain5"/>
</item>
<item>
<widget class="QLabel" name="gain6Label">
<property name="text">
<string>Gain6</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="gain6"/>
</item>
</layout>
</item>
</layout>

View File

@ -27,58 +27,67 @@
#include "fcdproserializer.h"
#include "fcdprothread.h"
#include "fcdtraits.h"
#include "fcdproconst.h"
MESSAGE_CLASS_DEFINITION(FCDProInput::MsgConfigureFCD, Message)
/*
const uint16_t FCDInput::m_vendorId = 0x04D8;
const uint16_t FCDInput::m_productId = 0xFB31;
const int FCDInput::m_sampleRate = 192000;
const std::string FCDInput::m_deviceName("hw:CARD=V20");
const uint16_t FCDInput::m_productId = 0xFB56;
const int FCDInput::m_sampleRate = 96000;
const std::string FCDInput::m_deviceName("hw:CARD=V10");
*/
FCDProInput::Settings::Settings() :
centerFrequency(435000000),
range(0),
gain(0),
bias(0)
FCDProInput::Settings::Settings()
{
resetToDefaults();
}
void FCDProInput::Settings::resetToDefaults()
{
centerFrequency = 435000000;
range = 0;
gain = 0;
bias = 0;
LOppmTenths = 0;
biasT = 0;
lnaGainIndex = 0;
rfFilterIndex = 0;
lnaEnhanceIndex = 0;
bandIndex = 0;
mixerGainIndex = 0;
mixerFilterIndex = 0;
biasCurrentIndex = 0;
modeIndex = 0;
gain1Index = 0;
rcFilterIndex = 0;
gain2Index = 0;
gain3Index = 0;
gain4Index = 0;
ifFilterIndex = 0;
gain5Index = 0;
gain6Index = 0;
}
QByteArray FCDProInput::Settings::serialize() const
{
FCDProSerializer::FCDData data;
data.m_data.m_lnaGain = gain;
data.m_data.m_frequency = centerFrequency;
data.m_range = range;
data.m_bias = bias;
data.m_LOppmTenths = LOppmTenths;
data.m_biasT = biasT;
data.m_lnaGainIndex = lnaGainIndex;
data.m_rfFilterIndex = rfFilterIndex;
data.m_lnaEnhanceIndex = lnaEnhanceIndex;
data.m_bandIndex = bandIndex;
data.m_mixerGainIndex = mixerGainIndex;
data.m_mixerFilterIndex = mixerFilterIndex;
data.m_biasCurrentIndex = biasCurrentIndex;
data.m_modeIndex = modeIndex;
data.m_gain1Index = gain1Index;
data.m_rcFilterIndex = rcFilterIndex;
data.m_gain2Index = gain2Index;
data.m_gain3Index = gain3Index;
data.m_gain4Index = gain4Index;
data.m_ifFilterIndex = ifFilterIndex;
data.m_gain5Index = gain5Index;
data.m_gain6Index = gain6Index;
QByteArray byteArray;
FCDProSerializer::writeSerializedData(data, byteArray);
return byteArray;
/*
SimpleSerializer s(1);
s.writeU64(1, centerFrequency);
s.writeS32(2, range);
s.writeS32(3, gain);
s.writeS32(4, bias);
return s.final();*/
}
bool FCDProInput::Settings::deserialize(const QByteArray& serializedData)
@ -87,27 +96,26 @@ bool FCDProInput::Settings::deserialize(const QByteArray& serializedData)
bool valid = FCDProSerializer::readSerializedData(serializedData, data);
gain = data.m_data.m_lnaGain;
centerFrequency = data.m_data.m_frequency;
range = data.m_range;
bias = data.m_bias;
LOppmTenths = data.m_LOppmTenths;
biasT = data.m_biasT;
lnaGainIndex = data.m_lnaGainIndex;
rfFilterIndex = data.m_rfFilterIndex;
lnaEnhanceIndex = data.m_lnaEnhanceIndex;
bandIndex = data.m_bandIndex;
mixerGainIndex = data.m_mixerGainIndex;
biasCurrentIndex = data.m_biasCurrentIndex;
modeIndex = data.m_modeIndex;
gain1Index = data.m_gain1Index;
rcFilterIndex = data.m_rcFilterIndex;
gain2Index = data.m_gain2Index;
gain3Index = data.m_gain3Index;
gain4Index = data.m_gain4Index;
ifFilterIndex = data.m_ifFilterIndex;
gain5Index = data.m_gain5Index;
gain6Index = data.m_gain6Index;
return valid;
/*
SimpleDeserializer d(data);
if (d.isValid() && d.getVersion() == 1)
{
d.readU64(1, &centerFrequency, 435000000);
d.readS32(2, &range, 0);
d.readS32(3, &gain, 0);
d.readS32(4, &bias, 0);
return true;
}
resetToDefaults();
return true;*/
}
FCDProInput::FCDProInput() :
@ -238,23 +246,13 @@ void FCDProInput::applySettings(const Settings& settings, bool force)
signalChange = true;
}
if ((m_settings.gain != settings.gain) || force)
if ((m_settings.biasT != settings.biasT) || force)
{
m_settings.gain = settings.gain;
m_settings.biasT = settings.biasT;
if (m_dev != 0)
{
set_lna_gain(settings.gain > 0);
}
}
if ((m_settings.bias != settings.bias) || force)
{
m_settings.bias = settings.bias;
if (m_dev != 0)
{
set_bias_t(settings.bias > 0);
set_bias_t(settings.biasT > 0);
}
}
@ -281,12 +279,243 @@ void FCDProInput::set_bias_t(bool on)
//fcdAppSetParam(m_dev, FCD_CMD_APP_SET_BIAS_TEE, &cmd, 1);
}
void FCDProInput::set_lna_gain(bool on)
void FCDProInput::set_lnaGain(int index)
{
quint8 cmd = on ? 1 : 0;
if ((index < 0) || (index >= FCDProConstants::fcdpro_lna_gain_nb_values()))
{
return;
}
// TODO: use FCD Pro controls
//fcdAppSetParam(m_dev, FCD_CMD_APP_SET_LNA_GAIN, &cmd, 1);
quint8 cmd_value = FCDProConstants::lna_gains[index].value;
if (fcdAppSetParam(m_dev, FCDPRO_HID_CMD_SET_LNA_GAIN, &cmd_value, 1) != FCD_MODE_APP)
{
qWarning() << "FCDProPlusInput::set_lnaGain: failed to set at " << cmd_value;
}
}
void FCDProInput::set_rfFilter(int index)
{
if ((index < 0) || (index >= FCDProConstants::fcdpro_rf_filter_nb_values()))
{
return;
}
quint8 cmd_value = FCDProConstants::rf_filters[index].value;
if (fcdAppSetParam(m_dev, FCDPRO_HID_CMD_SET_RF_FILTER, &cmd_value, 1) != FCD_MODE_APP)
{
qWarning() << "FCDProPlusInput::set_rfFilter: failed to set at " << cmd_value;
}
}
void FCDProInput::set_lnaEnhance(int index)
{
if ((index < 0) || (index >= FCDProConstants::fcdpro_lna_enhance_nb_values()))
{
return;
}
quint8 cmd_value = FCDProConstants::lna_enhances[index].value;
if (fcdAppSetParam(m_dev, FCDPRO_HID_CMD_SET_LNA_ENHANCE, &cmd_value, 1) != FCD_MODE_APP)
{
qWarning() << "FCDProPlusInput::set_lnaEnhance: failed to set at " << cmd_value;
}
}
void FCDProInput::set_band(int index)
{
if ((index < 0) || (index >= FCDProConstants::fcdpro_band_nb_values()))
{
return;
}
quint8 cmd_value = FCDProConstants::bands[index].value;
if (fcdAppSetParam(m_dev, FCDPRO_HID_CMD_SET_BAND, &cmd_value, 1) != FCD_MODE_APP)
{
qWarning() << "FCDProPlusInput::set_band: failed to set at " << cmd_value;
}
}
void FCDProInput::set_mixerGain(int index)
{
if ((index < 0) || (index >= FCDProConstants::fcdpro_mixer_gain_nb_values()))
{
return;
}
quint8 cmd_value = FCDProConstants::mixer_gains[index].value;
if (fcdAppSetParam(m_dev, FCDPRO_HID_CMD_SET_MIXER_GAIN, &cmd_value, 1) != FCD_MODE_APP)
{
qWarning() << "FCDProPlusInput::set_mixerGain: failed to set at " << cmd_value;
}
}
void FCDProInput::set_mixerFilter(int index)
{
if ((index < 0) || (index >= FCDProConstants::fcdpro_mixer_filter_nb_values()))
{
return;
}
quint8 cmd_value = FCDProConstants::mixer_filters[index].value;
if (fcdAppSetParam(m_dev, FCDPRO_HID_CMD_SET_MIXER_FILTER, &cmd_value, 1) != FCD_MODE_APP)
{
qWarning() << "FCDProPlusInput::set_mixerFilter: failed to set at " << cmd_value;
}
}
void FCDProInput::set_biasCurrent(int index)
{
if ((index < 0) || (index >= FCDProConstants::fcdpro_bias_current_nb_values()))
{
return;
}
quint8 cmd_value = FCDProConstants::bias_currents[index].value;
if (fcdAppSetParam(m_dev, FCDPRO_HID_CMD_SET_BIAS_CURRENT, &cmd_value, 1) != FCD_MODE_APP)
{
qWarning() << "FCDProPlusInput::set_biasCurrent: failed to set at " << cmd_value;
}
}
void FCDProInput::set_mode(int index)
{
if ((index < 0) || (index >= FCDProConstants::fcdpro_if_gain_mode_nb_values()))
{
return;
}
quint8 cmd_value = FCDProConstants::if_gain_modes[index].value;
if (fcdAppSetParam(m_dev, FCDPRO_HID_CMD_SET_IF_GAIN_MODE, &cmd_value, 1) != FCD_MODE_APP)
{
qWarning() << "FCDProPlusInput::set_mode: failed to set at " << cmd_value;
}
}
void FCDProInput::set_gain1(int index)
{
if ((index < 0) || (index >= FCDProConstants::fcdpro_if_gain1_nb_values()))
{
return;
}
quint8 cmd_value = FCDProConstants::if_gains1[index].value;
if (fcdAppSetParam(m_dev, FCDPRO_HID_CMD_SET_IF_GAIN1, &cmd_value, 1) != FCD_MODE_APP)
{
qWarning() << "FCDProPlusInput::set_gain1: failed to set at " << cmd_value;
}
}
void FCDProInput::set_rcFilter(int index)
{
if ((index < 0) || (index >= FCDProConstants::fcdpro_if_rc_filter_nb_values()))
{
return;
}
quint8 cmd_value = FCDProConstants::if_rc_filters[index].value;
if (fcdAppSetParam(m_dev, FCDPRO_HID_CMD_SET_IF_RC_FILTER, &cmd_value, 1) != FCD_MODE_APP)
{
qWarning() << "FCDProPlusInput::set_rcFilter: failed to set at " << cmd_value;
}
}
void FCDProInput::set_gain2(int index)
{
if ((index < 0) || (index >= FCDProConstants::fcdpro_if_gain2_nb_values()))
{
return;
}
quint8 cmd_value = FCDProConstants::if_gains2[index].value;
if (fcdAppSetParam(m_dev, FCDPRO_HID_CMD_SET_IF_GAIN2, &cmd_value, 1) != FCD_MODE_APP)
{
qWarning() << "FCDProPlusInput::set_gain2: failed to set at " << cmd_value;
}
}
void FCDProInput::set_gain3(int index)
{
if ((index < 0) || (index >= FCDProConstants::fcdpro_if_gain3_nb_values()))
{
return;
}
quint8 cmd_value = FCDProConstants::if_gains3[index].value;
if (fcdAppSetParam(m_dev, FCDPRO_HID_CMD_SET_IF_GAIN3, &cmd_value, 1) != FCD_MODE_APP)
{
qWarning() << "FCDProPlusInput::set_gain3: failed to set at " << cmd_value;
}
}
void FCDProInput::set_gain4(int index)
{
if ((index < 0) || (index >= FCDProConstants::fcdpro_if_gain4_nb_values()))
{
return;
}
quint8 cmd_value = FCDProConstants::if_gains4[index].value;
if (fcdAppSetParam(m_dev, FCDPRO_HID_CMD_SET_IF_GAIN4, &cmd_value, 1) != FCD_MODE_APP)
{
qWarning() << "FCDProPlusInput::set_gain4: failed to set at " << cmd_value;
}
}
void FCDProInput::set_ifFilter(int index)
{
if ((index < 0) || (index >= FCDProConstants::fcdpro_if_filter_nb_values()))
{
return;
}
quint8 cmd_value = FCDProConstants::if_filters[index].value;
if (fcdAppSetParam(m_dev, FCDPRO_HID_CMD_SET_IF_FILTER, &cmd_value, 1) != FCD_MODE_APP)
{
qWarning() << "FCDProPlusInput::set_ifFilter: failed to set at " << cmd_value;
}
}
void FCDProInput::set_gain5(int index)
{
if ((index < 0) || (index >= FCDProConstants::fcdpro_if_gain5_nb_values()))
{
return;
}
quint8 cmd_value = FCDProConstants::if_gains5[index].value;
if (fcdAppSetParam(m_dev, FCDPRO_HID_CMD_SET_IF_GAIN5, &cmd_value, 1) != FCD_MODE_APP)
{
qWarning() << "FCDProPlusInput::set_gain5: failed to set at " << cmd_value;
}
}
void FCDProInput::set_gain6(int index)
{
if ((index < 0) || (index >= FCDProConstants::fcdpro_if_gain6_nb_values()))
{
return;
}
quint8 cmd_value = FCDProConstants::if_gains6[index].value;
if (fcdAppSetParam(m_dev, FCDPRO_HID_CMD_SET_IF_GAIN6, &cmd_value, 1) != FCD_MODE_APP)
{
qWarning() << "FCDProPlusInput::set_gain6: failed to set at " << cmd_value;
}
}

View File

@ -35,9 +35,24 @@ public:
struct Settings {
Settings();
quint64 centerFrequency;
qint32 range;
qint32 gain;
qint32 bias;
qint32 LOppmTenths;
bool biasT;
qint32 lnaGainIndex;
qint32 rfFilterIndex;
qint32 lnaEnhanceIndex;
qint32 bandIndex;
qint32 mixerGainIndex;
qint32 mixerFilterIndex;
qint32 biasCurrentIndex;
qint32 modeIndex;
qint32 gain1Index;
qint32 rcFilterIndex;
qint32 gain2Index;
qint32 gain3Index;
qint32 gain4Index;
qint32 ifFilterIndex;
qint32 gain5Index;
qint32 gain6Index;
void resetToDefaults();
QByteArray serialize() const;
bool deserialize(const QByteArray& data);
@ -78,7 +93,22 @@ public:
void set_center_freq(double freq);
void set_bias_t(bool on);
void set_lna_gain(bool on);
void set_lnaGain(int index);
void set_rfFilter(int index);
void set_lnaEnhance(int index);
void set_band(int index);
void set_mixerGain(int index);
void set_mixerFilter(int index);
void set_biasCurrent(int index);
void set_mode(int index);
void set_gain1(int index);
void set_rcFilter(int index);
void set_gain2(int index);
void set_gain3(int index);
void set_gain4(int index);
void set_ifFilter(int index);
void set_gain5(int index);
void set_gain6(int index);
private:
void applySettings(const Settings& settings, bool force);

View File

@ -24,8 +24,24 @@ void FCDProSerializer::writeSerializedData(const FCDData& data, QByteArray& seri
SimpleSerializer s(1);
s.writeBlob(1, sampleSourceSerialized);
s.writeS32(2, data.m_bias);
s.writeS32(3, data.m_range);
s.writeS32(2, data.m_LOppmTenths);
s.writeBool(3, data.m_biasT);
s.writeS32(4, data.m_lnaGainIndex);
s.writeS32(5, data.m_rfFilterIndex);
s.writeS32(6, data.m_lnaEnhanceIndex);
s.writeS32(7, data.m_bandIndex);
s.writeS32(8, data.m_mixerGainIndex);
s.writeS32(9, data.m_mixerFilterIndex);
s.writeS32(10, data.m_biasCurrentIndex);
s.writeS32(11, data.m_modeIndex);
s.writeS32(12, data.m_gain1Index);
s.writeS32(13, data.m_rcFilterIndex);
s.writeS32(14, data.m_gain2Index);
s.writeS32(15, data.m_gain3Index);
s.writeS32(16, data.m_gain4Index);
s.writeS32(17, data.m_ifFilterIndex);
s.writeS32(18, data.m_gain5Index);
s.writeS32(19, data.m_gain6Index);
serializedData = s.final();
}
@ -49,8 +65,24 @@ bool FCDProSerializer::readSerializedData(const QByteArray& serializedData, FCDD
int intval;
d.readBlob(1, &sampleSourceSerialized);
d.readS32(2, &data.m_bias);
d.readS32(3, &data.m_range);
d.readS32(2, &data.m_LOppmTenths);
d.readBool(3, &data.m_biasT);
d.readS32(4, &data.m_LOppmTenths);
d.readS32(5, &data.m_rfFilterIndex);
d.readS32(6, &data.m_lnaEnhanceIndex);
d.readS32(7, &data.m_bandIndex);
d.readS32(8, &data.m_mixerGainIndex);
d.readS32(9, &data.m_mixerFilterIndex);
d.readS32(10, &data.m_biasCurrentIndex);
d.readS32(11, &data.m_modeIndex);
d.readS32(12, &data.m_gain1Index);
d.readS32(13, &data.m_rcFilterIndex);
d.readS32(14, &data.m_gain2Index);
d.readS32(15, &data.m_gain3Index);
d.readS32(16, &data.m_gain4Index);
d.readS32(17, &data.m_ifFilterIndex);
d.readS32(18, &data.m_gain5Index);
d.readS32(19, &data.m_gain6Index);
return SampleSourceSerializer::readSerializedData(sampleSourceSerialized, data.m_data);
}
@ -63,6 +95,22 @@ bool FCDProSerializer::readSerializedData(const QByteArray& serializedData, FCDD
void FCDProSerializer::setDefaults(FCDData& data)
{
data.m_range = 0;
data.m_bias = 0;
data.m_LOppmTenths = 0;
data.m_biasT = false;
data.m_lnaGainIndex = 0;
data.m_rfFilterIndex = 0;
data.m_lnaEnhanceIndex = 0;
data.m_bandIndex = 0;
data.m_mixerGainIndex = 0;
data.m_mixerFilterIndex = 0;
data.m_biasCurrentIndex = 0;
data.m_modeIndex = 0;
data.m_gain1Index = 0;
data.m_rcFilterIndex = 0;
data.m_gain2Index = 0;
data.m_gain3Index = 0;
data.m_gain4Index = 0;
data.m_ifFilterIndex = 0;
data.m_gain5Index = 0;
data.m_gain6Index = 0;
}

View File

@ -25,8 +25,24 @@ public:
struct FCDData
{
SampleSourceSerializer::Data m_data;
qint32 m_bias;
qint32 m_range;
qint32 m_LOppmTenths;
bool m_biasT;
qint32 m_lnaGainIndex;
qint32 m_rfFilterIndex;
qint32 m_lnaEnhanceIndex;
qint32 m_bandIndex;
qint32 m_mixerGainIndex;
qint32 m_mixerFilterIndex;
qint32 m_biasCurrentIndex;
qint32 m_modeIndex;
qint32 m_gain1Index;
qint32 m_rcFilterIndex;
qint32 m_gain2Index;
qint32 m_gain3Index;
qint32 m_gain4Index;
qint32 m_ifFilterIndex;
qint32 m_gain5Index;
qint32 m_gain6Index;
};
static void writeSerializedData(const FCDData& data, QByteArray& serializedData);