+ conversion sortie lm25 -> celsius
This commit is contained in:
		
							parent
							
								
									7332f87654
								
							
						
					
					
						commit
						8989ff558b
					
				| @ -5,7 +5,7 @@ DATAFILE="foo.dat" | ||||
| TMPFILE="/tmp/dd2data" | ||||
| 
 | ||||
| IMAGE="graphe.png" | ||||
| NB_READ=50 | ||||
| NB_READ=160 | ||||
| 
 | ||||
| ./t -v -n ${NB_READ} -d ${DEVICE} | tee -a ${DATAFILE} | ||||
| 
 | ||||
|  | ||||
| @ -35,6 +35,15 @@ for (foo=0; foo<4; foo++) { | ||||
| return value; | ||||
| } | ||||
| /* ---------------------------------------------------------------- */ | ||||
| int values2temps(float array[4]) | ||||
| { | ||||
| int	foo; | ||||
| for (foo=0; foo<4; foo++) { | ||||
|  	array[foo] *= (5.0 / 1023.0 * 100.0); | ||||
| 	} | ||||
| return 0; | ||||
| } | ||||
| /* ---------------------------------------------------------------- */ | ||||
| int parse4values(char *line, char cflag, float array[4]) | ||||
| { | ||||
| float		ftmp[4]; | ||||
|  | ||||
| @ -17,6 +17,8 @@ int getline_to(int fd, char *where, int szm, int to_ms); | ||||
| /* auxiliary and test functions */ | ||||
| 
 | ||||
| int parseXvalue(char *asciidatas, char id); | ||||
| int values2temps(float array[4]); | ||||
| 
 | ||||
| int parse4values(char *line, char cflag, float array[4]); | ||||
| 
 | ||||
| 
 | ||||
|  | ||||
| @ -29,7 +29,7 @@ float		datas[4]; | ||||
| for (count=0; count<iters; count++) { | ||||
| 	foo = getline_to(sfd, ligne, 100, 0); | ||||
| 	//
 | ||||
| 	if (verbosity) { | ||||
| 	if (verbosity > 1) { | ||||
| 		fprintf(stderr, "getline #%d -> %d\n", count, foo); | ||||
| 		fprintf(stderr, "%s\n", ligne); | ||||
| 		} | ||||
| @ -37,6 +37,7 @@ for (count=0; count<iters; count++) { | ||||
| 	// 
 | ||||
| 	if (foo >= 0) { | ||||
| 		temps = time(NULL); | ||||
| 		values2temps(datas); | ||||
| 		printf("%ld %f %f %f %f\n", temps, | ||||
| 				datas[0], datas[1], datas[2], datas[3]); | ||||
| 		fflush(stdout); | ||||
| @ -44,7 +45,7 @@ for (count=0; count<iters; count++) { | ||||
| 	else	{ | ||||
| 		fprintf(stderr, "%s: parse -> %d\n", __func__, foo); | ||||
| 		} | ||||
| 	if (verbosity) fprintf(stderr, "\n"); | ||||
| 	if (verbosity > 1) fprintf(stderr, "\n"); | ||||
| 	} | ||||
| return 0; | ||||
| } | ||||
|  | ||||
| @ -4,7 +4,7 @@ | ||||
| /* -------------------------------------------------- */ | ||||
| 
 | ||||
| #define NBVAL   4 | ||||
| #define DELAI   5000 | ||||
| #define DELAI   10000 | ||||
| 
 | ||||
| int   values[NBVAL]; | ||||
| 
 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user