From f331a3986eea24352956878a6c7d400bb36fe6e6 Mon Sep 17 00:00:00 2001 From: f4exb Date: Sun, 27 Sep 2015 18:32:19 +0200 Subject: [PATCH] Fixed LO PPM calculation for the HackRF and Airspy --- plugins/samplesource/airspy/airspyinput.cpp | 3 ++- plugins/samplesource/hackrf/hackrfinput.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/samplesource/airspy/airspyinput.cpp b/plugins/samplesource/airspy/airspyinput.cpp index 782a74e10..b7fc7f7ec 100644 --- a/plugins/samplesource/airspy/airspyinput.cpp +++ b/plugins/samplesource/airspy/airspyinput.cpp @@ -266,7 +266,8 @@ bool AirspyInput::handleMessage(const Message& message) void AirspyInput::setCenterFrequency(quint64 freq_hz) { - freq_hz += (freq_hz * m_settings.m_LOppmTenths) / 10000000ULL; + qint64 df = ((qint64)freq_hz * m_settings.m_LOppmTenths) / 10000000LL; + freq_hz += df; airspy_error rc = (airspy_error) airspy_set_freq(m_dev, static_cast(freq_hz)); diff --git a/plugins/samplesource/hackrf/hackrfinput.cpp b/plugins/samplesource/hackrf/hackrfinput.cpp index 3c3907914..84c47c096 100644 --- a/plugins/samplesource/hackrf/hackrfinput.cpp +++ b/plugins/samplesource/hackrf/hackrfinput.cpp @@ -227,7 +227,8 @@ bool HackRFInput::handleMessage(const Message& message) void HackRFInput::setCenterFrequency(quint64 freq_hz) { - freq_hz += (freq_hz * m_settings.m_LOppmTenths) / 10000000ULL; + qint64 df = ((qint64)freq_hz * m_settings.m_LOppmTenths) / 10000000LL; + freq_hz += df; hackrf_error rc = (hackrf_error) hackrf_set_freq(m_dev, static_cast(freq_hz));