second version of ncurses waterfall

This commit is contained in:
tth 2019-01-10 20:35:03 +01:00
parent ba9b0d993f
commit efdf127033
5 changed files with 20 additions and 12 deletions

1
.gitignore vendored
View File

@ -17,4 +17,5 @@ doc/*.ind
rrdb/*.png rrdb/*.png
serial/*.png serial/*.png
/viz/curses/t

View File

@ -10,7 +10,6 @@
#include <getopt.h> #include <getopt.h>
#include <ncurses.h> #include <ncurses.h>
#include "ecran.h" #include "ecran.h"
int verbosity; int verbosity;

View File

@ -1,4 +1,6 @@
/*
* interface ncurses pour dd2 monitoring
*/
int fond_ecran(char *titre); int fond_ecran(char *titre);

View File

@ -77,7 +77,7 @@ keypad(stdscr, TRUE); /* acces aux touches 'curseur' */
fond_ecran(" Demonstrator "); fond_ecran(" Demonstrator ");
demo(9000, 0); demo(90000, 0);
/* /*
* plop, on a fini, restaurer la console * plop, on a fini, restaurer la console

View File

@ -7,7 +7,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <strings.h> #include <string.h>
#include <getopt.h> #include <getopt.h>
#include <ncurses.h> #include <ncurses.h>
@ -42,23 +42,22 @@ float coef_w;
static long iter; static long iter;
if (0 == (iter%10)) { if (0 == (iter%10)) {
memset(ligne, '-', TL); memset(ligne, '.', TL);
} }
else { else {
memset(ligne, ' ', TL); memset(ligne, ' ', TL);
} }
for (foo=0; foo<500; foo+=10) { for (foo=0; foo<500; foo+=20) {
ligne[foo] = '|'; ligne[foo] = '.';
} }
ligne[COLS-4] = '\0'; ligne[COLS-4] = '\0';
iter++; iter++;
coef_w = (float)(COLS-2) / 1024.0; coef_w = (float)(COLS-3) / 1024.0;
#if TRACE #if TRACE > 1
sprintf(ligne, "coef_w = %f\n", coef_w); fprintf(stderr, "COLS = %d, coef_w = %f\n", COLS, coef_w);
waddstr(wf, ligne); waddch(wf, '\n');
#endif #endif
switch (mode) { switch (mode) {
@ -76,8 +75,15 @@ switch (mode) {
tag = "ATOX"[foo]; tag = "ATOX"[foo];
idx = (int)(values[foo]*coef_w); idx = (int)(values[foo]*coef_w);
ligne[idx] = tag; ligne[idx] = tag;
#if TRACE
fprintf(stderr, "%c %3d ", tag, idx);
#endif
} }
ligne[COLS-4] = '\0'; ligne[COLS-4] = '\0';
#if TRACE
fprintf(stderr, "\n"); fflush(stderr);
#endif
break; break;
} }