1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-08 17:46:03 -05:00

BladeRF and HackRF input: block apply settings during settings display

This commit is contained in:
f4exb 2017-11-06 02:34:46 +01:00
parent 3d74ac9ed8
commit 7e089f9bf2
4 changed files with 41 additions and 11 deletions

View File

@ -34,6 +34,7 @@ BladerfInputGui::BladerfInputGui(DeviceUISet *deviceUISet, QWidget* parent) :
ui(new Ui::BladerfInputGui),
m_deviceUISet(deviceUISet),
m_forceSettings(true),
m_doApplySettings(true),
m_settings(),
m_sampleSource(NULL),
m_sampleRate(0),
@ -158,7 +159,9 @@ void BladerfInputGui::updateSampleRateAndFrequency()
void BladerfInputGui::displaySettings()
{
ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000);
blockApplySettings(true);
ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000);
ui->sampleRate->setValue(m_settings.m_devSampleRate);
ui->dcOffset->setChecked(m_settings.m_dcBlock);
@ -180,6 +183,8 @@ void BladerfInputGui::displaySettings()
ui->vga2->setValue(m_settings.m_vga2);
ui->xb200->setCurrentIndex(getXb200Index(m_settings.m_xb200, m_settings.m_xb200Path, m_settings.m_xb200Filter));
blockApplySettings(false);
}
void BladerfInputGui::sendSettings()
@ -363,11 +368,19 @@ void BladerfInputGui::on_record_toggled(bool checked)
void BladerfInputGui::updateHardware()
{
qDebug() << "BladerfGui::updateHardware";
BladerfInput::MsgConfigureBladerf* message = BladerfInput::MsgConfigureBladerf::create(m_settings, m_forceSettings);
m_sampleSource->getInputMessageQueue()->push(message);
m_forceSettings = false;
m_updateTimer.stop();
if (m_doApplySettings)
{
qDebug() << "BladerfGui::updateHardware";
BladerfInput::MsgConfigureBladerf* message = BladerfInput::MsgConfigureBladerf::create(m_settings, m_forceSettings);
m_sampleSource->getInputMessageQueue()->push(message);
m_forceSettings = false;
m_updateTimer.stop();
}
}
void BladerfInputGui::blockApplySettings(bool block)
{
m_doApplySettings = !block;
}
void BladerfInputGui::updateStatus()

View File

@ -55,6 +55,7 @@ private:
DeviceUISet* m_deviceUISet;
bool m_forceSettings;
bool m_doApplySettings;
BladeRFInputSettings m_settings;
QTimer m_updateTimer;
QTimer m_statusTimer;
@ -69,6 +70,7 @@ private:
void sendSettings();
unsigned int getXb200Index(bool xb_200, bladerf_xb200_path xb200Path, bladerf_xb200_filter xb200Filter);
void updateSampleRateAndFrequency();
void blockApplySettings(bool block);
private slots:
void handleInputMessages();

View File

@ -38,6 +38,7 @@ HackRFInputGui::HackRFInputGui(DeviceUISet *deviceUISet, QWidget* parent) :
m_deviceUISet(deviceUISet),
m_settings(),
m_forceSettings(true),
m_doApplySettings(true),
m_sampleSource(NULL),
m_lastEngineState((DSPDeviceSourceEngine::State)-1)
{
@ -172,6 +173,8 @@ void HackRFInputGui::updateSampleRateAndFrequency()
void HackRFInputGui::displaySettings()
{
blockApplySettings(true);
ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000);
ui->LOppm->setValue(m_settings.m_LOppmTenths);
@ -197,6 +200,8 @@ void HackRFInputGui::displaySettings()
ui->vgaText->setText(tr("%1dB").arg(m_settings.m_vgaGain));
ui->vga->setValue(m_settings.m_vgaGain);
blockApplySettings(false);
}
void HackRFInputGui::displayBandwidths()
@ -364,11 +369,19 @@ void HackRFInputGui::on_record_toggled(bool checked)
void HackRFInputGui::updateHardware()
{
qDebug() << "HackRFGui::updateHardware";
HackRFInput::MsgConfigureHackRF* message = HackRFInput::MsgConfigureHackRF::create(m_settings, m_forceSettings);
m_sampleSource->getInputMessageQueue()->push(message);
m_forceSettings = false;
m_updateTimer.stop();
if (m_doApplySettings)
{
qDebug() << "HackRFGui::updateHardware";
HackRFInput::MsgConfigureHackRF* message = HackRFInput::MsgConfigureHackRF::create(m_settings, m_forceSettings);
m_sampleSource->getInputMessageQueue()->push(message);
m_forceSettings = false;
m_updateTimer.stop();
}
}
void HackRFInputGui::blockApplySettings(bool block)
{
m_doApplySettings = !block;
}
void HackRFInputGui::updateStatus()

View File

@ -66,6 +66,7 @@ private:
DeviceUISet* m_deviceUISet;
HackRFInputSettings m_settings;
bool m_forceSettings;
bool m_doApplySettings;
QTimer m_updateTimer;
QTimer m_statusTimer;
DeviceSampleSource* m_sampleSource;
@ -78,6 +79,7 @@ private:
void displayBandwidths();
void sendSettings();
void updateSampleRateAndFrequency();
void blockApplySettings(bool block);
private slots:
void handleInputMessages();