Browse Source

second version of ncurses waterfall

master
tth 3 years ago
parent
commit
efdf127033
5 changed files with 20 additions and 12 deletions
  1. +1
    -0
      .gitignore
  2. +0
    -1
      viz/curses/7segments.c
  3. +3
    -1
      viz/curses/ecran.h
  4. +2
    -2
      viz/curses/t.c
  5. +14
    -8
      viz/curses/waterfall.c

+ 1
- 0
.gitignore View File

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

+ 0
- 1
viz/curses/7segments.c View File

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


+ 3
- 1
viz/curses/ecran.h View File

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


+ 2
- 2
viz/curses/t.c 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


+ 14
- 8
viz/curses/waterfall.c 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;
}


Loading…
Cancel
Save