diff --git a/simulator/rdtemp/rdtemp.ino b/simulator/rdtemp/rdtemp.ino index 3d24882..6e2fb37 100644 --- a/simulator/rdtemp/rdtemp.ino +++ b/simulator/rdtemp/rdtemp.ino @@ -101,25 +101,41 @@ void sendvalues(short *ptr) prt('\n'); } /* -------------------------------------------------- */ -void update_and_send(void) +void update_and_send(short *pvalues) { - short values[NBVAL]; - updatevalues(values); - sendvalues(values); + updatevalues(pvalues); + sendvalues(pvalues); } /* ================================================== */ void loop() { static int foo = 0; int key; + short values[NBVAL], temp_interne; + - update_and_send(); + update_and_send(values); + + temp_interne = values[1]; + if (temp_interne < parametres.temp_mini) { + prtln("M temp is low"); + delay(500); + controle_frigo(0); + } + else if (temp_interne > parametres.temp_maxi){ + prtln("M temp is hight"); + delay(500); + controle_frigo(1); + } + if (foo++ > 5) { readlight(); foo = 0; } + + /* check for external request */ if (Serial.available()) { key = Serial.read(); @@ -146,6 +162,9 @@ void loop() { break; } } + + + delay(parametres.delai); /* ETERNAL LOOP END HERE */ diff --git a/ui/terminal.c b/ui/terminal.c index 44c9f82..35301d9 100644 --- a/ui/terminal.c +++ b/ui/terminal.c @@ -46,7 +46,7 @@ wclear(glass); wrefresh(glass); mfd = (fd_local>fd_remote ? fd_local : fd_remote) + 1; /* XXX */ -#if DEBUG_LEVEL +#if DEBUG_LEVEL > 1 sprintf(ligne, "%s : mfd is %d\n", __func__, mfd); waddstr(glass, ligne); wrefresh(glass); #endif