From efdf127033c3f353f818ae39b9ba36155ed4a1a5 Mon Sep 17 00:00:00 2001 From: tth Date: Thu, 10 Jan 2019 20:35:03 +0100 Subject: [PATCH] second version of ncurses waterfall --- .gitignore | 1 + viz/curses/7segments.c | 1 - viz/curses/ecran.h | 4 +++- viz/curses/t.c | 4 ++-- viz/curses/waterfall.c | 22 ++++++++++++++-------- 5 files changed, 20 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index d3701dc..03de370 100644 --- a/.gitignore +++ b/.gitignore @@ -17,4 +17,5 @@ doc/*.ind rrdb/*.png serial/*.png +/viz/curses/t diff --git a/viz/curses/7segments.c b/viz/curses/7segments.c index fd45595..b49b5ab 100644 --- a/viz/curses/7segments.c +++ b/viz/curses/7segments.c @@ -10,7 +10,6 @@ #include #include - #include "ecran.h" int verbosity; diff --git a/viz/curses/ecran.h b/viz/curses/ecran.h index 5f0d60d..c2ec246 100644 --- a/viz/curses/ecran.h +++ b/viz/curses/ecran.h @@ -1,4 +1,6 @@ - +/* + * interface ncurses pour dd2 monitoring + */ int fond_ecran(char *titre); diff --git a/viz/curses/t.c b/viz/curses/t.c index 3207949..7b35db7 100644 --- a/viz/curses/t.c +++ b/viz/curses/t.c @@ -1,5 +1,5 @@ #include -#include +#include #include #include #include @@ -77,7 +77,7 @@ keypad(stdscr, TRUE); /* acces aux touches 'curseur' */ fond_ecran(" Demonstrator "); -demo(9000, 0); +demo(90000, 0); /* * plop, on a fini, restaurer la console diff --git a/viz/curses/waterfall.c b/viz/curses/waterfall.c index b5c7a57..30715fa 100644 --- a/viz/curses/waterfall.c +++ b/viz/curses/waterfall.c @@ -7,7 +7,7 @@ #include #include -#include +#include #include #include @@ -42,23 +42,22 @@ float coef_w; static long iter; if (0 == (iter%10)) { - memset(ligne, '-', TL); + memset(ligne, '.', TL); } else { memset(ligne, ' ', TL); } -for (foo=0; foo<500; foo+=10) { - ligne[foo] = '|'; +for (foo=0; foo<500; foo+=20) { + ligne[foo] = '.'; } ligne[COLS-4] = '\0'; iter++; -coef_w = (float)(COLS-2) / 1024.0; +coef_w = (float)(COLS-3) / 1024.0; -#if TRACE -sprintf(ligne, "coef_w = %f\n", coef_w); -waddstr(wf, ligne); waddch(wf, '\n'); +#if TRACE > 1 +fprintf(stderr, "COLS = %d, coef_w = %f\n", COLS, coef_w); #endif switch (mode) { @@ -76,8 +75,15 @@ switch (mode) { tag = "ATOX"[foo]; idx = (int)(values[foo]*coef_w); ligne[idx] = tag; +#if TRACE + fprintf(stderr, "%c %3d ", tag, idx); +#endif } ligne[COLS-4] = '\0'; +#if TRACE + fprintf(stderr, "\n"); fflush(stderr); +#endif + break; }