1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 17:58:43 -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), ui(new Ui::BladerfInputGui),
m_deviceUISet(deviceUISet), m_deviceUISet(deviceUISet),
m_forceSettings(true), m_forceSettings(true),
m_doApplySettings(true),
m_settings(), m_settings(),
m_sampleSource(NULL), m_sampleSource(NULL),
m_sampleRate(0), m_sampleRate(0),
@ -158,7 +159,9 @@ void BladerfInputGui::updateSampleRateAndFrequency()
void BladerfInputGui::displaySettings() 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->sampleRate->setValue(m_settings.m_devSampleRate);
ui->dcOffset->setChecked(m_settings.m_dcBlock); ui->dcOffset->setChecked(m_settings.m_dcBlock);
@ -180,6 +183,8 @@ void BladerfInputGui::displaySettings()
ui->vga2->setValue(m_settings.m_vga2); ui->vga2->setValue(m_settings.m_vga2);
ui->xb200->setCurrentIndex(getXb200Index(m_settings.m_xb200, m_settings.m_xb200Path, m_settings.m_xb200Filter)); ui->xb200->setCurrentIndex(getXb200Index(m_settings.m_xb200, m_settings.m_xb200Path, m_settings.m_xb200Filter));
blockApplySettings(false);
} }
void BladerfInputGui::sendSettings() void BladerfInputGui::sendSettings()
@ -363,11 +368,19 @@ void BladerfInputGui::on_record_toggled(bool checked)
void BladerfInputGui::updateHardware() void BladerfInputGui::updateHardware()
{ {
qDebug() << "BladerfGui::updateHardware"; if (m_doApplySettings)
BladerfInput::MsgConfigureBladerf* message = BladerfInput::MsgConfigureBladerf::create(m_settings, m_forceSettings); {
m_sampleSource->getInputMessageQueue()->push(message); qDebug() << "BladerfGui::updateHardware";
m_forceSettings = false; BladerfInput::MsgConfigureBladerf* message = BladerfInput::MsgConfigureBladerf::create(m_settings, m_forceSettings);
m_updateTimer.stop(); m_sampleSource->getInputMessageQueue()->push(message);
m_forceSettings = false;
m_updateTimer.stop();
}
}
void BladerfInputGui::blockApplySettings(bool block)
{
m_doApplySettings = !block;
} }
void BladerfInputGui::updateStatus() void BladerfInputGui::updateStatus()

View File

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

View File

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

View File

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