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
serial/*.png
/viz/curses/t

View File

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

View File

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

View File

@ -1,5 +1,5 @@
#include <stdio.h>
#include <unistd.h>
#include <unistd.h>
#include <stdlib.h>
#include <strings.h>
#include <getopt.h>
@ -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

View File

@ -7,7 +7,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <string.h>
#include <getopt.h>
#include <ncurses.h>
@ -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;
}