From 1efdc3a7f6cba76cf475dbc8cc0862981981f9e0 Mon Sep 17 00:00:00 2001 From: Lane Kolbly Date: Wed, 14 Apr 2021 14:37:10 -0500 Subject: 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. --- host/examples/rx_ascii_art_dft.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'host/examples/rx_ascii_art_dft.cpp') 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) { -- cgit v1.2.3