introdicing the so cute minidigits !
This commit is contained in:
parent
58cf450675
commit
f29c8c330c
0
storage/Makefile
Normal file
0
storage/Makefile
Normal file
0
storage/t.c
Normal file
0
storage/t.c
Normal file
@ -1,7 +1,9 @@
|
||||
# --------------- ***
|
||||
|
||||
COPT = -Wall -g -fpic -DTRACE=0
|
||||
OBJS = ecran.o 7segments.o waterfall.o vumetre.o
|
||||
OBJS = ecran.o 7segments.o waterfall.o vumetre.o \
|
||||
minidigits.o
|
||||
|
||||
ALIB = ../libdd2m-viz.a
|
||||
|
||||
# --------------- ***
|
||||
@ -23,6 +25,9 @@ waterfall.o: waterfall.c Makefile ecran.h
|
||||
vumetre.o: vumetre.c Makefile ecran.h
|
||||
gcc $(COPT) -c $<
|
||||
|
||||
minidigits.o: minidigits.c Makefile ecran.h
|
||||
gcc $(COPT) -c $<
|
||||
|
||||
# --------------- ***
|
||||
|
||||
t: t.c Makefile $(ALIB) ecran.h
|
||||
|
@ -21,7 +21,7 @@ fprintf(stderr, "%s [%s]\n", __func__, txt);
|
||||
#endif
|
||||
|
||||
standout();
|
||||
mvhline(LINES-1, 0, '~', COLS);
|
||||
mvhline(LINES-1, 0, ' ', COLS);
|
||||
mvaddch(LINES-1, 0, "\\|/-"[(pass++)%4]);
|
||||
mvaddstr(LINES-1, 2, txt);
|
||||
standend();
|
||||
|
@ -10,6 +10,8 @@ int aff7segs_digit(WINDOW * win, int lig, int col, char digit);
|
||||
int aff7segs_short(WINDOW * win, int lig, int col, short value);
|
||||
int aff7segs_float(WINDOW * win, int lig, int col, float value);
|
||||
|
||||
int minidigit_0(WINDOW *win, int lig, int col, char digit, int k);
|
||||
|
||||
|
||||
WINDOW * open_waterfall(char *title, int flags);
|
||||
int plot_waterfall(WINDOW *wf, int flags, float values[4]);
|
||||
|
88
viz/curses/minidigits.c
Normal file
88
viz/curses/minidigits.c
Normal file
@ -0,0 +1,88 @@
|
||||
/*
|
||||
* DD2 Monitoring
|
||||
*
|
||||
* mini digits
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <getopt.h>
|
||||
#include <ncurses.h>
|
||||
|
||||
#include "ecran.h"
|
||||
|
||||
extern int verbosity;
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
static void makedot(WINDOW *win, int li, int col, int ch)
|
||||
{
|
||||
if ('_'==ch) {
|
||||
mvwaddch(win, li, col, ' ');
|
||||
mvwaddch(win, li, col+1, ' ');
|
||||
}
|
||||
else {
|
||||
wstandout(win);
|
||||
mvwaddch(win, li, col, ' ');
|
||||
mvwaddch(win, li, col+1, ' ');
|
||||
wstandend(win);
|
||||
}
|
||||
}
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
int minidigit_0(WINDOW *win, int lig, int col, char digit, int k)
|
||||
{
|
||||
static char LX[] = "_X_X_X_X_X_X_X_";
|
||||
static char L0[] = "XXXX_XX_XX_XXXX";
|
||||
static char L1[] = "__X__X__X__X__X";
|
||||
static char L2[] = "XXX__XXXXX__XXX";
|
||||
static char L3[] = "XXX__XXXX__XXXX";
|
||||
static char L4[] = "X_XX_XXXX__X__X";
|
||||
static char L5[] = "XXXX__XXX__XXXX";
|
||||
static char L6[] = "XXXX__XXXX_XXXX";
|
||||
static char L7[] = "XXX__X__X__X__X";
|
||||
static char L8[] = "XXXX_XXXXX_XXXX";
|
||||
static char L9[] = "XXXX_XXXX__XXXX";
|
||||
|
||||
static char Lsp[] = "_______________"; /* space */
|
||||
static char Lmo[] = "______XXX______"; /* moins */
|
||||
static char Lco[] = "____X_____X____";
|
||||
|
||||
char *cptr;
|
||||
int l, c;
|
||||
|
||||
switch (digit) {
|
||||
|
||||
case '0': cptr = L0; break;
|
||||
case '1': cptr = L1; break;
|
||||
case '2': cptr = L2; break;
|
||||
case '3': cptr = L3; break;
|
||||
case '4': cptr = L4; break;
|
||||
case '5': cptr = L5; break;
|
||||
case '6': cptr = L6; break;
|
||||
case '7': cptr = L7; break;
|
||||
case '8': cptr = L8; break;
|
||||
case '9': cptr = L9; break;
|
||||
|
||||
case ' ': cptr = Lsp; break;
|
||||
case '-': cptr = Lmo; break;
|
||||
case ':': cptr = Lco; break;
|
||||
|
||||
default: cptr = LX; break;
|
||||
|
||||
}
|
||||
|
||||
for (l=0; l<5; l++) {
|
||||
for (c=0; c<3; c++) {
|
||||
|
||||
makedot(win, l+lig, (c*2)+col, *cptr++);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
wrefresh(win);
|
||||
|
||||
return 0;
|
||||
}
|
||||
/* ---------------------------------------------------------------- */
|
@ -11,6 +11,40 @@
|
||||
|
||||
int verbosity;
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
int demo_minidigits(int nbl, int k)
|
||||
{
|
||||
int loop, foo;
|
||||
char chaine[100];
|
||||
struct tm *p_tms;
|
||||
time_t temps;
|
||||
|
||||
for (loop=0; loop<nbl; loop++) {
|
||||
|
||||
sprintf(chaine, "== %06X ==", loop);
|
||||
message(chaine);
|
||||
|
||||
for (foo=0; foo<10; foo++) {
|
||||
minidigit_0(stdscr, 5, 2+foo*8, '0'+foo, 0);
|
||||
}
|
||||
wrefresh(stdscr);
|
||||
usleep(350*1000);
|
||||
|
||||
for (foo=0; foo<10; foo++) {
|
||||
minidigit_0(stdscr, 5, 2+foo*8, ' ', 0);
|
||||
}
|
||||
wrefresh(stdscr);
|
||||
usleep(250*1000);
|
||||
|
||||
temps = time(NULL);
|
||||
p_tms = localtime(&temps);
|
||||
(void)strftime(chaine, 100, "%H:%M", p_tms);
|
||||
for (foo=0; foo<strlen(chaine); foo++) {
|
||||
minidigit_0(stdscr, 15, 8+foo*8, chaine[foo], 0);
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
/* ---------------------------------------------------------------- */
|
||||
int demo_composite(int nbl, int k)
|
||||
{
|
||||
@ -32,7 +66,6 @@ for (loop=0; loop<nbl; loop++) {
|
||||
fval = fabs(fval);
|
||||
foo = vumetre_0(stdscr, 29, 5, fval, COLS-10);
|
||||
|
||||
|
||||
sprintf(ligne, "%04x", loop);
|
||||
mvaddstr(2, 1, ligne);
|
||||
refresh();
|
||||
@ -194,6 +227,8 @@ switch (demonum) {
|
||||
case 1: demo_waterfall(nb_loops, 0); break;
|
||||
case 2: demo_7segments(nb_loops, 0); break;
|
||||
case 3: demo_composite(nb_loops, 0); break;
|
||||
case 4: demo_minidigits(nb_loops, 0); break;
|
||||
|
||||
default:
|
||||
fprintf(stderr, "eyecandy #%d don't exist\n", demonum);
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user