aboutsummaryrefslogtreecommitdiffstats
path: root/host/examples/ascii_art_dft.hpp
diff options
context:
space:
mode:
authorLane Kolbly <lane.kolbly@ni.com>2021-04-14 14:37:10 -0500
committerAaron Rossetto <aaron.rossetto@ni.com>2021-04-15 14:00:34 -0500
commit1efdc3a7f6cba76cf475dbc8cc0862981981f9e0 (patch)
treea774d300c105d849efeb5dddf0592ca428bb14e3 /host/examples/ascii_art_dft.hpp
parent184999c54f0f30a7952d4e8560b393730c00e353 (diff)
downloaduhd-1efdc3a7f6cba76cf475dbc8cc0862981981f9e0.tar.gz
uhd-1efdc3a7f6cba76cf475dbc8cc0862981981f9e0.tar.bz2
uhd-1efdc3a7f6cba76cf475dbc8cc0862981981f9e0.zip
examples: Add min dynamic range limit to ascii art DFT example
The DFT plotting routine hangs when the dynamic range equals zero, so this change adds a limit so that the dynamic range never goes below 10.
Diffstat (limited to 'host/examples/ascii_art_dft.hpp')
-rw-r--r--host/examples/ascii_art_dft.hpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/host/examples/ascii_art_dft.hpp b/host/examples/ascii_art_dft.hpp
index fe411e400..73e627519 100644
--- a/host/examples/ascii_art_dft.hpp
+++ b/host/examples/ascii_art_dft.hpp
@@ -233,6 +233,10 @@ std::string dft_to_plot(const log_pwr_dft_type& dft_,
float dyn_rng,
float ref_lvl)
{
+ if (dyn_rng <= 0.0) {
+ throw std::runtime_error("dyn_rng must be greater than zero in dft_to_plot");
+ }
+
frame_type frame(width, height); // fill this frame
// re-order the dft so dc in in the center