diff options
-rw-r--r-- | host/examples/ascii_art_dft.hpp | 4 | ||||
-rw-r--r-- | host/examples/rx_ascii_art_dft.cpp | 8 |
2 files changed, 9 insertions, 3 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 diff --git a/host/examples/rx_ascii_art_dft.cpp b/host/examples/rx_ascii_art_dft.cpp index 3652522f2..12f9477a8 100644 --- a/host/examples/rx_ascii_art_dft.cpp +++ b/host/examples/rx_ascii_art_dft.cpp @@ -286,9 +286,11 @@ int UHD_SAFE_MAIN(int argc, char* argv[]) ref_lvl -= 10; else if (ch == 'L') ref_lvl += 10; - else if (ch == 'd') - dyn_rng -= 10; - else if (ch == 'D') + else if (ch == 'd') { + if (dyn_rng > 10) { + dyn_rng -= 10; + } + } else if (ch == 'D') dyn_rng += 10; else if (ch == 's') { if (frame_rate > 1) { |