From 3b44a5367c33f934dde1b518d076f96c99e8ae05 Mon Sep 17 00:00:00 2001 From: f4exb Date: Fri, 26 May 2017 17:42:57 +0200 Subject: [PATCH] HackRF: fixed bandwidth selection --- plugins/samplesink/hackrfoutput/hackrfoutput.cpp | 2 +- plugins/samplesource/hackrfinput/hackrfinput.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/samplesink/hackrfoutput/hackrfoutput.cpp b/plugins/samplesink/hackrfoutput/hackrfoutput.cpp index 622fbd2ac..eb548218b 100644 --- a/plugins/samplesink/hackrfoutput/hackrfoutput.cpp +++ b/plugins/samplesink/hackrfoutput/hackrfoutput.cpp @@ -296,7 +296,7 @@ bool HackRFOutput::applySettings(const HackRFOutputSettings& settings, bool forc { if (m_dev != 0) { - uint32_t bw_index = hackrf_compute_baseband_filter_bw_round_down_lt(settings.m_bandwidth); + uint32_t bw_index = hackrf_compute_baseband_filter_bw_round_down_lt(settings.m_bandwidth + 1); // +1 so the round down to lower than yields desired bandwidth rc = (hackrf_error) hackrf_set_baseband_filter_bandwidth(m_dev, bw_index); if (rc != HACKRF_SUCCESS) diff --git a/plugins/samplesource/hackrfinput/hackrfinput.cpp b/plugins/samplesource/hackrfinput/hackrfinput.cpp index eb6d05706..b7c8ab2e3 100644 --- a/plugins/samplesource/hackrfinput/hackrfinput.cpp +++ b/plugins/samplesource/hackrfinput/hackrfinput.cpp @@ -185,7 +185,7 @@ bool HackRFInput::handleMessage(const Message& message) MsgConfigureHackRF& conf = (MsgConfigureHackRF&) message; qDebug() << "HackRFInput::handleMessage: MsgConfigureHackRF"; - bool success = applySettings(conf.getSettings(), false); + bool success = applySettings(conf.getSettings(), conf.getForce()); if (!success) { @@ -373,7 +373,7 @@ bool HackRFInput::applySettings(const HackRFInputSettings& settings, bool force) if (m_dev != 0) { - uint32_t bw_index = hackrf_compute_baseband_filter_bw_round_down_lt(m_settings.m_bandwidth); + uint32_t bw_index = hackrf_compute_baseband_filter_bw_round_down_lt(m_settings.m_bandwidth + 1); // +1 so the round down to lower than yields desired bandwidth rc = (hackrf_error) hackrf_set_baseband_filter_bandwidth(m_dev, bw_index); if (rc != HACKRF_SUCCESS)