working on serial protocol

This commit is contained in:
tth 2019-01-28 14:42:33 +01:00
부모 054d0f574c
커밋 15c6cbd8ae
5개의 변경된 파일25개의 추가작업 그리고 7개의 파일을 삭제

파일 보기

@ -28,6 +28,8 @@ ne bloque pas, c'est un peu ironique.
Après un peu plus d'investigation, j'en arrive à conclure qu'il y a
plein de subtilités entre les diverses variantes d'Arduino. Mais pas que.
Je pense que les quatre ports série supplémentaires de l'Arduino Mega
seront moins capricieux.

파일 보기

@ -5,18 +5,18 @@ DATAFILE="foo.dat"
TMPFILE="/tmp/dd2data"
IMAGE="graphe.png"
NB_READ=25000
NB_READ=25
./t -v -n ${NB_READ} -d ${DEVICE} | tee -a ${DATAFILE}
./t -vv -n ${NB_READ} -d ${DEVICE} | tee -a ${DATAFILE}
gnuplot << __EOC__
set term png size 3200,512
set output "${IMAGE}"
set grid
set title "Dans le Double Dragon 2"
set title "Temperature dans le Double Dragon 2"
set xdata time
set timefmt "%s"
set format x "%H:%M:%S"
set format x "%a, %H:%M:%S"
set yrange [ 5.0 : 30.0]
plot "${DATAFILE}" using 1:2 title " foo" with lines, \
"${DATAFILE}" using 1:3 title " bar" with lines, \

파일 보기

@ -7,6 +7,10 @@
extern int verbosity;
/* ---------------------------------------------------------------- */
/*
* compute the integer mean value of a four values
* tagged lines.
*/
int parseXvalue(char *line, char cflag)
{
int value, foo;
@ -32,10 +36,17 @@ if (4 != foo) {
for (foo=0; foo<4; foo++) {
value += vrd[foo];
}
value /= 4;
return value;
}
/* ---------------------------------------------------------------- */
int values2temps(float array[4])
/*
* this fonction is specific to the LM35 thermo-sensor
* connected to a ADC pin of an Arduino Mega
*/
int values2temperature(float array[4])
{
int foo;
for (foo=0; foo<4; foo++) {

파일 보기

@ -17,7 +17,7 @@ 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 values2temperature(float array[4]);
int parse4values(char *line, char cflag, float array[4]);

파일 보기

@ -37,7 +37,7 @@ for (count=0; count<iters; count++) {
//
if (foo >= 0) {
temps = time(NULL);
values2temps(datas);
values2temperature(datas);
printf("%ld %f %f %f %f\n", temps,
datas[0], datas[1], datas[2], datas[3]);
fflush(stdout);
@ -75,6 +75,11 @@ while ((opt = getopt(argc, argv, "d:n:v")) != -1) {
}
if (verbosity) {
fprintf(stderr, "Testing Serial Software - compiled " \
__DATE__ " " __TIME__ "\n");
}
serial_in = prepare_UART(device, speed);
if (serial_in < 0) {
fprintf(stderr, "%s : open device : error %d on %s\n",