1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-14 04:11:48 -05:00

Save bandwidth in configs. Fixed some initial configuration problems

This commit is contained in:
f4exb 2015-06-09 08:18:32 +02:00
parent 36c294ce54
commit d9a1e7942f
2 changed files with 9 additions and 5 deletions

View File

@ -29,7 +29,7 @@ BladerfGui::BladerfGui(PluginAPI* pluginAPI, QWidget* parent) :
m_sampleSource(NULL) m_sampleSource(NULL)
{ {
ui->setupUi(this); ui->setupUi(this);
ui->centerFrequency->setValueRange(7, BLADERF_FREQUENCY_MIN/1000, BLADERF_FREQUENCY_MAX/1000); ui->centerFrequency->setValueRange(7, BLADERF_FREQUENCY_MIN_XB200/1000, BLADERF_FREQUENCY_MAX/1000);
connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware())); connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware()));
displaySettings(); displaySettings();
@ -371,7 +371,7 @@ unsigned int BladerfBandwidths::getBandwidthIndex(unsigned int bandwidth)
{ {
for (unsigned int i=0; i < m_nb_halfbw; i++) for (unsigned int i=0; i < m_nb_halfbw; i++)
{ {
if (bandwidth/2 == m_halfbw[i]) if (bandwidth/2000 == m_halfbw[i])
{ {
return i; return i;
} }

View File

@ -31,7 +31,7 @@ BladerfInput::Settings::Settings() :
m_lnaGain(0), m_lnaGain(0),
m_vga1(20), m_vga1(20),
m_vga2(9), m_vga2(9),
m_samplerate(2400000), m_samplerate(3072000),
m_bandwidth(1500000), m_bandwidth(1500000),
m_log2Decim(0), m_log2Decim(0),
m_xb200(false), m_xb200(false),
@ -45,7 +45,8 @@ void BladerfInput::Settings::resetToDefaults()
m_lnaGain = 0; m_lnaGain = 0;
m_vga1 = 20; m_vga1 = 20;
m_vga2 = 9; m_vga2 = 9;
m_samplerate = 2400000; m_samplerate = 3072000;
m_bandwidth = 1500000;
m_log2Decim = 0; m_log2Decim = 0;
m_xb200 = false; m_xb200 = false;
m_xb200Path = BLADERF_XB200_MIX; m_xb200Path = BLADERF_XB200_MIX;
@ -63,6 +64,7 @@ QByteArray BladerfInput::Settings::serialize() const
s.writeBool(6, m_xb200); s.writeBool(6, m_xb200);
s.writeS32(7, (int) m_xb200Path); s.writeS32(7, (int) m_xb200Path);
s.writeS32(8, (int) m_xb200Filter); s.writeS32(8, (int) m_xb200Filter);
s.writeS32(9, m_bandwidth);
return s.final(); return s.final();
} }
@ -81,12 +83,13 @@ bool BladerfInput::Settings::deserialize(const QByteArray& data)
d.readS32(2, &m_vga1, 20); d.readS32(2, &m_vga1, 20);
d.readS32(3, &m_vga2, 9); d.readS32(3, &m_vga2, 9);
d.readS32(4, &m_samplerate, 0); d.readS32(4, &m_samplerate, 0);
d.readU32(5, &m_log2Decim, 4); d.readU32(5, &m_log2Decim, 0);
d.readBool(6, &m_xb200); d.readBool(6, &m_xb200);
d.readS32(7, &intval); d.readS32(7, &intval);
m_xb200Path = (bladerf_xb200_path) intval; m_xb200Path = (bladerf_xb200_path) intval;
d.readS32(8, &intval); d.readS32(8, &intval);
m_xb200Filter = (bladerf_xb200_filter) intval; m_xb200Filter = (bladerf_xb200_filter) intval;
d.readS32(9, &m_bandwidth, 0);
return true; return true;
} else { } else {
resetToDefaults(); resetToDefaults();
@ -325,6 +328,7 @@ bool BladerfInput::applySettings(const GeneralSettings& generalSettings, const S
if(m_dev != NULL) { if(m_dev != NULL) {
m_settings.m_log2Decim = settings.m_log2Decim; m_settings.m_log2Decim = settings.m_log2Decim;
m_bladerfThread->setLog2Decimation(settings.m_log2Decim); m_bladerfThread->setLog2Decimation(settings.m_log2Decim);
std::cerr << "BladerfInput: set decimation to " << (1<<settings.m_log2Decim) << std::endl;
} }
} }