Browse Source

second version of ncurses waterfall

tth 1 year 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
17 17
 rrdb/*.png
18 18
 serial/*.png
19 19
 
20
+/viz/curses/t
20 21
 

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

@@ -10,7 +10,6 @@
10 10
 #include  <getopt.h>
11 11
 #include  <ncurses.h>
12 12
 
13
-
14 13
 #include  "ecran.h"
15 14
 
16 15
 int	verbosity;

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

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

+ 2
- 2
viz/curses/t.c View File

@@ -1,5 +1,5 @@
1 1
 #include  <stdio.h>
2
-#include <unistd.h>
2
+#include  <unistd.h>
3 3
 #include  <stdlib.h>
4 4
 #include  <strings.h>
5 5
 #include  <getopt.h>
@@ -77,7 +77,7 @@ keypad(stdscr, TRUE);           /* acces aux touches 'curseur' */
77 77
 
78 78
 fond_ecran(" Demonstrator ");
79 79
 
80
-demo(9000, 0);
80
+demo(90000, 0);
81 81
 
82 82
 /*
83 83
  *      plop, on a fini, restaurer la console

+ 14
- 8
viz/curses/waterfall.c View File

@@ -7,7 +7,7 @@
7 7
 
8 8
 #include  <stdio.h>
9 9
 #include  <stdlib.h>
10
-#include  <strings.h>
10
+#include  <string.h>
11 11
 #include  <getopt.h>
12 12
 #include  <ncurses.h>
13 13
 
@@ -42,23 +42,22 @@ float		coef_w;
42 42
 static long	iter;
43 43
 
44 44
 if (0 == (iter%10)) {
45
-	memset(ligne, '-', TL);
45
+	memset(ligne, '.', TL);
46 46
 	}
47 47
 else	{
48 48
 	memset(ligne, ' ', TL);
49 49
 	}
50
-for (foo=0; foo<500; foo+=10) {
51
-	ligne[foo] = '|';
50
+for (foo=0; foo<500; foo+=20) {
51
+	ligne[foo] = '.';
52 52
 	}
53 53
 ligne[COLS-4] = '\0';
54 54
 
55 55
 iter++;
56 56
 
57
-coef_w = (float)(COLS-2) / 1024.0;
57
+coef_w = (float)(COLS-3) / 1024.0;
58 58
 
59
-#if TRACE
60
-sprintf(ligne, "coef_w = %f\n", coef_w);
61
-waddstr(wf, ligne);	waddch(wf, '\n');
59
+#if TRACE > 1
60
+fprintf(stderr, "COLS = %d, coef_w = %f\n", COLS, coef_w);
62 61
 #endif
63 62
 
64 63
 switch (mode) {
@@ -76,8 +75,15 @@ switch (mode) {
76 75
 			tag = "ATOX"[foo];
77 76
 			idx = (int)(values[foo]*coef_w);
78 77
 			ligne[idx] = tag;
78
+#if TRACE
79
+			fprintf(stderr, "%c   %3d  ", tag, idx);
80
+#endif
79 81
 			}
80 82
 		ligne[COLS-4] = '\0';
83
+#if TRACE
84
+			fprintf(stderr, "\n"); fflush(stderr);
85
+#endif
86
+
81 87
 		break;
82 88
 
83 89
 	}

Loading…
Cancel
Save