une 30aine passés sans pb entre les trames
Dependencies: ADS1015 ARNSRS_SENSORS DmTftLibrary MS5803_14BA SDFileSystem mbed
Fork of ARNSRS_SERVOS_USB_TFT by
Revision 23:40a6039cb140, committed 2017-05-22
- Comitter:
- potless
- Date:
- Mon May 22 23:03:32 2017 +0000
- Parent:
- 22:8e4ace42e4f5
- Commit message:
- freeze : attendre que la ligne soit libre. avec ce code, on passe des commandes ? l'infini sans blocage (attendre affichage d'une trame et passer l'ordre avant l'arriv?e de la suivante)
Changed in this revision
ARNSRS_SENSORS.lib | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 8e4ace42e4f5 -r 40a6039cb140 ARNSRS_SENSORS.lib --- a/ARNSRS_SENSORS.lib Fri May 19 00:01:17 2017 +0000 +++ b/ARNSRS_SENSORS.lib Mon May 22 23:03:32 2017 +0000 @@ -1,1 +1,1 @@ -https://developer.mbed.org/teams/POTLESS/code/ARNSRS_SENSORS/#2f99d82d4961 +https://developer.mbed.org/teams/POTLESS/code/ARNSRS_SENSORS/#d00e8d515c6f
diff -r 8e4ace42e4f5 -r 40a6039cb140 main.cpp --- a/main.cpp Fri May 19 00:01:17 2017 +0000 +++ b/main.cpp Mon May 22 23:03:32 2017 +0000 @@ -259,17 +259,17 @@ //////////////////////////////////////////////////////////////////////////////// -void Servo_USB(char message_Android []) +void Servo_USB() { //Variables pour décomposition du message - char *commande=" "; - char *valeur=" "; + char *commande=" "; + char *valeur=" "; //La commande // un message valide est du type [Sx];yyy avec x numero du servo et yyy compris entre 000 et 100 - - commande = strtok(message_Android, ",;"); + DEBUG("index = %d commande_servo = %s \n", indexCommande, commande_servo); + commande = strtok(commande_servo, ",;"); DEBUG("Commande = %s\n", commande); //La valeur associée @@ -296,9 +296,10 @@ } void callbackServo() -{ +{ - commande_servo [indexCommande++] = serialMonit.getc(); + while(serialMonit.readable()) + commande_servo [indexCommande++] = serialMonit.getc(); } @@ -629,7 +630,11 @@ build_send_Message_float("v", Humi, pression); build_send_Message_float("f", Servo1_POS, Servo2_POS); - if (indexCommande>0) Servo_USB(commande_servo); + if (indexCommande>0){ + Servo_USB(); + strcpy(commande_servo," "); + } + if(FLAG_PAGE_1) { tft.drawNumber(65,35,co2 ,3, false);