ready for the next step ?
This commit is contained in:
parent
c52b1659b5
commit
b4aa5445a2
@ -81,7 +81,7 @@ int aff7segs_digit(WINDOW * win, int lig, int col, char digit)
|
||||
{
|
||||
int bits;
|
||||
|
||||
#if TRACE
|
||||
#if TRACE > 1
|
||||
fprintf(stderr, ">>> %s ( %p %d %d '%c' )\n", __func__,
|
||||
win, lig, col, digit);
|
||||
#endif
|
||||
@ -126,7 +126,7 @@ char buff[10];
|
||||
int idx;
|
||||
|
||||
sprintf(buff, "%6d", value);
|
||||
mvwaddstr(win, lig-1, col, buff);
|
||||
// mvwaddstr(win, lig-1, col, buff);
|
||||
for (idx=0; idx<strlen(buff); idx++) {
|
||||
aff7segs_digit(win, lig, col+(idx*9), buff[idx]);
|
||||
}
|
||||
@ -141,7 +141,7 @@ char buff[10];
|
||||
int idx;
|
||||
|
||||
sprintf(buff, "%6.2f", value);
|
||||
mvwaddstr(win, lig-1, col, buff);
|
||||
// mvwaddstr(win, lig-1, col, buff);
|
||||
for (idx=0; idx<strlen(buff); idx++) {
|
||||
aff7segs_digit(win, lig, col+(idx*9), buff[idx]);
|
||||
}
|
||||
|
@ -9,14 +9,16 @@
|
||||
|
||||
#include "ecran.h"
|
||||
|
||||
int verbosity;
|
||||
extern int verbosity;
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
int message(char *txt)
|
||||
{
|
||||
static int pass = 0;
|
||||
|
||||
#if TRACE
|
||||
fprintf(stderr, "%s [%s]\n", __func__, txt);
|
||||
#endif
|
||||
|
||||
standout();
|
||||
mvhline(LINES-1, 0, '~', COLS);
|
||||
@ -37,6 +39,7 @@ standend();
|
||||
/* refresh(); */
|
||||
}
|
||||
/* ---------------------------------------------------------------- */
|
||||
/* make display on the standard screen (stdscr) */
|
||||
int fond_ecran(char *title)
|
||||
{
|
||||
char *tp;
|
||||
@ -44,7 +47,7 @@ struct utsname utsn;
|
||||
int foo;
|
||||
char buffer[200];
|
||||
|
||||
tp = " DD2 MONITORING by tTh 2019 ";
|
||||
tp = " DD2 Monitoring by tTh 2019 ";
|
||||
if (NULL != title) tp = title;
|
||||
|
||||
barre_inverse(' ', 0);
|
||||
@ -52,7 +55,8 @@ standout();
|
||||
mvaddstr(0, 2, tp);
|
||||
|
||||
if (verbosity) {
|
||||
sprintf(buffer, " ecran %dx%d ", COLS, LINES);
|
||||
sprintf(buffer, " ecr: %dx%d ", COLS, LINES);
|
||||
fprintf(stderr, "%s ==> %s\n", __func__, buffer);
|
||||
foo = strlen(buffer);
|
||||
mvaddstr(0, COLS-2-foo, buffer);
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <math.h>
|
||||
#include <getopt.h>
|
||||
#include <ncurses.h>
|
||||
|
||||
@ -21,16 +22,21 @@ float fval;
|
||||
for (loop=0; loop<nbl; loop++) {
|
||||
sval = (short)((loop % 1024)-512);
|
||||
|
||||
foo = aff7segs_short(stdscr, 5, 5, sval);
|
||||
if (foo) message("KRKRK");
|
||||
foo = aff7segs_short(stdscr, 5, 3, sval);
|
||||
if (foo) message("KRKRK aff7 short");
|
||||
|
||||
fval = (float)sval / 1024.0;
|
||||
foo = aff7segs_float(stdscr, 16, 5, fval);
|
||||
if (foo) message("KRKRK");
|
||||
foo = aff7segs_float(stdscr, 16, 3, fval);
|
||||
if (foo) message("KRKRK aff7 float");
|
||||
|
||||
fval = fabs(fval);
|
||||
foo = vumetre_0(stdscr, 29, 5, fval, COLS-10);
|
||||
|
||||
|
||||
sprintf(ligne, "%04x", loop);
|
||||
mvaddstr(2, 1, ligne);
|
||||
refresh();
|
||||
usleep(400*1000);
|
||||
usleep(200*1000);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -12,12 +12,12 @@
|
||||
|
||||
#include "ecran.h"
|
||||
|
||||
int verbosity;
|
||||
extern int verbosity;
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
int vumetre_0(WINDOW *win, int lig, int col, float val, int larg)
|
||||
{
|
||||
int foo, posc;
|
||||
int foo, posc, c;
|
||||
char ligne[100];
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
@ -25,16 +25,24 @@ fprintf(stderr, ">>> %s ( %p %d %d %f %d )\n",
|
||||
__func__, win, lig, col, val, larg);
|
||||
#endif
|
||||
|
||||
posc = (int)(val * (float)larg);
|
||||
posc = (int)(val * (float)(larg-5));
|
||||
|
||||
sprintf(ligne, "%6.3f", val);
|
||||
mvwaddstr(win, lig, 2, ligne);
|
||||
mvwaddstr(win, lig, 0, ligne);
|
||||
|
||||
for (foo=0; foo<larg; foo++) {
|
||||
mvwaddch(win, lig, col+foo, " #"[foo < posc]);
|
||||
if (foo & 1) {
|
||||
mvwaddch(win, lig-1, col+foo, '\\');
|
||||
mvwaddch(win, lig+1, col+foo, '/');
|
||||
c = col + foo + 2;
|
||||
if (foo<posc) {
|
||||
wstandout(win);
|
||||
mvwaddch(win, lig, c, '#');
|
||||
wstandend(win);
|
||||
}
|
||||
else {
|
||||
mvwaddch(win, lig, c, ' ');
|
||||
}
|
||||
if (!(foo%4)) {
|
||||
mvwaddch(win, lig-1, c, '\\');
|
||||
mvwaddch(win, lig+1, c, '/');
|
||||
}
|
||||
}
|
||||
wrefresh(win);
|
||||
|
Loading…
Reference in New Issue
Block a user