From 946616e55a049f05381993adb518d6c6b87b4546 Mon Sep 17 00:00:00 2001 From: phyto Date: Wed, 15 May 2019 17:22:44 +0200 Subject: [PATCH] hardware bug found, sorry --- essai.c | 4 +++- plot.sh | 8 +++++--- simulator/rdtemp/cli.ino | 14 ++++++++++++-- simulator/rdtemp/storage.ino | 2 ++ 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/essai.c b/essai.c index 46b6cc6..63ff8f6 100644 --- a/essai.c +++ b/essai.c @@ -125,6 +125,7 @@ int main(int argc, char *argv[]) int opt; int serial_in; char *device = "/dev/ttyACM0"; +char ligne[100]; while ((opt = getopt(argc, argv, "d:hv")) != -1) { switch (opt) { @@ -150,7 +151,8 @@ sleep(1); initscr(); nonl(); cbreak(); noecho(); keypad(stdscr, TRUE); /* acces aux touches 'curseur' */ -fond_ecran(" Demonstrator "); +sprintf(ligne, " Demonstrator %d %s ", getpid(), device); +fond_ecran(ligne); traite_les_messages(serial_in, 50000000); diff --git a/plot.sh b/plot.sh index 031b42c..2718b9a 100755 --- a/plot.sh +++ b/plot.sh @@ -7,10 +7,12 @@ DATAFILE="serial/foo.dat" IMAGE="graphe.png" TMPFILE="/dev/shm/tmpdata" -tail -10000 < ${DATAFILE} > ${TMPFILE} +wc -l ${DATAFILE} + +tail -2500 < ${DATAFILE} > ${TMPFILE} gnuplot << __EOC__ -set term png size 1650,700 +set term png size 1600,800 set output "${IMAGE}" set ytics 2 set xtics @@ -24,6 +26,6 @@ plot "${TMPFILE}" using 1:3 title " inside" with lines, \ "${TMPFILE}" using 1:4 title "ambient" with lines __EOC__ -display ${IMAGE} +display ${IMAGE} & diff --git a/simulator/rdtemp/cli.ino b/simulator/rdtemp/cli.ino index f05b3e2..cc3cf1e 100644 --- a/simulator/rdtemp/cli.ino +++ b/simulator/rdtemp/cli.ino @@ -9,7 +9,6 @@ #define DEBUG 0 /* -------------------------------------------------- */ -/* some interesting macros */ /* -------------------------------------------------- */ char waitkey(char echo) @@ -127,7 +126,18 @@ else { prtln("M frigo OFF"); digitalWrite(RELAIS_FRIGO, LOW); } -prtln("..."); +} +/* --------------------------------------------------------------- */ +void controle_ventilo(char on_off) +{ +if (on_off) { + prtln("M ventilo ON"); + digitalWrite(RELAIS_VENTILO, HIGH); + } +else { + prtln("M ventilo OFF"); + digitalWrite(RELAIS_VENTILO, LOW); + } } /* --------------------------------------------------------------- */ diff --git a/simulator/rdtemp/storage.ino b/simulator/rdtemp/storage.ino index 3e5eff0..ab4f241 100644 --- a/simulator/rdtemp/storage.ino +++ b/simulator/rdtemp/storage.ino @@ -41,6 +41,8 @@ from->control++; EEPROM.put(0, *from); +/* no check of good write here ? */ + return -1; } /* --------------------------------------------------------------- */