aboutsummaryrefslogtreecommitdiffstats
path: root/host/examples
diff options
context:
space:
mode:
authorEtienne Wodey <wodey@iqo.uni-hannover.de>2020-04-26 23:02:03 +0200
committerAaron Rossetto <aaron.rossetto@ni.com>2020-05-26 13:02:50 -0500
commita24cfbac866ba713714dcddb753d4ad808d200c6 (patch)
treeb268bc4dccfa148be4da3497dc88cb5062e479a8 /host/examples
parentdbff8eaf055f8437f3db33c5f18f9fda3285d087 (diff)
downloaduhd-a24cfbac866ba713714dcddb753d4ad808d200c6.tar.gz
uhd-a24cfbac866ba713714dcddb753d4ad808d200c6.tar.bz2
uhd-a24cfbac866ba713714dcddb753d4ad808d200c6.zip
host/examples/ascii_art_dft.hpp: fix and modernize example main
Refresh screen after printing the DFT data. Use C++14 std::this_thread::sleep_for to control the refresh rate. Signed-off-by: Etienne Wodey <wodey@iqo.uni-hannover.de>
Diffstat (limited to 'host/examples')
-rw-r--r--host/examples/ascii_art_dft.hpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/host/examples/ascii_art_dft.hpp b/host/examples/ascii_art_dft.hpp
index 7dddad42e..fe411e400 100644
--- a/host/examples/ascii_art_dft.hpp
+++ b/host/examples/ascii_art_dft.hpp
@@ -319,8 +319,12 @@ std::string dft_to_plot(const log_pwr_dft_type& dft_,
#include <curses.h>
#include <cstdlib>
#include <iostream>
+#include <thread>
+#include <chrono>
int main(void){
+ using namespace std::chrono_literals;
+
initscr();
while (true){
@@ -343,8 +347,9 @@ int main(void){
12.5e4, 2.45e9,
60, 0
).c_str());
+ refresh();
- sleep(1);
+ std::this_thread::sleep_for(1s);
}