Skip to content

Commit

Permalink
plugins: spectrum_analyser: Fix sampling freq check
Browse files Browse the repository at this point in the history
When trying to start the spectrum analyzer from the plugin,
any mismatch between the requested sampling rate and the set
rate read back causes the plugin to fail to launch due to
a `return false`.

On many systems, there is a small mismatch where `61440000`
(default rate) will return `61439999`, causing a match failures.
This change simply logs the mistmatch warning, but still allows
the output window to be shown.

Signed-off-by: Kevin Townsend <kevin.townsend@analog.com>
  • Loading branch information
microbuilder authored and dbogdan committed Aug 11, 2023
1 parent ea956e0 commit b25e988
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions plugins/spectrum_analyzer.c
Original file line number Diff line number Diff line change
Expand Up @@ -389,9 +389,8 @@ static bool configure_data_capture(plugin_setup *setup)
device_set_rx_sampling_freq(dev, sampling_rate);
rate = device_get_rx_sampling_freq(cap);
if (rate != sampling_rate) {
fprintf(stderr, "Failed to set the rx sampling rate to %lld"
"in %s\n", sampling_rate, __func__);
return false;
fprintf(stderr, "Failed to set the rx sampling rate to %lld "
"(actual rate is %lld) in %s\n", sampling_rate, rate, __func__);
}

dev_info = iio_device_get_data(cap);
Expand Down

0 comments on commit b25e988

Please sign in to comment.