Browse Source

+ conversion sortie lm25 -> celsius

master
tth 3 years ago
parent
commit
8989ff558b
5 changed files with 16 additions and 4 deletions
  1. +1
    -1
      serial/essai.sh
  2. +9
    -0
      serial/funcs.c
  3. +2
    -0
      serial/serial.h
  4. +3
    -2
      serial/t.c
  5. +1
    -1
      simulator/rdtemp/rdtemp.ino

+ 1
- 1
serial/essai.sh View File

@ -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}


+ 9
- 0
serial/funcs.c View File

@ -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];


+ 2
- 0
serial/serial.h View File

@ -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]);

+ 3
- 2
serial/t.c View File

@ -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;
}


+ 1
- 1
simulator/rdtemp/rdtemp.ino View File

@ -4,7 +4,7 @@
/* -------------------------------------------------- */
#define NBVAL 4
#define DELAI 5000
#define DELAI 10000
int values[NBVAL];


Loading…
Cancel
Save