Browse Source

slow down the temperatur log to file

phyto 1 year ago
parent
commit
32f7e6ad70
1 changed files with 14 additions and 6 deletions
  1. 14
    6
      essai.c

+ 14
- 6
essai.c View File

@@ -24,7 +24,8 @@ char		ligne[200];
24 24
 int		Idatas[4];
25 25
 float		Fdatas[4];
26 26
 FILE		*fp;
27
-time_t		temps;
27
+time_t		temps,
28
+		old_temps = (time_t)0L;
28 29
 
29 30
 
30 31
 /* XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX */
@@ -53,18 +54,25 @@ for (idx=0; idx<nbloops; idx++) {
53 54
 
54 55
 	for (foo=0; foo<3; foo++) {
55 56
 		sprintf(ligne, "%4d", Idatas[foo]);
56
-		minidigit_affstr(stdscr, 6+(12*foo), 8, ligne);
57
-		aff7segs_float(stdscr, 3+(12*foo), 55, Fdatas[foo]);
57
+		minidigit_affstr(stdscr, 12+(12*foo), 8, ligne);
58
+		aff7segs_float(stdscr, 8+(12*foo), 55, Fdatas[foo]);
58 59
 		}
59 60
 
61
+	/* here we are trying to log all that temps values */
60 62
 	if (NULL!=fp) {	
61 63
 		temps = time(NULL);
62
-		fprintf(fp, "%ld %f %f %f %f\n", temps,
63
-			Fdatas[0], Fdatas[1], Fdatas[2], Fdatas[3]);
64
-		fflush(fp);
64
+		if ((temps-old_temps) > 60) {
65
+			fprintf(fp, "%ld %f %f %f %f\n", temps,
66
+				Fdatas[0], Fdatas[1], Fdatas[2], Fdatas[3]);
67
+			fflush(fp);
68
+			old_temps = temps;
69
+			}
65 70
 		}
66 71
 
67 72
 	}
73
+
74
+fclose(fp);
75
+
68 76
 return 0;
69 77
 }
70 78
 /* --------------------------------------------------------------- */

Loading…
Cancel
Save