code de la carte IHM avant les bugs et avant le travail effectué avec Melchior

Dependencies:   mbed SerialHalfDuplex SDFileSystem liaison_Bluetooth ident_crac DISCO-F469NI_portrait

Revision:
21:d137ec53c3a9
Child:
22:c7763a7ec6c7
diff -r 2f0b1c48a35f -r d137ec53c3a9 IHM/ihm.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/IHM/ihm.cpp	Wed Jun 24 09:39:42 2020 +0000
@@ -0,0 +1,741 @@
+#include "global.h"
+
+#define VERT 0xFF00FF00
+#define ROUGE 0xFFFF0000
+#define BLEU 0xFF0000FF
+#define JAUNE 0xFFFDD835//FEFE00
+#define BLANC 0xFF000000
+#define ORANGE 0xFFFFA500
+#define NOIR 0xFF000000
+#define DIY_GREY 0xFFDFDFDF
+#define VIOLET 0xFF4527A0
+TS_DISCO_F469NI ts;
+LCD_DISCO_F469NI lcd;
+
+
+TS_StateTypeDef TS_State;
+
+
+/////////////////DEFINITION DES BOUTONS////////////////////
+Button COTE_JAUNE(0, 25, 400, 300, "JAUNE");
+Button COTE_VIOLET(0, 350, 400, 300, "VIOLET");
+Button RETOUR  (0, 680, 400, 110, "--Precedent--");
+Button LANCER  (0, 200, 400, 200, "--LANCER--");
+Button CHECK (0, 420, 400, 200, "Valider");
+Button MATCH (0, 50, 400, 320, "Match");
+Button DEMONSTRATION (0, 400, 400, 320, "Demo");
+//menu demo
+Button TEST_VENT(0, 25, 400, 100, "Test ventouses");
+Button TEST_MOT(0, 135, 400, 100, "Test moteur");
+Button TEST_COUL(0,245,400,100,"Test capteurs couleur");
+Button TEST_BRAS(0,355,400,100,"Test Bras");
+Button TEST_AUDIO(0,465,400,100,"Test Audio");
+Button TEST_ELECTRV(0,575,400,100,"Test Divers");
+//menu demo/demo/
+Button TEST_A(0,25,195,100,"A");
+Button TEST_B(205,25,195,100,"B");
+Button TEST_C(0,135,195,100,"C");
+Button TEST_D(205,135,195,100,"D");
+Button TEST_NUM(0,245,400,100,"Bras num");
+Button TEST_PLUS(205,355,195,100,"+");
+Button TEST_MOINS(0,355,195,100,"-");
+
+
+Button FORCE_LAUNCH(0, 50, 400, 320, "Force Launch");
+Button SUIVANT(0,380,200,100,"Suivant");
+////////////////////////////////////////////////////////////
+
+signed char Bouton_Strat (void);
+
+void SelectionStrat (unsigned char numeroStrat);
+
+/****************************************************************************************/
+/* FUNCTION NAME: automate_etat_ihm                                                     */
+/* DESCRIPTION  : Automate de gestion de l'affichage                                    */
+/****************************************************************************************/
+void automate_etat_ihm(void)
+{
+    char toto[2]; 
+    int j;
+    unsigned char maximilien=1;
+    if (j==0) {
+        ts.Init(lcd.GetXSize(), lcd.GetYSize());
+        j++;
+    }
+    ts.GetState(&TS_State);
+    switch (strat_etat_s) {
+        case INIT : //intialise l'écran et passe à l'attente d'initialisation des cartes
+            ts.GetState(&TS_State);
+            canProcessRx();
+            lcd.SetBackColor(LCD_COLOR_WHITE);
+            lcd.SetTextColor(LCD_COLOR_BLACK);
+            lcd.Clear (LCD_COLOR_WHITE);
+            wait(0.15);
+            lcd.DisplayStringAt(0, 10, (uint8_t *)"Verification des cartes", LEFT_MODE);
+            //cartes non verifiées////////////////
+            lcd.SetTextColor(DIY_GREY);
+            lcd.FillRect(0,400,400,150); //carte moteur
+            lcd.FillRect(0,600,400,150); //Balise
+            lcd.SetTextColor(LCD_COLOR_BLACK);
+            lcd.SetBackColor(DIY_GREY);
+            lcd.DisplayStringAt(80, 450, (uint8_t *)"Carte Moteur", LEFT_MODE);
+            lcd.DisplayStringAt(110,650, (uint8_t *)"Balise", LEFT_MODE);
+            ////////////////////////////////////////
+            FORCE_LAUNCH.Draw(0xFFFF0000, 0);
+
+            strat_etat_s=ATT;
+            break;
+
+        case ATT :  //Si les cartes sont présentes passe directement à choix sinon attente de force Launch (cette partie est encore buggée mais les cartes affichent bien leur présence donc faut juste force launch tout le temps...)
+            if (flag_check_carte==1) {
+                strat_etat_s = CHOIX;
+                gameEtat = ETAT_CONFIG;
+            } else if (FORCE_LAUNCH.Touched()) {
+                strat_etat_s = CHOIX;
+                gameEtat = ETAT_CONFIG;
+                while(FORCE_LAUNCH.Touched());
+            }
+
+            break;
+
+
+        case CHOIX :    //Match ou DEMO
+            lcd.SetBackColor(LCD_COLOR_WHITE);
+            lcd.SetTextColor(LCD_COLOR_BLACK);
+            lcd.Clear (LCD_COLOR_WHITE);
+            lcd.DisplayStringAt(0, LINE(0), (uint8_t *)"Match ou demonstration ?", LEFT_MODE);
+            DEMONSTRATION.Draw(LCD_COLOR_LIGHTGREEN, 0);
+            MATCH.Draw(0xFFF01010, 0);
+            while(strat_etat_s == CHOIX) {
+                canProcessRx();
+                if(DEMONSTRATION.Touched()) {
+                    strat_etat_s = DEMO;
+                    while(DEMONSTRATION.Touched());
+                }
+
+                if(MATCH.Touched()) {
+                    strat_etat_s = SELECT_SIDE;
+                    while(MATCH.Touched());
+                }
+
+            }
+            break;
+
+        case DEMO :
+            lcd.SetBackColor(LCD_COLOR_WHITE);
+            lcd.SetTextColor(LCD_COLOR_BLACK);
+            lcd.Clear (LCD_COLOR_WHITE);
+            lcd.DisplayStringAt(0, LINE(0), (uint8_t *)"DEMO", LEFT_MODE);
+            RETOUR.Draw(0xFFFF0000, 0);
+            TEST_VENT.Draw(VERT, 0);
+            TEST_MOT.Draw(VERT, 0);
+            TEST_COUL.Draw(VERT, 0);
+            TEST_BRAS.Draw(VERT, 0);
+            TEST_AUDIO.Draw(VERT, 0);
+            TEST_ELECTRV.Draw(VERT, 0);
+            maximilien=0;
+            while (strat_etat_s == DEMO) {
+                canProcessRx();
+                if(TEST_VENT.Touched()) {
+                    while(TEST_VENT.Touched());
+                    strat_etat_s = TEST_VENTOUSE;
+                } else if(TEST_MOT.Touched()) {
+                    while(TEST_MOT.Touched());
+                    strat_etat_s = TEST_MOTEUR;
+                } else if(TEST_ELECTRV.Touched()) {
+                    while(TEST_ELECTRV.Touched());
+                    strat_etat_s = TEST_ELECTROV;
+                } else if (TEST_COUL.Touched()) {
+                    while(TEST_COUL.Touched());
+                    strat_etat_s =TEST_COULEUR ;
+                } else if (TEST_BRAS.Touched()) {
+                    while(TEST_BRAS.Touched());
+                    strat_etat_s =TEST_SERVO_BRAS ;
+                } else if(TEST_AUDIO.Touched()) {
+                    while(TEST_AUDIO.Touched());
+                    strat_etat_s=TEST_AUD;
+                } else if(RETOUR.Touched()) {
+                    while(RETOUR.Touched());
+                    strat_etat_s = CHOIX;
+                }
+            }
+            break;
+
+
+        case TEST_VENTOUSE:   
+            lcd.SetBackColor(LCD_COLOR_WHITE);
+            lcd.SetTextColor(LCD_COLOR_BLACK);
+            lcd.Clear (LCD_COLOR_WHITE);   
+            lcd.Clear (LCD_COLOR_WHITE);
+            lcd.DisplayStringAt(0, LINE(0), (uint8_t *)"Test Ventouse", LEFT_MODE);
+            sprintf(toto,"%hd",maximilien);
+            lcd.DisplayStringAt(50, LINE(20), (unsigned char *)toto, LEFT_MODE);
+            RETOUR.Draw(0xFFFF0000,0);
+            TEST_A.Draw(BLEU, BLANC);
+            TEST_NUM.Draw(BLEU, BLANC);
+            TEST_PLUS.Draw(BLEU, BLANC);
+            TEST_MOINS.Draw(BLEU, BLANC);
+            while(strat_etat_s==TEST_VENTOUSE) {
+                if(RETOUR.Touched()) {
+                    while (RETOUR.Touched());
+                    strat_etat_s=DEMO;
+                } else if(TEST_A.Touched()) {
+                    while (TEST_A.Touched());
+                    //SendRawId(TEST_VENT_A);
+                    TEST_A.Draw(BLEU, BLANC);
+                }  else if(TEST_NUM.Touched()) {
+                    while (TEST_NUM.Touched());
+                    TEST_NUM.Draw(BLEU, BLANC);
+                    switch(maximilien){
+                    case 1:
+                    SendRawId(TEST_VENT_1_ON);
+                    break;
+                    case 2:
+                    SendRawId(TEST_VENT_1_OFF);
+                    break;
+                    case 3:
+                    //SendRawId(TEST_VENT_3);
+                    break;
+                    case 4:
+                    //SendRawId(TEST_VENT_4);
+                    break;
+                    case 5:
+                    //SendRawId(TEST_VENT_5);
+                    break;
+                    case 6:
+                    //SendRawId(TEST_VENT_6);
+                    break;
+                    }
+                } else if(TEST_PLUS.Touched()) {
+                    while (TEST_PLUS.Touched());
+                    TEST_PLUS.Draw(BLEU, BLANC);
+                    if(maximilien!=6)maximilien++;
+                    sprintf(toto,"%hd",maximilien);
+                    lcd.SetBackColor(LCD_COLOR_WHITE);
+                    lcd.SetTextColor(LCD_COLOR_BLACK);
+                    lcd.DisplayStringAt(50, LINE(20), (unsigned char *)toto, LEFT_MODE);
+                } else if(TEST_MOINS.Touched()) {
+                    while (TEST_MOINS.Touched());
+                    TEST_MOINS.Draw(BLEU, BLANC);
+                    if(maximilien!=1)maximilien--;
+                    sprintf(toto,"%hd",maximilien);
+                    lcd.SetBackColor(LCD_COLOR_WHITE);
+                    lcd.SetTextColor(LCD_COLOR_BLACK);
+                    lcd.DisplayStringAt(50, LINE(20), (unsigned char *)toto, LEFT_MODE);
+                }
+            }
+            break;
+        
+        case TEST_ELECTROV:
+            lcd.SetBackColor(LCD_COLOR_WHITE);
+            lcd.SetTextColor(LCD_COLOR_BLACK);
+            lcd.Clear (LCD_COLOR_WHITE);   
+            lcd.Clear (LCD_COLOR_WHITE);
+            lcd.DisplayStringAt(0, LINE(0), (uint8_t *)"A : Manches B : Pavillon", LEFT_MODE);
+            RETOUR.Draw(0xFFFF0000,0);
+            TEST_A.Draw(BLEU, BLANC);
+            TEST_B.Draw(BLEU, BLANC);
+            while(strat_etat_s==TEST_ELECTROV) {
+                if(RETOUR.Touched()) {
+                    while (RETOUR.Touched());
+                    strat_etat_s=DEMO;
+                } else if(TEST_A.Touched()) {
+                    while (TEST_A.Touched());
+                    //SendRawId(TEST_ELECTROV_A);
+                    TEST_A.Draw(BLEU, BLANC);
+                }  else if(TEST_B.Touched()) {
+                    while (TEST_B.Touched());
+                    //SendRawId(TEST_ELECTROV_A);
+                    TEST_B.Draw(BLEU, BLANC);
+                }  
+            }
+            break;
+            
+        case TEST_AUD:  
+              
+            lcd.SetBackColor(LCD_COLOR_WHITE);
+            lcd.SetTextColor(LCD_COLOR_BLACK);
+            lcd.Clear (LCD_COLOR_WHITE);   
+            lcd.Clear (LCD_COLOR_WHITE);
+            lcd.DisplayStringAt(0, LINE(0), (uint8_t *)"Test Audio", LEFT_MODE);
+            sprintf(toto,"%hd",maximilien);
+            lcd.DisplayStringAt(50, LINE(20), (unsigned char *)toto, LEFT_MODE);
+            RETOUR.Draw(0xFFFF0000,0);
+            TEST_NUM.Draw(BLEU, BLANC);
+            TEST_PLUS.Draw(BLEU, BLANC);
+            TEST_MOINS.Draw(BLEU, BLANC);
+            while(strat_etat_s==TEST_AUD) {
+                if(RETOUR.Touched()) {
+                    while (RETOUR.Touched());
+                    strat_etat_s=DEMO;
+                }  else if(TEST_NUM.Touched()) {
+                    while (TEST_NUM.Touched());
+                    TEST_NUM.Draw(BLEU, BLANC);
+                    Debug_Audio(3,maximilien);
+                } else if(TEST_PLUS.Touched()) {
+                    while (TEST_PLUS.Touched());
+                    TEST_PLUS.Draw(BLEU, BLANC);
+                    if(maximilien!=20)maximilien++;
+                    sprintf(toto,"%hd",maximilien);
+                    lcd.SetBackColor(LCD_COLOR_WHITE);
+                    lcd.SetTextColor(LCD_COLOR_BLACK);
+                    lcd.DisplayStringAt(50, LINE(20), (unsigned char *)toto, LEFT_MODE);
+                } else if(TEST_MOINS.Touched()) {
+                    while (TEST_MOINS.Touched());
+                    TEST_MOINS.Draw(BLEU, BLANC);
+                    if(maximilien!=1)maximilien--;
+                    sprintf(toto,"%hd",maximilien);
+                    lcd.SetBackColor(LCD_COLOR_WHITE);
+                    lcd.SetTextColor(LCD_COLOR_BLACK);
+                    lcd.DisplayStringAt(50, LINE(20), (unsigned char *)toto, LEFT_MODE);
+                }
+            }
+            break;
+            
+        case TEST_SERVO_BRAS:  
+              
+            lcd.SetBackColor(LCD_COLOR_WHITE);
+            lcd.SetTextColor(LCD_COLOR_BLACK);
+            lcd.Clear (LCD_COLOR_WHITE);   
+            lcd.Clear (LCD_COLOR_WHITE);
+            lcd.DisplayStringAt(0, LINE(0), (uint8_t *)"Test Bras", LEFT_MODE);
+            sprintf(toto,"%hd",maximilien);
+            lcd.DisplayStringAt(50, LINE(20), (unsigned char *)toto, LEFT_MODE);
+            RETOUR.Draw(0xFFFF0000,0);
+            TEST_A.Draw(BLEU, BLANC);
+            TEST_B.Draw(BLEU, BLANC);
+            TEST_C.Draw(BLEU, BLANC);
+            TEST_D.Draw(BLEU, BLANC);
+            TEST_NUM.Draw(BLEU, BLANC);
+            TEST_PLUS.Draw(BLEU, BLANC);
+            TEST_MOINS.Draw(BLEU, BLANC);
+            while(strat_etat_s==TEST_SERVO_BRAS) {
+                if(RETOUR.Touched()) {
+                    while (RETOUR.Touched());
+                    strat_etat_s=DEMO;
+                } else if(TEST_A.Touched()) {
+                    while (TEST_A.Touched());
+                    SendRawId(TEST_BRAS_A);
+                    TEST_A.Draw(BLEU, BLANC);
+                } else if(TEST_B.Touched()) {
+                    while (TEST_B.Touched());
+                    SendRawId(TEST_BRAS_B);
+                    TEST_B.Draw(BLEU, BLANC);
+                } else if(TEST_C.Touched()) {
+                    while (TEST_C.Touched());
+                    SendRawId(TEST_BRAS_C);
+                    TEST_C.Draw(BLEU, BLANC);
+                } else if(TEST_D.Touched()) {
+                    while (TEST_D.Touched());
+                    SendRawId(TEST_BRAS_D);
+                    TEST_D.Draw(BLEU, BLANC);
+                }  else if(TEST_NUM.Touched()) {
+                    while (TEST_NUM.Touched());
+                    TEST_NUM.Draw(BLEU, BLANC);
+                    switch(maximilien){
+                    case 1:
+                    SendRawId(TEST_BRAS_1);
+                    break;
+                    case 2:
+                    SendRawId(TEST_BRAS_2);
+                    break;
+                    case 3:
+                    SendRawId(TEST_BRAS_3);
+                    break;
+                    case 4:
+                    SendRawId(TEST_BRAS_4);
+                    break;
+                    case 5:
+                    SendRawId(TEST_BRAS_5);
+                    break;
+                    case 6:
+                    SendRawId(TEST_BRAS_6);
+                    break;
+                    }
+                } else if(TEST_PLUS.Touched()) {
+                    while (TEST_PLUS.Touched());
+                    TEST_PLUS.Draw(BLEU, BLANC);
+                    if(maximilien!=6)maximilien++;
+                    sprintf(toto,"%hd",maximilien);
+                    lcd.SetBackColor(LCD_COLOR_WHITE);
+                    lcd.SetTextColor(LCD_COLOR_BLACK);
+                    lcd.DisplayStringAt(50, LINE(20), (unsigned char *)toto, LEFT_MODE);
+                } else if(TEST_MOINS.Touched()) {
+                    while (TEST_MOINS.Touched());
+                    TEST_MOINS.Draw(BLEU, BLANC);
+                    if(maximilien!=1)maximilien--;
+                    sprintf(toto,"%hd",maximilien);
+                    lcd.SetBackColor(LCD_COLOR_WHITE);
+                    lcd.SetTextColor(LCD_COLOR_BLACK);
+                    lcd.DisplayStringAt(50, LINE(20), (unsigned char *)toto, LEFT_MODE);
+                }
+            }
+            break;
+        
+        case TEST_COULEUR:      
+            lcd.Clear (LCD_COLOR_WHITE);
+            lcd.DisplayStringAt(0, LINE(0), (uint8_t *)"Test Couleur", LEFT_MODE);
+            RETOUR.Draw(0xFFFF0000,0);
+            while(strat_etat_s==TEST_COULEUR) {
+                if(RETOUR.Touched()) {
+                    while (RETOUR.Touched());
+                    strat_etat_s=DEMO;
+                    lcd.Clear (LCD_COLOR_WHITE);
+                } 
+            }
+            break;
+
+        case TEST_MOTEUR:
+            lcd.SetBackColor(LCD_COLOR_WHITE);
+            lcd.SetTextColor(LCD_COLOR_BLACK);
+            lcd.Clear (LCD_COLOR_WHITE);   
+            lcd.Clear (LCD_COLOR_WHITE);
+            lcd.DisplayStringAt(0, LINE(0), (uint8_t *)"Test Moteur", LEFT_MODE);
+            RETOUR.Draw(0xFFFF0000,0);
+            TEST_A.Draw(BLEU, BLANC);
+            TEST_B.Draw(BLEU, BLANC);
+            while(strat_etat_s==TEST_MOTEUR) {
+                if(RETOUR.Touched()) {
+                    while (RETOUR.Touched());
+                    strat_etat_s=DEMO;
+                } else if(TEST_A.Touched()) {
+                    while (TEST_A.Touched());
+                    BendRadius(150,1800,1,0);
+                    TEST_A.Draw(BLEU, BLANC);
+                } else if(TEST_B.Touched()) {
+                    while (TEST_B.Touched());
+                    BendRadius(150,1800,0,0);
+                    TEST_B.Draw(BLEU, BLANC);
+                } 
+            }
+            break;      ///////////////////////////////////////////FIN DES DEMOS/////////////////////////////////////////////////
+
+
+        case SELECT_SIDE :      // CHOIX DU COTE DU TERRAIN + INVERSION DE LA STRAT SI COTE ORANGE+ ENVOI DU COTE A LA CARTE CAPTEUR/ACTIONNEURS
+            lcd.Clear(LCD_COLOR_WHITE);
+            lcd.SetBackColor(LCD_COLOR_WHITE);
+            lcd.SetTextColor(LCD_COLOR_BLACK);
+
+            lcd.DisplayStringAt(70, LINE(0), (uint8_t *)"Choisir le cote", LEFT_MODE);
+            COTE_JAUNE.Draw(JAUNE, 0);
+            COTE_VIOLET.Draw(VIOLET, 0);
+            RETOUR.Draw(LCD_COLOR_RED, 0);
+
+
+            while (strat_etat_s == SELECT_SIDE) {
+                canProcessRx();
+                if(COTE_JAUNE.Touched()) {
+                    Cote = 0x0;
+                    InversStrat = Cote;
+                    strat_etat_s = TACTIQUE;
+                    CANMessage trame_Tx = CANMessage();
+                    trame_Tx.len = 1;
+                    trame_Tx.format = CANStandard;
+                    trame_Tx.type = CANData;
+                    trame_Tx.id=CHOICE_COLOR;
+                    trame_Tx.data[0]=Cote;
+                    can2.write(trame_Tx);
+                    while(COTE_JAUNE.Touched());
+
+                }
+
+                if(COTE_VIOLET.Touched()) {
+                    Cote = 0x1;
+                    InversStrat= Cote;
+                    strat_etat_s = TACTIQUE;
+                    CANMessage trame_Tx = CANMessage();
+                    trame_Tx.len = 1;
+                    trame_Tx.format = CANStandard;
+                    trame_Tx.type = CANData;
+                    trame_Tx.id=CHOICE_COLOR;
+                    trame_Tx.data[0]=Cote;
+                    can2.write(trame_Tx);
+                    while(COTE_VIOLET.Touched());
+                }
+
+                if(RETOUR.Touched()) {
+                    strat_etat_s = CHOIX;
+                    while(RETOUR.Touched());
+                }
+            }
+
+            break;
+
+        case TACTIQUE : //AFFICHE LA LISTE DES STRATS AFIN DE SELECTIONNER CELLE VOULUE
+            if (Cote == 0) {
+                lcd.Clear(JAUNE);
+                lcd.SetBackColor(JAUNE);
+            } else if (Cote == 1) {
+                lcd.Clear(VIOLET);
+                lcd.SetBackColor(VIOLET);
+            } else {
+                lcd.Clear(BLEU);
+                lcd.SetBackColor(BLEU);
+            }
+
+            lcd.SetTextColor(LCD_COLOR_BLACK);
+
+            lcd.DisplayStringAt(20, LINE(0), (uint8_t *)"Choisir une strategie", LEFT_MODE);
+
+            nbStrat = Bouton_Strat(); // retourne valeur de Strategie si bouton strat renvoi -1 on reviens en arriere
+            if (nbStrat == -1) {
+                strat_etat_s = SELECT_SIDE;
+            } else {
+                strat_etat_s = DETAILS;
+            }
+            wait(0.1);
+            break;
+
+        case DETAILS :  //SECONDE VALIDATION DE LA STRAT
+            lcd.Clear(LCD_COLOR_WHITE);
+            lcd.SetBackColor(LCD_COLOR_WHITE);
+            lcd.SetTextColor(LCD_COLOR_BLACK);
+            CHECK.Draw(VERT);
+            RETOUR.Draw(LCD_COLOR_RED);
+
+            SelectionStrat(nbStrat); //affiche la stratégie selectionnée
+
+            while (strat_etat_s == DETAILS) {
+                canProcessRx();
+                if (CHECK.Touched()) {
+                    if(gameEtat == ETAT_CONFIG) {
+                        gameEtat = ETAT_GAME_INIT;
+                        strat_etat_s=LECTURE;
+
+                    }
+                    while(CHECK.Touched());
+                }
+
+                if(RETOUR.Touched()) {
+                    strat_etat_s = TACTIQUE;
+                    while(RETOUR.Touched());
+                }
+            }
+            break;
+
+
+        case LECTURE :
+            break;
+        case AFF_WAIT_JACK : //FONCTIONS D'AFFICHAGE DE L'ATTENTE DU JACK
+            lcd.Clear(BLANC);
+            lcd.SetBackColor(LCD_COLOR_WHITE);
+            lcd.SetTextColor(LCD_COLOR_BLACK);
+
+            if (Cote == 0) {
+                lcd.Clear(VERT);
+                lcd.SetBackColor(VERT);
+            } else if (Cote == 1) {
+                lcd.Clear(ORANGE);
+                lcd.SetBackColor(ORANGE);
+            } else {
+                lcd.Clear(VERT);
+                lcd.SetBackColor(VERT);
+            }
+            canProcessRx();
+            lcd.DisplayStringAt(0, LINE(0), (uint8_t *)"En attente du Jack", CENTER_MODE);
+            strat_etat_s=WAIT_JACK;
+            break;
+
+        case WAIT_JACK: //VERITABLE ATTENTE DU JACK
+            break;
+
+        case FIN :  //AFFICHAGE DE FIN AVEC LE SCORE FINAL
+            lcd.Clear (LCD_COLOR_WHITE);
+            lcd.SetBackColor(LCD_COLOR_WHITE);
+
+
+            while(1); // force le redemarage du robot
+            //break;
+
+    }
+    }
+/****************************************************************************************/
+/* FUNCTION NAME: Bouton_Strat                                                          */
+/* DESCRIPTION  : Sélection de la strat sur le lcd puis envoie sur CAN (à modifier!)    */
+/****************************************************************************************/
+signed char Bouton_Strat (void)
+{
+    char Ack_strat = 0;
+    signed char Strat = 0;
+    Button STRAT_1 (0, 30, 190, 110, strat_sd[0]);
+    Button STRAT_2 (210, 30, 190, 110, strat_sd[1]);
+    Button STRAT_3 (0, 150, 190, 110, strat_sd[2]);
+    Button STRAT_4 (210, 150, 190, 110, strat_sd[3]);
+    Button STRAT_5 (0, 270, 190, 110,strat_sd[4]);
+    Button STRAT_6 (210, 270, 190, 110, strat_sd[5]);
+    Button STRAT_7 (0, 390, 190, 110, strat_sd[6]);
+    Button STRAT_8 (210, 390, 190, 110, strat_sd[7]);
+    Button STRAT_9 (0, 510, 190, 110, strat_sd[8]);
+    Button STRAT_10 (210, 510, 190, 110, strat_sd[9]);
+    Button RETOUR  (0, 680, 400, 110, "--Precedent--");
+    //Definition des boutons
+
+    Ack_strat = 0;
+    Strat = 0;
+    STRAT_1.Draw(0xFFF0F0F0, 0);
+    STRAT_2.Draw(0xFFF0F0F0, 0);
+    STRAT_3.Draw(0xFFF0F0F0, 0);
+    STRAT_4.Draw(0xFFF0F0F0, 0);
+    STRAT_5.Draw(0xFFF0F0F0, 0);
+    STRAT_6.Draw(0xFFF0F0F0, 0);
+    STRAT_7.Draw(0xFFF0F0F0, 0);
+    STRAT_8.Draw(0xFFF0F0F0, 0);
+    STRAT_9.Draw(0xFFF0F0F0, 0);
+    STRAT_10.Draw(0xFFF0F0F0, 0);
+    RETOUR.Draw(0xFFFF0000, 0);
+
+    while(Ack_strat == 0) {
+        canProcessRx();
+        CANMessage msgTx=CANMessage();
+        //msgTx.id=ECRAN_CHOICE_STRAT;
+        if (RETOUR.Touched())
+            return -1;
+        while(RETOUR.Touched());
+        //////////////////////////////STRATEGIE N°1
+        if (STRAT_1.Touched()) {
+            Strat = 0;
+            //msgTx.data[0] = 0x1;
+            //can2.write(msgTx);
+            while(STRAT_1.Touched());
+            Ack_strat =1;
+        }
+        /////////////////////////////STRATEGIE N°2
+        if (STRAT_2.Touched()) {
+            Strat = 1;
+            //msgTx.data[0] = 0x2;
+            //can2.write(msgTx);
+            while(STRAT_2.Touched());
+            Ack_strat =1;
+        }
+        //////////////////////////////STRATEGIE N°3
+        if (STRAT_3.Touched()) {
+            Strat = 2;
+            //msgTx.data[0] = 0x3;
+            //can2.write(msgTx);
+            while(STRAT_3.Touched());
+            Ack_strat =1;
+        }
+        /////////////////////////////STRATEGIE N°4
+        if (STRAT_4.Touched()) {
+            Strat = 3;
+            //msgTx.data[0] = 0x4;
+            //can2.write(msgTx);
+            while(STRAT_4.Touched());
+            Ack_strat =1;
+        }
+        ///////////////////////////////STRATEGIE N°5
+        if (STRAT_5.Touched()) {
+            Strat = 4;
+            //msgTx.data[0] = 0x5;
+            //can2.write(msgTx);
+            while(STRAT_5.Touched());
+            Ack_strat =1;
+        }
+        ////////////////////////////////STRATEGIE N°6
+        if (STRAT_6.Touched()) {
+            Strat = 5;
+            //msgTx.data[0] = 0x6;
+            //can2.write(msgTx);
+            while(STRAT_6.Touched());
+            Ack_strat =1;
+        }
+        /////////////////////////////////STRATEGIE N°7
+        if (STRAT_7.Touched()) {
+            Strat = 6;
+            //msgTx.data[0] = 0x7;
+            //can2.write(msgTx);
+            while(STRAT_7.Touched());
+            Ack_strat =1;
+        }
+        /////////////////////////////////STRATEGIE N°8
+        if (STRAT_8.Touched()) {
+            Strat = 7;
+            //msgTx.data[0] = 0x8;
+            //can2.write(msgTx);
+            while(STRAT_8.Touched());
+            Ack_strat =1;
+        }
+        /////////////////////////////////STRATEGIE N°9
+        if (STRAT_9.Touched()) {
+            Strat = 8;
+            //msgTx.data[0] = 0x9;
+            //can2.write(msgTx);
+            while(STRAT_9.Touched());
+            Ack_strat =1;
+        }
+        ///////////////////////////////////STRATEGIE N°10
+        if (STRAT_10.Touched()) {
+            Strat = 9;
+            //msgTx.data[0] = 0xA;
+            //can2.write(msgTx);
+            while(STRAT_10.Touched());
+            Ack_strat =1;
+        }
+
+    }
+    return Strat;
+
+}
+/****************************************************************************************/
+/* FUNCTION NAME: SelectionStrat                                                        */
+/* DESCRIPTION  : Affiche la Stratégie sélectionnée sur l'ihm                           */
+/****************************************************************************************/
+
+
+void SelectionStrat (unsigned char Strategie)
+{
+    lcd.SetBackColor(LCD_COLOR_WHITE);
+    lcd.SetTextColor(LCD_COLOR_BLACK);
+
+    switch (Strategie+1) {
+        case 0x1 :
+            //description de Strategie n°1
+            lcd.DisplayStringAt(150, 0, (uint8_t *)strat_sd[Strategie], LEFT_MODE);
+            break;
+
+        case 0x2 :
+            //description de Strategie n°2
+            lcd.DisplayStringAt(150,0, (uint8_t *)strat_sd[Strategie], LEFT_MODE);
+            break;
+
+        case 0x3 :
+            //description de Strategie n°3
+            lcd.DisplayStringAt(150,0, (uint8_t *)strat_sd[Strategie], LEFT_MODE);
+            break;
+
+        case 0x4 :
+            //description de Strategie n°4
+            lcd.DisplayStringAt(150,0, (uint8_t *)strat_sd[Strategie], LEFT_MODE);
+            break;
+
+        case 0x5 :
+            //description de Strategie n°5
+            lcd.DisplayStringAt(150,0, (uint8_t *)strat_sd[Strategie], LEFT_MODE);
+            break;
+
+        case 0x6 :
+            //description de Strategie n°5
+            lcd.DisplayStringAt(150,0, (uint8_t *)strat_sd[Strategie], LEFT_MODE);
+            break;
+
+        case 0x7 :
+            //description de Strategie n°5
+            lcd.DisplayStringAt(150,0, (uint8_t *)strat_sd[Strategie], LEFT_MODE);
+            break;
+
+        case 0x8 :
+            //description de Strategie n°5
+            lcd.DisplayStringAt(150,0, (uint8_t *)strat_sd[Strategie], LEFT_MODE);
+            break;
+
+        case 0x9 :
+            //description de Strategie n°5
+            lcd.DisplayStringAt(150,0, (uint8_t *)strat_sd[Strategie], LEFT_MODE);
+            break;
+
+        case 0xA :
+            //description de Strategie n°5
+            lcd.DisplayStringAt(150,0, (uint8_t *)strat_sd[Strategie], LEFT_MODE);
+            break;
+    }
+}
\ No newline at end of file