From dce67b491dc52f6636a844d40381c61ed0394f51 Mon Sep 17 00:00:00 2001 From: tth Date: Wed, 23 Jan 2019 22:39:03 +0100 Subject: [PATCH] some work on the eyecandy curses display --- core/dd2-monitor.conf | 8 ++++++-- core/parseconf.c | 6 +++++- viz/curses/Makefile | 5 ++++- viz/curses/ecran.h | 2 ++ viz/curses/t.c | 6 +++--- viz/curses/vumetre.c | 36 ++++++++++++++++++++++++++++++++++++ viz/curses/waterfall.c | 8 ++++---- 7 files changed, 60 insertions(+), 11 deletions(-) create mode 100644 viz/curses/vumetre.c diff --git a/core/dd2-monitor.conf b/core/dd2-monitor.conf index 5910bda..494e4a3 100644 --- a/core/dd2-monitor.conf +++ b/core/dd2-monitor.conf @@ -5,8 +5,12 @@ # -------------------------------------------------- # serial input from the control cpu -input_device s /dev/ttyACM0 -input_speed i 9600 +input_device s /dev/ttyACM0 +input_speed i 9600 # -------------------------------------------------- +# some values for the eyecandy displays + +eyecandy_banner s hacked by tTh + # -------------------------------------------------- diff --git a/core/parseconf.c b/core/parseconf.c index baf4f4e..bce5c44 100644 --- a/core/parseconf.c +++ b/core/parseconf.c @@ -76,7 +76,6 @@ while (fgets(line, SZ_STRINGS, fp)) continue; } - if (CMP("input_speed")) { config.input_speed = atoi(strtok(NULL, " \t")); #if DEBUG_LEVEL @@ -84,6 +83,11 @@ while (fgets(line, SZ_STRINGS, fp)) #endif } + if (CMP("eyecandy_banner")) { + config.eyecandy_banner = strdup(strtok(NULL, " \t")); + continue; + } + } fclose(fp); diff --git a/viz/curses/Makefile b/viz/curses/Makefile index a275f58..bc75dcc 100644 --- a/viz/curses/Makefile +++ b/viz/curses/Makefile @@ -13,9 +13,12 @@ ecran.o: ecran.c Makefile ecran.h waterfall.o: waterfall.c Makefile gcc $(COPT) -c $< +vumetre.o: vumetre.c Makefile + gcc $(COPT) -c $< + # --------------- *** -OBJ = ecran.o waterfall.o 7segments.o +OBJ = ecran.o waterfall.o 7segments.o vumetre.o t: t.c Makefile $(OBJ) ecran.h gcc $(COPT) $< $(OBJ) -lncurses -o $@ diff --git a/viz/curses/ecran.h b/viz/curses/ecran.h index aa45fe5..0ad0234 100644 --- a/viz/curses/ecran.h +++ b/viz/curses/ecran.h @@ -9,3 +9,5 @@ int message(char *); WINDOW * open_waterfall(char *title, int flags); int plot_waterfall(WINDOW *wf, int flags, float values[4]); int close_waterfall(WINDOW *wf, int notused); + +int vumetre_0(WINDOW * win, int lig, int col, float val, int larg); diff --git a/viz/curses/t.c b/viz/curses/t.c index 0f64fb2..1aec788 100644 --- a/viz/curses/t.c +++ b/viz/curses/t.c @@ -11,7 +11,7 @@ int verbosity; /* ---------------------------------------------------------------- */ -void demo(int nbl, int k) +void demo_waterfall(int nbl, int k) { int loop, foo; char line[100]; @@ -20,7 +20,7 @@ static float rvals[4]; struct timespec ts; ts.tv_sec = 0; -ts.tv_nsec = 133 * 1000 * 1000; +ts.tv_nsec = 200 * 1000 * 1000; water = open_waterfall("premier essai", 0); @@ -86,7 +86,7 @@ keypad(stdscr, TRUE); /* acces aux touches 'curseur' */ fond_ecran(" Demonstrator "); -demo(190000, 0); +demo_waterfall(190000, 0); /* * plop, on a fini, restaurer la console diff --git a/viz/curses/vumetre.c b/viz/curses/vumetre.c new file mode 100644 index 0000000..6382029 --- /dev/null +++ b/viz/curses/vumetre.c @@ -0,0 +1,36 @@ +/* + * DD2 Monitoring + * + * ncurses seven segment display + */ + +#include +#include +#include +#include +#include + +#include "ecran.h" + +int verbosity; + +/* ---------------------------------------------------------------- */ +int vumetre_0(WINDOW *win, int lig, int col, float val, int larg) +{ +int foo; + +#if DEBUG_LEVEL +fprintf(stderr, ">>> %s ( %p %d %d %f %d )\n", + __func__, win, lig, col, val, larg); +#endif + +for (foo=0; foo 1 fprintf(stderr, "COLS = %d, coef_w = %f\n", COLS, coef_w); @@ -79,7 +79,7 @@ switch (mode) { fprintf(stderr, "%c %3d ", tag, idx); #endif } - ligne[COLS-4] = '\0'; + ligne[COLS-1] = '\0'; #if TRACE fprintf(stderr, "\n"); fflush(stderr); #endif