Browse Source

apero du mercredi soir, bugs are coming

phyto 1 year ago
parent
commit
e6f4bf7a0f
5 changed files with 29 additions and 8 deletions
  1. 1
    0
      .gitignore
  2. 20
    2
      essai.c
  3. 5
    5
      plot.sh
  4. 1
    1
      serial/essai.sh
  5. 2
    0
      viz/curses/ecran.h

+ 1
- 0
.gitignore View File

@@ -17,6 +17,7 @@ doc/*.ind
17 17
 
18 18
 */*.dat
19 19
 
20
+*.png
20 21
 rrdb/*.png
21 22
 serial/*.png
22 23
 

+ 20
- 2
essai.c View File

@@ -23,6 +23,17 @@ int		idx, foo;
23 23
 char		ligne[200];
24 24
 int		Idatas[4];
25 25
 float		Fdatas[4];
26
+FILE		*fp;
27
+time_t		temps;
28
+
29
+
30
+/* XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX */
31
+fp = fopen("serial/foo.dat", "a");
32
+if (NULL==fp) {
33
+	fprintf(stderr, "***** error fopen datafile *****\n");
34
+	return -1;
35
+	}
36
+/* XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX */
26 37
 
27 38
 for (idx=0; idx<nbloops; idx++) {
28 39
 
@@ -42,10 +53,17 @@ for (idx=0; idx<nbloops; idx++) {
42 53
 
43 54
 	for (foo=0; foo<3; foo++) {
44 55
 		sprintf(ligne, "%4d", Idatas[foo]);
45
-		minidigit_affstr(stdscr, 3+(12*foo), 4, ligne);
46
-
56
+		minidigit_affstr(stdscr, 6+(12*foo), 8, ligne);
47 57
 		aff7segs_float(stdscr, 3+(12*foo), 55, Fdatas[foo]);
48 58
 		}
59
+
60
+	if (NULL!=fp) {	
61
+		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);
65
+		}
66
+
49 67
 	}
50 68
 return 0;
51 69
 }

+ 5
- 5
plot.sh View File

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

+ 1
- 1
serial/essai.sh View File

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

+ 2
- 0
viz/curses/ecran.h View File

@@ -5,11 +5,13 @@
5 5
 int fond_ecran(char *titre);
6 6
 int message(char *);
7 7
 
8
+
8 9
 int aff7segs_base(WINDOW * win, int lig, int col, int bits, int k);
9 10
 int aff7segs_digit(WINDOW * win, int lig, int col, char digit);
10 11
 int aff7segs_short(WINDOW * win, int lig, int col, short value);
11 12
 int aff7segs_float(WINDOW * win, int lig, int col, float value);
12 13
 
14
+
13 15
 int minidigit_0(WINDOW *win, int lig, int col, char digit, int k);
14 16
 int minidigit_affstr(WINDOW *win, int lig, int col, char *str);
15 17
 int minidigit_HMS(WINDOW *win, int lig, int col, int k);

Loading…
Cancel
Save