apero du mercredi soir, bugs are coming

This commit is contained in:
phyto 2019-04-03 19:53:15 +02:00
parent 953650c953
commit e6f4bf7a0f
5 changed files with 29 additions and 8 deletions

1
.gitignore vendored
View File

@ -17,6 +17,7 @@ doc/*.ind
*/*.dat
*.png
rrdb/*.png
serial/*.png

22
essai.c
View File

@ -23,6 +23,17 @@ int idx, foo;
char ligne[200];
int Idatas[4];
float Fdatas[4];
FILE *fp;
time_t temps;
/* XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX */
fp = fopen("serial/foo.dat", "a");
if (NULL==fp) {
fprintf(stderr, "***** error fopen datafile *****\n");
return -1;
}
/* XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX */
for (idx=0; idx<nbloops; idx++) {
@ -42,10 +53,17 @@ for (idx=0; idx<nbloops; idx++) {
for (foo=0; foo<3; foo++) {
sprintf(ligne, "%4d", Idatas[foo]);
minidigit_affstr(stdscr, 3+(12*foo), 4, ligne);
minidigit_affstr(stdscr, 6+(12*foo), 8, ligne);
aff7segs_float(stdscr, 3+(12*foo), 55, Fdatas[foo]);
}
if (NULL!=fp) {
temps = time(NULL);
fprintf(fp, "%ld %f %f %f %f\n", temps,
Fdatas[0], Fdatas[1], Fdatas[2], Fdatas[3]);
fflush(fp);
}
}
return 0;
}

10
plot.sh
View File

@ -7,7 +7,7 @@ DATAFILE="serial/foo.dat"
IMAGE="graphe.png"
TMPFILE="/tmp/tmpdata"
tail -400 < ${DATAFILE} > ${TMPFILE}
tail -700 < ${DATAFILE} > ${TMPFILE}
gnuplot << __EOC__
set term png size 1000,700
@ -15,13 +15,13 @@ set output "${IMAGE}"
set ytics 2
set xtics
set grid front
set title "* Temperatures *"
set title "* Temperatures du Phytotron *"
set xdata time
set timefmt "%s"
set format x "%d\n%H:%M"
set format x "%b %d\n%H:%M"
set yrange [ 0.0 : 30.0 ]
plot "${TMPFILE}" using 1:3 title "ambient" with lines, \
"${TMPFILE}" using 1:4 title " inside" with lines
plot "${TMPFILE}" using 1:3 title " inside" with lines, \
"${TMPFILE}" using 1:4 title "ambient" with lines
__EOC__
display ${IMAGE}

View File

@ -1,6 +1,6 @@
#!/bin/bash
DEVICE="/dev/ttyACM1"
DEVICE="/dev/ttyACM0"
DATAFILE="foo.dat"
TMPFILE="/tmp/dd2data"

View File

@ -5,11 +5,13 @@
int fond_ecran(char *titre);
int message(char *);
int aff7segs_base(WINDOW * win, int lig, int col, int bits, int k);
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);
int minidigit_affstr(WINDOW *win, int lig, int col, char *str);
int minidigit_HMS(WINDOW *win, int lig, int col, int k);