Browse Source

some work on the eyecandy curses display

tth 1 year ago
parent
commit
dce67b491d
7 changed files with 60 additions and 11 deletions
  1. 6
    2
      core/dd2-monitor.conf
  2. 5
    1
      core/parseconf.c
  3. 4
    1
      viz/curses/Makefile
  4. 2
    0
      viz/curses/ecran.h
  5. 3
    3
      viz/curses/t.c
  6. 36
    0
      viz/curses/vumetre.c
  7. 4
    4
      viz/curses/waterfall.c

+ 6
- 2
core/dd2-monitor.conf View File

@@ -5,8 +5,12 @@
5 5
 # --------------------------------------------------
6 6
 # serial input from the control cpu
7 7
 
8
-input_device	s	/dev/ttyACM0
9
-input_speed	i	9600
8
+input_device		s	/dev/ttyACM0
9
+input_speed		i	9600
10 10
 
11 11
 # --------------------------------------------------
12
+# some values for the eyecandy displays
13
+
14
+eyecandy_banner		s	hacked by tTh
15
+
12 16
 # --------------------------------------------------

+ 5
- 1
core/parseconf.c View File

@@ -76,7 +76,6 @@ while (fgets(line, SZ_STRINGS, fp))
76 76
 		continue;
77 77
 		}
78 78
 
79
-
80 79
 	if (CMP("input_speed")) {
81 80
 		config.input_speed = atoi(strtok(NULL, " \t"));
82 81
 #if DEBUG_LEVEL
@@ -84,6 +83,11 @@ while (fgets(line, SZ_STRINGS, fp))
84 83
 #endif
85 84
 		}
86 85
 
86
+	if (CMP("eyecandy_banner")) {
87
+		config.eyecandy_banner = strdup(strtok(NULL, " \t"));
88
+		continue;
89
+		}
90
+
87 91
 	}
88 92
 
89 93
 fclose(fp);

+ 4
- 1
viz/curses/Makefile View File

@@ -13,9 +13,12 @@ ecran.o:	ecran.c Makefile ecran.h
13 13
 waterfall.o:	waterfall.c Makefile
14 14
 	gcc $(COPT) -c $< 
15 15
 
16
+vumetre.o:	vumetre.c Makefile
17
+	gcc $(COPT) -c $< 
18
+
16 19
 # ---------------				***
17 20
 
18
-OBJ = ecran.o waterfall.o 7segments.o
21
+OBJ = ecran.o waterfall.o 7segments.o vumetre.o
19 22
 
20 23
 t:	t.c Makefile $(OBJ) ecran.h
21 24
 	gcc $(COPT) $< $(OBJ) -lncurses -o $@

+ 2
- 0
viz/curses/ecran.h View File

@@ -9,3 +9,5 @@ int message(char *);
9 9
 WINDOW * open_waterfall(char *title, int flags);
10 10
 int plot_waterfall(WINDOW *wf, int flags, float values[4]);
11 11
 int close_waterfall(WINDOW *wf, int notused);
12
+
13
+int vumetre_0(WINDOW * win, int lig, int col, float val, int larg);

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

@@ -11,7 +11,7 @@
11 11
 int	verbosity;
12 12
 
13 13
 /* ---------------------------------------------------------------- */
14
-void demo(int nbl, int k)
14
+void demo_waterfall(int nbl, int k)
15 15
 {
16 16
 int		loop, foo;
17 17
 char		line[100];
@@ -20,7 +20,7 @@ static float	rvals[4];
20 20
 struct timespec	ts;
21 21
 
22 22
 ts.tv_sec = 0;
23
-ts.tv_nsec = 133 * 1000 * 1000;
23
+ts.tv_nsec = 200 * 1000 * 1000;
24 24
 
25 25
 water = open_waterfall("premier essai", 0);
26 26
 
@@ -86,7 +86,7 @@ keypad(stdscr, TRUE);           /* acces aux touches 'curseur' */
86 86
 
87 87
 fond_ecran(" Demonstrator ");
88 88
 
89
-demo(190000, 0);
89
+demo_waterfall(190000, 0);
90 90
 
91 91
 /*
92 92
  *      plop, on a fini, restaurer la console

+ 36
- 0
viz/curses/vumetre.c View File

@@ -0,0 +1,36 @@
1
+/*
2
+ *		DD2 Monitoring
3
+ *
4
+ *	ncurses seven segment display
5
+ */
6
+
7
+#include  <stdio.h>
8
+#include  <stdlib.h>
9
+#include  <strings.h>
10
+#include  <getopt.h>
11
+#include  <ncurses.h>
12
+
13
+#include  "ecran.h"
14
+
15
+int	verbosity;
16
+
17
+/* ---------------------------------------------------------------- */
18
+int vumetre_0(WINDOW *win, int lig, int col, float val, int larg)
19
+{
20
+int		foo;
21
+
22
+#if DEBUG_LEVEL
23
+fprintf(stderr, ">>> %s ( %p %d %d %f %d )\n",
24
+		__func__, win, lig, col, val, larg);
25
+#endif
26
+
27
+for (foo=0; foo<larg; foo++) {
28
+	mvwaddch(win, lig-1, col+foo, '*');
29
+	wrefresh(win);
30
+	}
31
+
32
+return -1;
33
+}
34
+/* ---------------------------------------------------------------- */
35
+/* ---------------------------------------------------------------- */
36
+

+ 4
- 4
viz/curses/waterfall.c View File

@@ -23,7 +23,7 @@ WINDOW		*win;
23 23
 int		l, c, w, h;
24 24
 
25 25
 l = 1;			c = 1;
26
-w = COLS - 2;		h = LINES - 3;
26
+w = COLS;		h = LINES - 3;
27 27
 
28 28
 win = newwin(h, w, l, c);
29 29
 scrollok(win, 1);
@@ -50,11 +50,11 @@ else	{
50 50
 for (foo=0; foo<500; foo+=20) {
51 51
 	ligne[foo] = '.';
52 52
 	}
53
-ligne[COLS-4] = '\0';
53
+ligne[COLS-1] = '\0';
54 54
 
55 55
 iter++;
56 56
 
57
-coef_w = (float)(COLS-3) / 1024.0;
57
+coef_w = (float)(COLS-1) / 1024.0;
58 58
 
59 59
 #if TRACE > 1
60 60
 fprintf(stderr, "COLS = %d, coef_w = %f\n", COLS, coef_w);
@@ -79,7 +79,7 @@ switch (mode) {
79 79
 			fprintf(stderr, "%c   %3d  ", tag, idx);
80 80
 #endif
81 81
 			}
82
-		ligne[COLS-4] = '\0';
82
+		ligne[COLS-1] = '\0';
83 83
 #if TRACE
84 84
 			fprintf(stderr, "\n"); fflush(stderr);
85 85
 #endif

Loading…
Cancel
Save