slow down the temperatur log to file
This commit is contained in:
parent
6583891486
commit
32f7e6ad70
20
essai.c
20
essai.c
@ -24,7 +24,8 @@ char ligne[200];
|
||||
int Idatas[4];
|
||||
float Fdatas[4];
|
||||
FILE *fp;
|
||||
time_t temps;
|
||||
time_t temps,
|
||||
old_temps = (time_t)0L;
|
||||
|
||||
|
||||
/* XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX */
|
||||
@ -53,18 +54,25 @@ for (idx=0; idx<nbloops; idx++) {
|
||||
|
||||
for (foo=0; foo<3; foo++) {
|
||||
sprintf(ligne, "%4d", Idatas[foo]);
|
||||
minidigit_affstr(stdscr, 6+(12*foo), 8, ligne);
|
||||
aff7segs_float(stdscr, 3+(12*foo), 55, Fdatas[foo]);
|
||||
minidigit_affstr(stdscr, 12+(12*foo), 8, ligne);
|
||||
aff7segs_float(stdscr, 8+(12*foo), 55, Fdatas[foo]);
|
||||
}
|
||||
|
||||
/* here we are trying to log all that temps values */
|
||||
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);
|
||||
if ((temps-old_temps) > 60) {
|
||||
fprintf(fp, "%ld %f %f %f %f\n", temps,
|
||||
Fdatas[0], Fdatas[1], Fdatas[2], Fdatas[3]);
|
||||
fflush(fp);
|
||||
old_temps = temps;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
|
||||
return 0;
|
||||
}
|
||||
/* --------------------------------------------------------------- */
|
||||
|
Loading…
Reference in New Issue
Block a user