i like eyecandy

This commit is contained in:
Tonton Th 2019-01-28 16:38:06 +01:00
parent 1dcbc6746c
commit 80b00561af

View File

@ -14,20 +14,26 @@ int verbosity;
void demo_7segments(int nbl, int notused) void demo_7segments(int nbl, int notused)
{ {
int loop, idx, c, p; int loop, idx, c, p;
char ligne[100]; char ligne[120];
time_t temps;
for (loop=0; loop<nbl; loop++) { for (loop=0; loop<nbl; loop++) {
sprintf(ligne, "%04x", loop); sprintf(ligne, "$%04x", loop);
mvaddstr(2, 1, ligne); mvaddstr(2, 1, ligne);
for (idx=0; idx<strlen(ligne); idx++) { for (idx=0; idx<strlen(ligne); idx++) {
aff7segs_digit(stdscr, 3, 10+(idx*9), ligne[idx]); aff7segs_digit(stdscr, 3, 10+(idx*9), ligne[idx]);
} }
sprintf(ligne, "%.3f", drand48()); sprintf(ligne, "%.3f", drand48());
mvaddstr(12, 1, ligne); mvaddstr(13, 1, ligne);
for (idx=0; idx<strlen(ligne); idx++) { for (idx=0; idx<strlen(ligne); idx++) {
aff7segs_digit(stdscr, 13, 10+(idx*9), ligne[idx]); aff7segs_digit(stdscr, 14, 10+(idx*9), ligne[idx]);
}
if (verbosity && (loop%2)) {
temps = time(NULL);
sprintf(ligne, "%12ld | %s", temps, ctime(&temps));
message(ligne);
} }
refresh(); refresh();
@ -40,8 +46,9 @@ void demo_vumetres(int nbl, int notused)
{ {
int loop, idx; int loop, idx;
int hpos; int hpos;
// char ligne[100]; char ligne[100];
float value; float value;
time_t temps;
for (loop=0; loop<nbl; loop++) { for (loop=0; loop<nbl; loop++) {
@ -57,6 +64,12 @@ for (loop=0; loop<nbl; loop++) {
} }
if (verbosity && (loop%2)) {
temps = time(NULL);
sprintf(ligne, "%12ld | %s", temps, ctime(&temps));
message(ligne);
}
refresh(); refresh();
usleep(200*1000); usleep(200*1000);
} }
@ -147,6 +160,9 @@ switch (demonum) {
case 0: demo_vumetres(nb_loops, 0); break; case 0: demo_vumetres(nb_loops, 0); break;
case 1: demo_waterfall(nb_loops, 0); break; case 1: demo_waterfall(nb_loops, 0); break;
case 2: demo_7segments(nb_loops, 0); break; case 2: demo_7segments(nb_loops, 0); break;
default:
fprintf(stderr, "eyecandy #%d don't exist\n", demonum);
break;
} }
/* /*