From 0ccf834e847138920d5e68146d9bd9e51656475a Mon Sep 17 00:00:00 2001 From: phyto Date: Tue, 21 May 2019 16:29:39 +0200 Subject: [PATCH] il y a clairement une probleme hardware --- build.sh | 4 ++-- serial/serial.c | 2 +- simulator/rdtemp/rdtemp.ino | 3 +-- ui/terminal.c | 8 +++++++- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/build.sh b/build.sh index f2e71f2..5f8b7bb 100755 --- a/build.sh +++ b/build.sh @@ -5,12 +5,12 @@ function build { -echo === $1 === +echo ============= $1 ============== cd $1 make t error=$? cd .. -echo error ${error} +echo === error on $1 = ${error} } # ------------------------------------------------------------------ diff --git a/serial/serial.c b/serial/serial.c index fb94436..0576605 100644 --- a/serial/serial.c +++ b/serial/serial.c @@ -211,7 +211,7 @@ int getline_to(int fd, char *where, int szm, int to_ms) { int curpos, byte, retval; -#if DEBUG_LEVEL +#if DEBUG_LEVEL > 1 fprintf(stderr, ">>> %s ( %d %p %d %d )\n", __func__, fd, where, szm, to_ms); #endif diff --git a/simulator/rdtemp/rdtemp.ino b/simulator/rdtemp/rdtemp.ino index 9514e4e..05f0b24 100644 --- a/simulator/rdtemp/rdtemp.ino +++ b/simulator/rdtemp/rdtemp.ino @@ -33,14 +33,13 @@ void setup() { pinMode(RELAIS_FRIGO, OUTPUT); pinMode(RELAIS_VENTILO, OUTPUT); - Serial.print("\n"); + Serial.print("M booting\n"); /* XXX */ /* changing the voltage reference of the ADC * greatly increase the prcision on the limited * range of our temperatures. */ analogReference(INTERNAL1V1); // Pour Arduino Mega2560 - Serial.print("\n"); read_config(0, ¶metres); // display_config(¶metres); Serial.print("M running now\n"); diff --git a/ui/terminal.c b/ui/terminal.c index caf7be0..5cadaf6 100644 --- a/ui/terminal.c +++ b/ui/terminal.c @@ -4,6 +4,7 @@ #include #include +#include #include #include #include @@ -83,6 +84,11 @@ do { fflush(stderr); } + if ( -1 == received) { /* anti ddos */ + sleep(1); + waddstr(glass, " lost connection ?\n"); + } + if ('\r' != received) waddch(glass, received); } @@ -96,9 +102,9 @@ do { sprintf(ligne, " got $%X '%c'\n", received, isprint(received) ? received : '?'); waddstr(glass, ligne); wrefresh(glass); + sleep(1); #endif - if (0==received) sleep(1); /* anti ddos */ /* que doit-on faire avec ce qu'on vient de recevoir ? */