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

Committer:
goldmas
Date:
Fri May 21 16:19:18 2021 +0000
Revision:
35:2a745eeb7922
Parent:
34:c314feaa0d3e
Child:
36:c37dbe2be916
comptage point marche avant ok mais pas marche arriere

Who changed what in which revision?

UserRevisionLine numberNew contents of line
gabrieltetar 21:d137ec53c3a9 1 #include "global.h"
gabrieltetar 21:d137ec53c3a9 2
goldmas 35:2a745eeb7922 3 #define M_PI 3.14159265358979323846
goldmas 35:2a745eeb7922 4
gabrieltetar 21:d137ec53c3a9 5 #define VERT 0xFF00FF00
gabrieltetar 21:d137ec53c3a9 6 #define ROUGE 0xFFFF0000
gabrieltetar 21:d137ec53c3a9 7 #define BLEU 0xFF0000FF
gabrieltetar 21:d137ec53c3a9 8 #define JAUNE 0xFFFDD835//FEFE00
gabrieltetar 21:d137ec53c3a9 9 #define BLANC 0xFF000000
gabrieltetar 21:d137ec53c3a9 10 #define ORANGE 0xFFFFA500
gabrieltetar 21:d137ec53c3a9 11 #define NOIR 0xFF000000
gabrieltetar 21:d137ec53c3a9 12 #define DIY_GREY 0xFFDFDFDF
gabrieltetar 21:d137ec53c3a9 13 #define VIOLET 0xFF4527A0
gabrieltetar 27:ff70537a7619 14 #define VERT_F 0xFF00C400
goldmas 35:2a745eeb7922 15 #define VIOLET_F 0x788000FF
gabrieltetar 21:d137ec53c3a9 16 TS_DISCO_F469NI ts;
gabrieltetar 21:d137ec53c3a9 17 LCD_DISCO_F469NI lcd;
gabrieltetar 21:d137ec53c3a9 18
gabrieltetar 21:d137ec53c3a9 19
gabrieltetar 21:d137ec53c3a9 20 TS_StateTypeDef TS_State;
gabrieltetar 21:d137ec53c3a9 21
gabrieltetar 21:d137ec53c3a9 22
gabrieltetar 21:d137ec53c3a9 23 /////////////////DEFINITION DES BOUTONS////////////////////
gabrieltetar 21:d137ec53c3a9 24 Button COTE_JAUNE(0, 25, 400, 300, "JAUNE");
goldmas 33:c54841d11156 25 Button COTE_VIOLET(0, 350, 400, 300, "BLEU");
gabrieltetar 21:d137ec53c3a9 26 Button RETOUR (0, 680, 400, 110, "--Precedent--");
gabrieltetar 21:d137ec53c3a9 27 Button LANCER (0, 200, 400, 200, "--LANCER--");
gabrieltetar 21:d137ec53c3a9 28 Button CHECK (0, 420, 400, 200, "Valider");
gabrieltetar 21:d137ec53c3a9 29 Button MATCH (0, 50, 400, 320, "Match");
gabrieltetar 21:d137ec53c3a9 30 Button DEMONSTRATION (0, 400, 400, 320, "Demo");
gabrieltetar 21:d137ec53c3a9 31 //menu demo
gabrieltetar 21:d137ec53c3a9 32 Button TEST_VENT(0, 25, 400, 100, "Test ventouses");
gabrieltetar 21:d137ec53c3a9 33 Button TEST_MOT(0, 135, 400, 100, "Test moteur");
gabrieltetar 21:d137ec53c3a9 34 Button TEST_COUL(0,245,400,100,"Test capteurs couleur");
gabrieltetar 21:d137ec53c3a9 35 Button TEST_BRAS(0,355,400,100,"Test Bras");
gabrieltetar 21:d137ec53c3a9 36 Button TEST_AUDIO(0,465,400,100,"Test Audio");
gabrieltetar 22:c7763a7ec6c7 37
gabrieltetar 22:c7763a7ec6c7 38 Button TEST_NEXT(0,575,400,100,"------>");
gabrieltetar 22:c7763a7ec6c7 39 Button TEST_DIV(0,25,400,100,"Test Divers");
gabrieltetar 22:c7763a7ec6c7 40 Button TEST_ASSERV(0, 135, 400, 100, "Test asserv");
gabrieltetar 21:d137ec53c3a9 41 //menu demo/demo/
gabrieltetar 21:d137ec53c3a9 42 Button TEST_A(0,25,195,100,"A");
gabrieltetar 21:d137ec53c3a9 43 Button TEST_B(205,25,195,100,"B");
gabrieltetar 21:d137ec53c3a9 44 Button TEST_C(0,135,195,100,"C");
gabrieltetar 21:d137ec53c3a9 45 Button TEST_D(205,135,195,100,"D");
gabrieltetar 22:c7763a7ec6c7 46 Button TEST_NUM(0,245,400,100,"Num");
goldmas 32:7f8e3ee2adac 47 Button TEST_ATTRAPER(0,300,400,100,"Attraper");
goldmas 32:7f8e3ee2adac 48 Button TEST_RELACHER(0,450,400,100,"Relacher");
goldmas 32:7f8e3ee2adac 49
gabrieltetar 21:d137ec53c3a9 50 Button TEST_PLUS(205,355,195,100,"+");
gabrieltetar 21:d137ec53c3a9 51 Button TEST_MOINS(0,355,195,100,"-");
goldmas 34:c314feaa0d3e 52 Button TEST_SERVO_0(280,50,120,100,"Bras 0");
goldmas 32:7f8e3ee2adac 53 Button TEST_SERVO_1(140,50,120,100,"Bras 1");
goldmas 34:c314feaa0d3e 54 Button TEST_SERVO_2(0,50,120,100,"Bras 2");
goldmas 32:7f8e3ee2adac 55 Button TEST_SERVO_3(0,160,120,100,"Bras 3");
goldmas 32:7f8e3ee2adac 56 Button TEST_SERVO_4(140,160,120,100,"Bras 4");
goldmas 32:7f8e3ee2adac 57 Button TEST_SERVO_5(280,160,120,100,"Bras 5");
goldmas 34:c314feaa0d3e 58
goldmas 34:c314feaa0d3e 59 Button TEST_VENT_0(280,50,120,100,"Vent 0");
goldmas 34:c314feaa0d3e 60 Button TEST_VENT_1(140,50,120,100,"Vent 1");
goldmas 34:c314feaa0d3e 61 Button TEST_VENT_2(0,50,120,100,"Vent 2");
goldmas 34:c314feaa0d3e 62 Button TEST_VENT_3(0,160,120,100,"Vent 3");
goldmas 34:c314feaa0d3e 63 Button TEST_VENT_4(140,160,120,100,"Vent 4");
goldmas 34:c314feaa0d3e 64 Button TEST_VENT_5(280,160,120,100,"Vent 5");
goldmas 34:c314feaa0d3e 65
gabrieltetar 22:c7763a7ec6c7 66 Button FORCE_LAUNCH(0, 600, 400, 100, "Force Launch");
gabrieltetar 21:d137ec53c3a9 67 Button SUIVANT(0,380,200,100,"Suivant");
gabrieltetar 21:d137ec53c3a9 68 ////////////////////////////////////////////////////////////
gabrieltetar 24:1a13c998c7ac 69
gabrieltetar 21:d137ec53c3a9 70 signed char Bouton_Strat (void);
gabrieltetar 27:ff70537a7619 71 void DrawC (int l,int h,int x, int y, unsigned char fill);
gabrieltetar 27:ff70537a7619 72 void DrawR (int l,int h,int x, int y, unsigned char fill);
gabrieltetar 27:ff70537a7619 73 void DrawA (int l,int h,int x, int y, unsigned char fill);
gabrieltetar 24:1a13c998c7ac 74
gabrieltetar 21:d137ec53c3a9 75 void SelectionStrat (unsigned char numeroStrat);
gabrieltetar 21:d137ec53c3a9 76
gabrieltetar 21:d137ec53c3a9 77 /****************************************************************************************/
gabrieltetar 21:d137ec53c3a9 78 /* FUNCTION NAME: automate_etat_ihm */
gabrieltetar 21:d137ec53c3a9 79 /* DESCRIPTION : Automate de gestion de l'affichage */
gabrieltetar 21:d137ec53c3a9 80 /****************************************************************************************/
gabrieltetar 21:d137ec53c3a9 81 void automate_etat_ihm(void)
gabrieltetar 21:d137ec53c3a9 82 {
goldmas 32:7f8e3ee2adac 83 char toto[12];
goldmas 35:2a745eeb7922 84 int j, old_time=0, actual_time=0, old_score=0, actual_score=0, unique=0;
goldmas 32:7f8e3ee2adac 85 unsigned char maximilien=1, choix_groupe;
gabrieltetar 21:d137ec53c3a9 86 if (j==0) {
gabrieltetar 21:d137ec53c3a9 87 ts.Init(lcd.GetXSize(), lcd.GetYSize());
gabrieltetar 21:d137ec53c3a9 88 j++;
gabrieltetar 21:d137ec53c3a9 89 }
gabrieltetar 21:d137ec53c3a9 90 ts.GetState(&TS_State);
gabrieltetar 21:d137ec53c3a9 91 switch (strat_etat_s) {
gabrieltetar 24:1a13c998c7ac 92 case INIT : //intialise l'écran et passe à l'attente d'initialisation des cartes
gabrieltetar 21:d137ec53c3a9 93 ts.GetState(&TS_State);
gabrieltetar 22:c7763a7ec6c7 94 canProcessRx();
gabrieltetar 24:1a13c998c7ac 95 lcd.SetBackColor(LCD_COLOR_WHITE);
gabrieltetar 24:1a13c998c7ac 96 lcd.SetTextColor(LCD_COLOR_BLACK);
gabrieltetar 24:1a13c998c7ac 97 lcd.Clear (LCD_COLOR_WHITE);
gabrieltetar 24:1a13c998c7ac 98 wait(0.15);
gabrieltetar 27:ff70537a7619 99 DrawC(95,150,0,50,0);
gabrieltetar 27:ff70537a7619 100 DrawR(95,150,105,50,0);
gabrieltetar 27:ff70537a7619 101 DrawA(95,150,210,50,0);
gabrieltetar 27:ff70537a7619 102 DrawC(95,150,315,50,0);
gabrieltetar 27:ff70537a7619 103 DrawCheck(30,30,50,243,0);
gabrieltetar 27:ff70537a7619 104 DrawCheck(30,30,50,293,0);
gabrieltetar 27:ff70537a7619 105 DrawCheck(30,30,50,343,0);
gabrieltetar 27:ff70537a7619 106 DrawCheck(30,30,50,393,0);
gabrieltetar 27:ff70537a7619 107 lcd.DisplayStringAt(100, 250, (uint8_t *)"Init CAN", LEFT_MODE);
slowness 29:ff575aff301f 108 DrawCheck(30,30,50,243,can_present);
gabrieltetar 27:ff70537a7619 109 lcd.DisplayStringAt(100, 300, (uint8_t *)"Micro SD", LEFT_MODE);
slowness 29:ff575aff301f 110 DrawCheck(30,30,50,293,sd_present);
gabrieltetar 27:ff70537a7619 111 lcd.DisplayStringAt(100, 350, (uint8_t *)"Carte Moteur", LEFT_MODE);
gabrieltetar 27:ff70537a7619 112 lcd.DisplayStringAt(100, 400, (uint8_t *)"Balise IR", LEFT_MODE);
gabrieltetar 24:1a13c998c7ac 113 FORCE_LAUNCH.Draw(0xFFFF0000, 0);
gabrieltetar 24:1a13c998c7ac 114
gabrieltetar 24:1a13c998c7ac 115 strat_etat_s=ATT;
gabrieltetar 24:1a13c998c7ac 116 break;
gabrieltetar 24:1a13c998c7ac 117
gabrieltetar 24:1a13c998c7ac 118 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...)
gabrieltetar 24:1a13c998c7ac 119 if (flag_check_carte==1) {
gabrieltetar 24:1a13c998c7ac 120 strat_etat_s = CHOIX;
gabrieltetar 24:1a13c998c7ac 121 gameEtat = ETAT_CONFIG;
gabrieltetar 24:1a13c998c7ac 122 } else if (FORCE_LAUNCH.Touched()) {
gabrieltetar 24:1a13c998c7ac 123 strat_etat_s = CHOIX;
gabrieltetar 24:1a13c998c7ac 124 gameEtat = ETAT_CONFIG;
gabrieltetar 24:1a13c998c7ac 125 while(FORCE_LAUNCH.Touched());
gabrieltetar 21:d137ec53c3a9 126 }
gabrieltetar 24:1a13c998c7ac 127
gabrieltetar 21:d137ec53c3a9 128 break;
gabrieltetar 24:1a13c998c7ac 129
gabrieltetar 24:1a13c998c7ac 130
gabrieltetar 21:d137ec53c3a9 131 case CHOIX : //Match ou DEMO
gabrieltetar 21:d137ec53c3a9 132 lcd.SetBackColor(LCD_COLOR_WHITE);
gabrieltetar 21:d137ec53c3a9 133 lcd.SetTextColor(LCD_COLOR_BLACK);
gabrieltetar 21:d137ec53c3a9 134 lcd.Clear (LCD_COLOR_WHITE);
gabrieltetar 21:d137ec53c3a9 135 lcd.DisplayStringAt(0, LINE(0), (uint8_t *)"Match ou demonstration ?", LEFT_MODE);
gabrieltetar 21:d137ec53c3a9 136 DEMONSTRATION.Draw(LCD_COLOR_LIGHTGREEN, 0);
gabrieltetar 21:d137ec53c3a9 137 MATCH.Draw(0xFFF01010, 0);
gabrieltetar 21:d137ec53c3a9 138 while(strat_etat_s == CHOIX) {
gabrieltetar 21:d137ec53c3a9 139 canProcessRx();
gabrieltetar 21:d137ec53c3a9 140 if(DEMONSTRATION.Touched()) {
gabrieltetar 21:d137ec53c3a9 141 strat_etat_s = DEMO;
gabrieltetar 21:d137ec53c3a9 142 while(DEMONSTRATION.Touched());
gabrieltetar 21:d137ec53c3a9 143 }
gabrieltetar 21:d137ec53c3a9 144
gabrieltetar 21:d137ec53c3a9 145 if(MATCH.Touched()) {
gabrieltetar 21:d137ec53c3a9 146 strat_etat_s = SELECT_SIDE;
gabrieltetar 21:d137ec53c3a9 147 while(MATCH.Touched());
gabrieltetar 21:d137ec53c3a9 148 }
gabrieltetar 21:d137ec53c3a9 149
gabrieltetar 21:d137ec53c3a9 150 }
gabrieltetar 21:d137ec53c3a9 151 break;
gabrieltetar 21:d137ec53c3a9 152
gabrieltetar 21:d137ec53c3a9 153 case DEMO :
gabrieltetar 21:d137ec53c3a9 154 lcd.SetBackColor(LCD_COLOR_WHITE);
gabrieltetar 21:d137ec53c3a9 155 lcd.SetTextColor(LCD_COLOR_BLACK);
gabrieltetar 21:d137ec53c3a9 156 lcd.Clear (LCD_COLOR_WHITE);
gabrieltetar 22:c7763a7ec6c7 157 lcd.DisplayStringAt(0, LINE(0), (uint8_t *)"DEMO 1/2", LEFT_MODE);
gabrieltetar 21:d137ec53c3a9 158 RETOUR.Draw(0xFFFF0000, 0);
gabrieltetar 21:d137ec53c3a9 159 TEST_VENT.Draw(VERT, 0);
gabrieltetar 21:d137ec53c3a9 160 TEST_MOT.Draw(VERT, 0);
gabrieltetar 21:d137ec53c3a9 161 TEST_COUL.Draw(VERT, 0);
gabrieltetar 21:d137ec53c3a9 162 TEST_BRAS.Draw(VERT, 0);
gabrieltetar 21:d137ec53c3a9 163 TEST_AUDIO.Draw(VERT, 0);
gabrieltetar 22:c7763a7ec6c7 164 TEST_NEXT.Draw(BLEU, 0);
gabrieltetar 21:d137ec53c3a9 165 maximilien=0;
gabrieltetar 21:d137ec53c3a9 166 while (strat_etat_s == DEMO) {
gabrieltetar 21:d137ec53c3a9 167 canProcessRx();
gabrieltetar 21:d137ec53c3a9 168 if(TEST_VENT.Touched()) {
gabrieltetar 21:d137ec53c3a9 169 while(TEST_VENT.Touched());
gabrieltetar 21:d137ec53c3a9 170 strat_etat_s = TEST_VENTOUSE;
gabrieltetar 21:d137ec53c3a9 171 } else if(TEST_MOT.Touched()) {
gabrieltetar 21:d137ec53c3a9 172 while(TEST_MOT.Touched());
gabrieltetar 21:d137ec53c3a9 173 strat_etat_s = TEST_MOTEUR;
gabrieltetar 22:c7763a7ec6c7 174 } else if(TEST_NEXT.Touched()) {
gabrieltetar 22:c7763a7ec6c7 175 while(TEST_NEXT.Touched());
gabrieltetar 22:c7763a7ec6c7 176 strat_etat_s = DEMO2;
gabrieltetar 21:d137ec53c3a9 177 } else if (TEST_COUL.Touched()) {
gabrieltetar 21:d137ec53c3a9 178 while(TEST_COUL.Touched());
gabrieltetar 21:d137ec53c3a9 179 strat_etat_s =TEST_COULEUR ;
gabrieltetar 21:d137ec53c3a9 180 } else if (TEST_BRAS.Touched()) {
gabrieltetar 21:d137ec53c3a9 181 while(TEST_BRAS.Touched());
gabrieltetar 21:d137ec53c3a9 182 strat_etat_s =TEST_SERVO_BRAS ;
gabrieltetar 21:d137ec53c3a9 183 } else if(TEST_AUDIO.Touched()) {
gabrieltetar 21:d137ec53c3a9 184 while(TEST_AUDIO.Touched());
gabrieltetar 21:d137ec53c3a9 185 strat_etat_s=TEST_AUD;
gabrieltetar 21:d137ec53c3a9 186 } else if(RETOUR.Touched()) {
gabrieltetar 21:d137ec53c3a9 187 while(RETOUR.Touched());
gabrieltetar 21:d137ec53c3a9 188 strat_etat_s = CHOIX;
gabrieltetar 21:d137ec53c3a9 189 }
gabrieltetar 21:d137ec53c3a9 190 }
gabrieltetar 21:d137ec53c3a9 191 break;
gabrieltetar 24:1a13c998c7ac 192
gabrieltetar 24:1a13c998c7ac 193 case DEMO2 :
gabrieltetar 22:c7763a7ec6c7 194 lcd.SetBackColor(LCD_COLOR_WHITE);
gabrieltetar 22:c7763a7ec6c7 195 lcd.SetTextColor(LCD_COLOR_BLACK);
gabrieltetar 22:c7763a7ec6c7 196 lcd.Clear (LCD_COLOR_WHITE);
gabrieltetar 22:c7763a7ec6c7 197 lcd.DisplayStringAt(0, LINE(0), (uint8_t *)"DEMO 2/2", LEFT_MODE);
gabrieltetar 22:c7763a7ec6c7 198 RETOUR.Draw(0xFFFF0000, 0);
gabrieltetar 22:c7763a7ec6c7 199 TEST_DIV.Draw(VERT, 0);
gabrieltetar 22:c7763a7ec6c7 200 TEST_ASSERV.Draw(VERT, 0);
gabrieltetar 22:c7763a7ec6c7 201 TEST_NEXT.Draw(BLEU, 0);
gabrieltetar 22:c7763a7ec6c7 202 maximilien=0;
gabrieltetar 22:c7763a7ec6c7 203 while (strat_etat_s == DEMO2) {
gabrieltetar 22:c7763a7ec6c7 204 canProcessRx();
gabrieltetar 22:c7763a7ec6c7 205 if(TEST_NEXT.Touched()) {
gabrieltetar 22:c7763a7ec6c7 206 while(TEST_NEXT.Touched());
gabrieltetar 22:c7763a7ec6c7 207 strat_etat_s = DEMO;
gabrieltetar 22:c7763a7ec6c7 208 } else if(TEST_DIV.Touched()) {
gabrieltetar 22:c7763a7ec6c7 209 while(TEST_DIV.Touched());
gabrieltetar 22:c7763a7ec6c7 210 strat_etat_s = TEST_DIVE;
gabrieltetar 22:c7763a7ec6c7 211 } else if(TEST_ASSERV.Touched()) {
gabrieltetar 22:c7763a7ec6c7 212 while(TEST_ASSERV.Touched());
gabrieltetar 22:c7763a7ec6c7 213 strat_etat_s = TEST_ASSERVE;
gabrieltetar 22:c7763a7ec6c7 214 } else if(RETOUR.Touched()) {
gabrieltetar 22:c7763a7ec6c7 215 while(RETOUR.Touched());
gabrieltetar 22:c7763a7ec6c7 216 strat_etat_s = CHOIX;
gabrieltetar 22:c7763a7ec6c7 217 }
gabrieltetar 22:c7763a7ec6c7 218 }
gabrieltetar 24:1a13c998c7ac 219 break;
gabrieltetar 24:1a13c998c7ac 220
gabrieltetar 24:1a13c998c7ac 221 case TEST_ASSERVE:
gabrieltetar 24:1a13c998c7ac 222 lcd.SetBackColor(LCD_COLOR_WHITE);
gabrieltetar 24:1a13c998c7ac 223 lcd.SetTextColor(LCD_COLOR_BLACK);
gabrieltetar 24:1a13c998c7ac 224 lcd.Clear (LCD_COLOR_WHITE);
gabrieltetar 24:1a13c998c7ac 225 lcd.DisplayStringAt(0, LINE(0), (uint8_t *)"Asservissements", LEFT_MODE);
goldmas 35:2a745eeb7922 226
gabrieltetar 24:1a13c998c7ac 227 RETOUR.Draw(0xFFFF0000,0);
gabrieltetar 24:1a13c998c7ac 228 TEST_A.Draw(BLEU, BLANC);
goldmas 35:2a745eeb7922 229 TEST_B.Draw(BLEU, BLANC);
goldmas 35:2a745eeb7922 230 TEST_C.Draw(BLEU, BLANC) ;
goldmas 35:2a745eeb7922 231
gabrieltetar 24:1a13c998c7ac 232 while(strat_etat_s==TEST_ASSERVE) {
gabrieltetar 24:1a13c998c7ac 233 if(RETOUR.Touched()) {
gabrieltetar 24:1a13c998c7ac 234 while (RETOUR.Touched());
gabrieltetar 24:1a13c998c7ac 235 strat_etat_s=DEMO2;
gabrieltetar 24:1a13c998c7ac 236 } else if(TEST_A.Touched()) {
gabrieltetar 24:1a13c998c7ac 237 while (TEST_A.Touched());
gabrieltetar 24:1a13c998c7ac 238 GoToPosition(2000,0,0,0);
gabrieltetar 24:1a13c998c7ac 239 TEST_A.Draw(BLEU, BLANC);
gabrieltetar 24:1a13c998c7ac 240 } else if(TEST_B.Touched()) {
gabrieltetar 24:1a13c998c7ac 241 while (TEST_B.Touched());
gabrieltetar 24:1a13c998c7ac 242 Rotate(3599);
gabrieltetar 24:1a13c998c7ac 243 TEST_B.Draw(BLEU, BLANC);
gabrieltetar 24:1a13c998c7ac 244 }
goldmas 35:2a745eeb7922 245 else if(TEST_C.Touched())
goldmas 35:2a745eeb7922 246 {
goldmas 35:2a745eeb7922 247 while (TEST_C.Touched());
goldmas 35:2a745eeb7922 248 BendRadius(1000,900,1,0);
goldmas 35:2a745eeb7922 249 TEST_B.Draw(BLEU, BLANC);
goldmas 35:2a745eeb7922 250 }
gabrieltetar 24:1a13c998c7ac 251 }
gabrieltetar 24:1a13c998c7ac 252 break;
gabrieltetar 24:1a13c998c7ac 253
gabrieltetar 24:1a13c998c7ac 254 case TEST_DIVE:
gabrieltetar 24:1a13c998c7ac 255
gabrieltetar 24:1a13c998c7ac 256 while(strat_etat_s==TEST_DIVE) {
gabrieltetar 24:1a13c998c7ac 257 canProcessRx();
gabrieltetar 24:1a13c998c7ac 258 lcd.SetBackColor(LCD_COLOR_WHITE);
gabrieltetar 24:1a13c998c7ac 259 lcd.SetTextColor(LCD_COLOR_BLACK);
gabrieltetar 24:1a13c998c7ac 260 lcd.Clear (LCD_COLOR_WHITE);
gabrieltetar 24:1a13c998c7ac 261 lcd.DisplayStringAt(0, LINE(0), (uint8_t *)"Coordonnees", LEFT_MODE);
gabrieltetar 24:1a13c998c7ac 262 sprintf(toto,"%hd",x_robot);
gabrieltetar 24:1a13c998c7ac 263 lcd.DisplayStringAt(0, LINE(10), (unsigned char *)"X :", LEFT_MODE);
gabrieltetar 24:1a13c998c7ac 264 lcd.DisplayStringAt(50, LINE(10), (unsigned char *)toto, LEFT_MODE);
gabrieltetar 24:1a13c998c7ac 265 sprintf(toto,"%hd",y_robot);
gabrieltetar 24:1a13c998c7ac 266 lcd.DisplayStringAt(0, LINE(11), (unsigned char *)"Y :", LEFT_MODE);
gabrieltetar 24:1a13c998c7ac 267 lcd.DisplayStringAt(50, LINE(11), (unsigned char *)toto, LEFT_MODE);
gabrieltetar 24:1a13c998c7ac 268 sprintf(toto,"%hd",theta_robot);
gabrieltetar 24:1a13c998c7ac 269 lcd.DisplayStringAt(0, LINE(12), (unsigned char *)"T :", LEFT_MODE);
gabrieltetar 24:1a13c998c7ac 270 lcd.DisplayStringAt(50, LINE(12), (unsigned char *) toto, LEFT_MODE);
goldmas 35:2a745eeb7922 271 RETOUR.Draw(0xFFFF0000,0);
gabrieltetar 24:1a13c998c7ac 272 if(RETOUR.Touched()) {
gabrieltetar 24:1a13c998c7ac 273 while (RETOUR.Touched());
gabrieltetar 24:1a13c998c7ac 274 strat_etat_s=DEMO2;
gabrieltetar 24:1a13c998c7ac 275 }
gabrieltetar 24:1a13c998c7ac 276 wait(0.2);
gabrieltetar 24:1a13c998c7ac 277 }
gabrieltetar 24:1a13c998c7ac 278 break;
gabrieltetar 21:d137ec53c3a9 279
gabrieltetar 21:d137ec53c3a9 280 case TEST_VENTOUSE:
goldmas 34:c314feaa0d3e 281 char vent_select_0 = 7, vent_select_1 = 0, vent_select_2 = 0, vent_select_3 = 0, vent_select_4 = 0, vent_select_5 = 0 ;
goldmas 34:c314feaa0d3e 282 unsigned char choix_vent;
gabrieltetar 21:d137ec53c3a9 283 lcd.SetBackColor(LCD_COLOR_WHITE);
gabrieltetar 21:d137ec53c3a9 284 lcd.SetTextColor(LCD_COLOR_BLACK);
gabrieltetar 21:d137ec53c3a9 285 lcd.Clear (LCD_COLOR_WHITE);
gabrieltetar 21:d137ec53c3a9 286 lcd.Clear (LCD_COLOR_WHITE);
gabrieltetar 21:d137ec53c3a9 287 lcd.DisplayStringAt(0, LINE(0), (uint8_t *)"Test Ventouse", LEFT_MODE);
gabrieltetar 21:d137ec53c3a9 288 sprintf(toto,"%hd",maximilien);
gabrieltetar 21:d137ec53c3a9 289 lcd.DisplayStringAt(50, LINE(20), (unsigned char *)toto, LEFT_MODE);
gabrieltetar 21:d137ec53c3a9 290 RETOUR.Draw(0xFFFF0000,0);
goldmas 34:c314feaa0d3e 291 TEST_ATTRAPER.Draw(BLEU, BLANC);
goldmas 34:c314feaa0d3e 292 TEST_RELACHER.Draw(BLEU, BLANC);
goldmas 34:c314feaa0d3e 293 TEST_VENT_0.Draw(BLEU, BLANC);
goldmas 34:c314feaa0d3e 294 TEST_VENT_1.Draw(BLEU, BLANC);
goldmas 34:c314feaa0d3e 295 TEST_VENT_2.Draw(BLEU, BLANC);
goldmas 34:c314feaa0d3e 296 TEST_VENT_3.Draw(BLEU, BLANC);
goldmas 34:c314feaa0d3e 297 TEST_VENT_4.Draw(BLEU, BLANC);
goldmas 34:c314feaa0d3e 298 TEST_VENT_5.Draw(BLEU, BLANC);
goldmas 34:c314feaa0d3e 299 while(strat_etat_s==TEST_VENTOUSE)
goldmas 34:c314feaa0d3e 300 {
goldmas 34:c314feaa0d3e 301 if(RETOUR.Touched())
goldmas 34:c314feaa0d3e 302 {
goldmas 34:c314feaa0d3e 303 while (RETOUR.Touched());
goldmas 34:c314feaa0d3e 304 strat_etat_s=DEMO;
goldmas 34:c314feaa0d3e 305 }
goldmas 34:c314feaa0d3e 306 else if(TEST_VENT_0.Touched())
goldmas 34:c314feaa0d3e 307 {
goldmas 34:c314feaa0d3e 308 while (TEST_VENT_0.Touched());
goldmas 34:c314feaa0d3e 309 if(vent_select_0 == 0)
goldmas 34:c314feaa0d3e 310 {
goldmas 34:c314feaa0d3e 311 vent_select_0 = 7 ;
goldmas 34:c314feaa0d3e 312 TEST_VENT_0.Draw(BLEU, BLANC);
goldmas 34:c314feaa0d3e 313 }
goldmas 34:c314feaa0d3e 314 else
goldmas 34:c314feaa0d3e 315 {
goldmas 34:c314feaa0d3e 316 vent_select_0 = 0 ;
goldmas 34:c314feaa0d3e 317 TEST_VENT_0.Draw(DIY_GREY, BLANC);
goldmas 34:c314feaa0d3e 318 }
goldmas 34:c314feaa0d3e 319 }
goldmas 34:c314feaa0d3e 320 else if(TEST_VENT_1.Touched())
goldmas 34:c314feaa0d3e 321 {
goldmas 34:c314feaa0d3e 322 while (TEST_VENT_1.Touched());
goldmas 34:c314feaa0d3e 323 if(vent_select_1 == 1)
goldmas 34:c314feaa0d3e 324 {
goldmas 34:c314feaa0d3e 325 vent_select_1 = 0 ;
goldmas 34:c314feaa0d3e 326 TEST_VENT_1.Draw(BLEU, BLANC);
goldmas 34:c314feaa0d3e 327 }
goldmas 34:c314feaa0d3e 328 else
goldmas 34:c314feaa0d3e 329 {
goldmas 34:c314feaa0d3e 330 vent_select_1 = 1 ;
goldmas 34:c314feaa0d3e 331 TEST_VENT_1.Draw(DIY_GREY, BLANC);
goldmas 34:c314feaa0d3e 332 }
goldmas 34:c314feaa0d3e 333 }
goldmas 34:c314feaa0d3e 334 else if(TEST_VENT_2.Touched())
goldmas 34:c314feaa0d3e 335 {
goldmas 34:c314feaa0d3e 336 while (TEST_VENT_2.Touched());
goldmas 34:c314feaa0d3e 337 if(vent_select_2 == 2)
goldmas 34:c314feaa0d3e 338 {
goldmas 34:c314feaa0d3e 339 vent_select_2 = 0 ;
goldmas 34:c314feaa0d3e 340 TEST_VENT_2.Draw(BLEU, BLANC);
goldmas 34:c314feaa0d3e 341 }
goldmas 34:c314feaa0d3e 342 else
goldmas 34:c314feaa0d3e 343 {
goldmas 34:c314feaa0d3e 344 vent_select_2 = 2 ;
goldmas 34:c314feaa0d3e 345 TEST_VENT_2.Draw(DIY_GREY, BLANC);
goldmas 34:c314feaa0d3e 346 }
goldmas 34:c314feaa0d3e 347 }
goldmas 34:c314feaa0d3e 348 else if(TEST_VENT_3.Touched())
goldmas 34:c314feaa0d3e 349 {
goldmas 34:c314feaa0d3e 350 while (TEST_VENT_3.Touched());
goldmas 34:c314feaa0d3e 351 if(vent_select_3 == 3)
goldmas 34:c314feaa0d3e 352 {
goldmas 34:c314feaa0d3e 353 vent_select_3 = 0 ;
goldmas 34:c314feaa0d3e 354 TEST_VENT_3.Draw(BLEU, BLANC);
goldmas 34:c314feaa0d3e 355 }
goldmas 34:c314feaa0d3e 356 else
goldmas 34:c314feaa0d3e 357 {
goldmas 34:c314feaa0d3e 358 vent_select_3 = 3 ;
goldmas 34:c314feaa0d3e 359 TEST_VENT_3.Draw(DIY_GREY, BLANC);
goldmas 34:c314feaa0d3e 360 }
goldmas 34:c314feaa0d3e 361 }
goldmas 34:c314feaa0d3e 362 else if(TEST_VENT_4.Touched())
goldmas 34:c314feaa0d3e 363 {
goldmas 34:c314feaa0d3e 364 while (TEST_VENT_4.Touched());
goldmas 34:c314feaa0d3e 365 if(vent_select_4 == 4)
goldmas 34:c314feaa0d3e 366 {
goldmas 34:c314feaa0d3e 367 vent_select_4 = 0 ;
goldmas 34:c314feaa0d3e 368 TEST_VENT_4.Draw(BLEU, BLANC);
goldmas 34:c314feaa0d3e 369 }
goldmas 34:c314feaa0d3e 370 else
goldmas 34:c314feaa0d3e 371 {
goldmas 34:c314feaa0d3e 372 vent_select_4 = 4 ;
goldmas 34:c314feaa0d3e 373 TEST_VENT_4.Draw(DIY_GREY, BLANC);
goldmas 34:c314feaa0d3e 374 }
goldmas 34:c314feaa0d3e 375 }
goldmas 34:c314feaa0d3e 376 else if(TEST_VENT_5.Touched())
goldmas 34:c314feaa0d3e 377 {
goldmas 34:c314feaa0d3e 378 while (TEST_VENT_5.Touched());
goldmas 34:c314feaa0d3e 379 if(vent_select_5 == 5)
goldmas 34:c314feaa0d3e 380 {
goldmas 34:c314feaa0d3e 381 vent_select_5 = 0 ;
goldmas 34:c314feaa0d3e 382 TEST_VENT_5.Draw(BLEU, BLANC);
goldmas 34:c314feaa0d3e 383 }
goldmas 34:c314feaa0d3e 384 else
goldmas 34:c314feaa0d3e 385 {
goldmas 34:c314feaa0d3e 386 vent_select_5 = 5 ;
goldmas 34:c314feaa0d3e 387 TEST_VENT_5.Draw(DIY_GREY, BLANC);
goldmas 34:c314feaa0d3e 388 }
goldmas 34:c314feaa0d3e 389 }
goldmas 34:c314feaa0d3e 390 else if (TEST_ATTRAPER.Touched())
goldmas 34:c314feaa0d3e 391 {
goldmas 34:c314feaa0d3e 392 while(TEST_ATTRAPER.Touched()) ;
goldmas 34:c314feaa0d3e 393 unsigned char message_droit_at, message_gauche_at, nombre_de_chiffre_droite, nombre_de_chiffre_gauche; //chager pour un short et remettre les valeurs correct (char utiliser pour les test)
goldmas 34:c314feaa0d3e 394 message_droit_at = 100 * vent_select_2 + 10 * vent_select_1 + vent_select_0 ;
goldmas 34:c314feaa0d3e 395 message_gauche_at = 100 * vent_select_5 + 10 * vent_select_4 + vent_select_3 ;
goldmas 34:c314feaa0d3e 396
goldmas 34:c314feaa0d3e 397 switch (message_gauche_at)
goldmas 34:c314feaa0d3e 398 {
goldmas 34:c314feaa0d3e 399 case 31 : //on dépasse la taille d'un char donc on met la valeur en comptant le dépassement
goldmas 34:c314feaa0d3e 400 choix_vent = 66 ;
goldmas 34:c314feaa0d3e 401 SendMsgCan(VENT_AT, &choix_vent,sizeof(choix_vent));
goldmas 34:c314feaa0d3e 402 break ;
goldmas 34:c314feaa0d3e 403 case 28 : //on dépasse la taille d'un char donc on met la valeur en comptant le dépassement
goldmas 34:c314feaa0d3e 404 choix_vent = 54 ;
goldmas 34:c314feaa0d3e 405 SendMsgCan(VENT_AT, &choix_vent,sizeof(choix_vent));
goldmas 34:c314feaa0d3e 406 break ;
goldmas 34:c314feaa0d3e 407 case 247 : //on dépasse la taille d'un char donc on met la valeur en comptant le dépassement
goldmas 34:c314feaa0d3e 408 choix_vent = 53 ;
goldmas 34:c314feaa0d3e 409 SendMsgCan(VENT_AT, &choix_vent,sizeof(choix_vent));
goldmas 34:c314feaa0d3e 410 break ;
goldmas 34:c314feaa0d3e 411 case 43 :
goldmas 34:c314feaa0d3e 412 choix_vent = 43 ;
goldmas 34:c314feaa0d3e 413 SendMsgCan(VENT_AT, &choix_vent,sizeof(choix_vent));
goldmas 34:c314feaa0d3e 414 break ;
goldmas 34:c314feaa0d3e 415 case 244 : //on dépasse la taille d'un char donc on met la valeur en comptant le dépassement
goldmas 34:c314feaa0d3e 416 choix_vent = 5 ;
goldmas 34:c314feaa0d3e 417 SendMsgCan(VENT_AT, &choix_vent,sizeof(choix_vent));
goldmas 34:c314feaa0d3e 418 break ;
goldmas 34:c314feaa0d3e 419 case 40 :
goldmas 34:c314feaa0d3e 420 choix_vent = 4 ;
goldmas 34:c314feaa0d3e 421 SendMsgCan(VENT_AT, &choix_vent,sizeof(choix_vent));
goldmas 34:c314feaa0d3e 422 break ;
goldmas 34:c314feaa0d3e 423 case 3 :
goldmas 34:c314feaa0d3e 424 choix_vent = 3 ;
goldmas 34:c314feaa0d3e 425 SendMsgCan(VENT_AT, &choix_vent,sizeof(choix_vent));
goldmas 34:c314feaa0d3e 426 break ;
goldmas 34:c314feaa0d3e 427 }
goldmas 34:c314feaa0d3e 428
goldmas 34:c314feaa0d3e 429 switch (message_droit_at)
goldmas 34:c314feaa0d3e 430 {
goldmas 34:c314feaa0d3e 431 case 210 :
goldmas 34:c314feaa0d3e 432 choix_vent = 210 ;
goldmas 34:c314feaa0d3e 433 SendMsgCan(VENT_AT, &choix_vent,sizeof(choix_vent));
goldmas 34:c314feaa0d3e 434 break ;
goldmas 34:c314feaa0d3e 435 case 217 :
goldmas 34:c314feaa0d3e 436 choix_vent = 21 ;
goldmas 34:c314feaa0d3e 437 SendMsgCan(VENT_AT, &choix_vent,sizeof(choix_vent));
goldmas 34:c314feaa0d3e 438 break ;
goldmas 34:c314feaa0d3e 439 case 200 :
goldmas 34:c314feaa0d3e 440 choix_vent = 20 ;
goldmas 34:c314feaa0d3e 441 SendMsgCan(VENT_AT, &choix_vent,sizeof(choix_vent));
goldmas 34:c314feaa0d3e 442 break ;
goldmas 34:c314feaa0d3e 443 case 10 :
goldmas 34:c314feaa0d3e 444 choix_vent = 10 ;
goldmas 34:c314feaa0d3e 445 SendMsgCan(VENT_AT, &choix_vent,sizeof(choix_vent));
goldmas 34:c314feaa0d3e 446 break ;
goldmas 34:c314feaa0d3e 447 case 207 :
goldmas 34:c314feaa0d3e 448 choix_vent = 2 ;
goldmas 34:c314feaa0d3e 449 SendMsgCan(VENT_AT, &choix_vent,sizeof(choix_vent));
goldmas 34:c314feaa0d3e 450 break ;
goldmas 34:c314feaa0d3e 451 case 17 :
goldmas 34:c314feaa0d3e 452 choix_vent = 1 ;
goldmas 34:c314feaa0d3e 453 SendMsgCan(VENT_AT, &choix_vent,sizeof(choix_vent));
goldmas 34:c314feaa0d3e 454 break ;
goldmas 34:c314feaa0d3e 455 case 0 :
goldmas 34:c314feaa0d3e 456 choix_vent = 0 ;
goldmas 34:c314feaa0d3e 457 SendMsgCan(VENT_AT, &choix_vent,sizeof(choix_vent));
goldmas 34:c314feaa0d3e 458 break ;
goldmas 34:c314feaa0d3e 459 }
goldmas 34:c314feaa0d3e 460
goldmas 34:c314feaa0d3e 461 message_droit_at = 0 ;
goldmas 34:c314feaa0d3e 462 message_gauche_at = 0 ;
goldmas 34:c314feaa0d3e 463
goldmas 34:c314feaa0d3e 464 TEST_ATTRAPER.Draw(BLEU, BLANC);
goldmas 34:c314feaa0d3e 465 }
goldmas 34:c314feaa0d3e 466 else if (TEST_RELACHER.Touched())
goldmas 34:c314feaa0d3e 467 {
goldmas 34:c314feaa0d3e 468 while(TEST_RELACHER.Touched());
goldmas 34:c314feaa0d3e 469 unsigned char message_droit_re, message_gauche_re;
goldmas 34:c314feaa0d3e 470 message_droit_re = 100 * vent_select_2 + 10 * vent_select_1 + vent_select_0 ;
goldmas 34:c314feaa0d3e 471 message_gauche_re = 100 * vent_select_5 + 10 * vent_select_4 + vent_select_3 ;
goldmas 34:c314feaa0d3e 472 switch (message_droit_re)
goldmas 34:c314feaa0d3e 473 {
goldmas 34:c314feaa0d3e 474 case 210 :
goldmas 34:c314feaa0d3e 475 choix_vent = 210 ;
goldmas 34:c314feaa0d3e 476 SendMsgCan(VENT_RE, &choix_vent,sizeof(choix_vent));
goldmas 34:c314feaa0d3e 477 break ;
goldmas 34:c314feaa0d3e 478 case 217 :
goldmas 34:c314feaa0d3e 479 choix_vent = 21 ;
goldmas 34:c314feaa0d3e 480 SendMsgCan(VENT_RE, &choix_vent,sizeof(choix_vent));
goldmas 34:c314feaa0d3e 481 break ;
goldmas 34:c314feaa0d3e 482 case 200 :
goldmas 34:c314feaa0d3e 483 choix_vent = 20 ;
goldmas 34:c314feaa0d3e 484 SendMsgCan(VENT_RE, &choix_vent,sizeof(choix_vent));
goldmas 34:c314feaa0d3e 485 break ;
goldmas 34:c314feaa0d3e 486 case 10 :
goldmas 34:c314feaa0d3e 487 choix_vent = 10 ;
goldmas 34:c314feaa0d3e 488 SendMsgCan(VENT_RE, &choix_vent,sizeof(choix_vent));
goldmas 34:c314feaa0d3e 489 break ;
goldmas 34:c314feaa0d3e 490 case 207 :
goldmas 34:c314feaa0d3e 491 choix_vent = 2 ;
goldmas 34:c314feaa0d3e 492 SendMsgCan(VENT_RE, &choix_vent,sizeof(choix_vent));
goldmas 34:c314feaa0d3e 493 break ;
goldmas 34:c314feaa0d3e 494 case 17 :
goldmas 34:c314feaa0d3e 495 choix_vent = 1 ;
goldmas 34:c314feaa0d3e 496 SendMsgCan(VENT_RE, &choix_vent,sizeof(choix_vent));
goldmas 34:c314feaa0d3e 497 break ;
goldmas 34:c314feaa0d3e 498 case 0 :
goldmas 34:c314feaa0d3e 499 choix_vent = 0 ;
goldmas 34:c314feaa0d3e 500 SendMsgCan(VENT_RE, &choix_vent,sizeof(choix_vent));
goldmas 34:c314feaa0d3e 501 break ;
goldmas 34:c314feaa0d3e 502 }
goldmas 34:c314feaa0d3e 503
goldmas 34:c314feaa0d3e 504 switch (message_gauche_re)
goldmas 34:c314feaa0d3e 505 {
goldmas 34:c314feaa0d3e 506 case 31 :
goldmas 34:c314feaa0d3e 507 choix_vent = 66 ;
goldmas 34:c314feaa0d3e 508 SendMsgCan(VENT_RE, &choix_vent,sizeof(choix_vent));
goldmas 34:c314feaa0d3e 509 break ;
goldmas 34:c314feaa0d3e 510 case 28 :
goldmas 34:c314feaa0d3e 511 choix_vent = 54 ;
goldmas 34:c314feaa0d3e 512 SendMsgCan(VENT_RE, &choix_vent,sizeof(choix_vent));
goldmas 34:c314feaa0d3e 513 break ;
goldmas 34:c314feaa0d3e 514 case 247 :
goldmas 34:c314feaa0d3e 515 choix_vent = 53 ;
goldmas 34:c314feaa0d3e 516 SendMsgCan(VENT_RE, &choix_vent,sizeof(choix_vent));
goldmas 34:c314feaa0d3e 517 break ;
goldmas 34:c314feaa0d3e 518 case 43 :
goldmas 34:c314feaa0d3e 519 choix_vent = 43 ;
goldmas 34:c314feaa0d3e 520 SendMsgCan(VENT_RE, &choix_vent,sizeof(choix_vent));
goldmas 34:c314feaa0d3e 521 break ;
goldmas 34:c314feaa0d3e 522 case 244 :
goldmas 34:c314feaa0d3e 523 choix_vent = 5 ;
goldmas 34:c314feaa0d3e 524 SendMsgCan(VENT_RE, &choix_vent,sizeof(choix_vent));
goldmas 34:c314feaa0d3e 525 break ;
goldmas 34:c314feaa0d3e 526 case 40 :
goldmas 34:c314feaa0d3e 527 choix_vent = 4 ;
goldmas 34:c314feaa0d3e 528 SendMsgCan(VENT_RE, &choix_vent,sizeof(choix_vent));
goldmas 34:c314feaa0d3e 529 break ;
goldmas 34:c314feaa0d3e 530 case 3 :
goldmas 34:c314feaa0d3e 531 choix_vent = 3 ;
goldmas 34:c314feaa0d3e 532 SendMsgCan(VENT_RE, &choix_vent,sizeof(choix_vent));
goldmas 34:c314feaa0d3e 533 break ;
goldmas 34:c314feaa0d3e 534 }
goldmas 34:c314feaa0d3e 535 message_droit_re = 0 ;
goldmas 34:c314feaa0d3e 536 message_gauche_re = 0 ; //on remet les variables de calcul à 0 pour qu'on puisse recalculer correctement
goldmas 34:c314feaa0d3e 537
goldmas 34:c314feaa0d3e 538 TEST_RELACHER.Draw(BLEU, BLANC);
goldmas 34:c314feaa0d3e 539
goldmas 34:c314feaa0d3e 540 }
goldmas 34:c314feaa0d3e 541 }
goldmas 34:c314feaa0d3e 542 break;
goldmas 34:c314feaa0d3e 543
goldmas 34:c314feaa0d3e 544 /*
gabrieltetar 21:d137ec53c3a9 545 TEST_A.Draw(BLEU, BLANC);
gabrieltetar 21:d137ec53c3a9 546 TEST_NUM.Draw(BLEU, BLANC);
gabrieltetar 21:d137ec53c3a9 547 TEST_PLUS.Draw(BLEU, BLANC);
gabrieltetar 21:d137ec53c3a9 548 TEST_MOINS.Draw(BLEU, BLANC);
gabrieltetar 21:d137ec53c3a9 549 while(strat_etat_s==TEST_VENTOUSE) {
gabrieltetar 21:d137ec53c3a9 550 if(RETOUR.Touched()) {
gabrieltetar 21:d137ec53c3a9 551 while (RETOUR.Touched());
gabrieltetar 21:d137ec53c3a9 552 strat_etat_s=DEMO;
gabrieltetar 21:d137ec53c3a9 553 } else if(TEST_A.Touched()) {
gabrieltetar 21:d137ec53c3a9 554 while (TEST_A.Touched());
maximilienlv 28:7f2990747e09 555 SendRawId(VENT_ETAT);
gabrieltetar 21:d137ec53c3a9 556 TEST_A.Draw(BLEU, BLANC);
gabrieltetar 21:d137ec53c3a9 557 } else if(TEST_NUM.Touched()) {
gabrieltetar 21:d137ec53c3a9 558 while (TEST_NUM.Touched());
gabrieltetar 21:d137ec53c3a9 559 TEST_NUM.Draw(BLEU, BLANC);
gabrieltetar 21:d137ec53c3a9 560 switch(maximilien){
gabrieltetar 21:d137ec53c3a9 561 case 1:
goldmas 32:7f8e3ee2adac 562 choix_groupe = 0 ;
goldmas 32:7f8e3ee2adac 563 SendMsgCan(VENT_AT, &choix_groupe, sizeof(choix_groupe)) ;
gabrieltetar 21:d137ec53c3a9 564 break;
gabrieltetar 21:d137ec53c3a9 565 case 2:
goldmas 32:7f8e3ee2adac 566 choix_groupe = 0 ;
goldmas 32:7f8e3ee2adac 567 SendMsgCan(VENT_RE, &choix_groupe, sizeof(choix_groupe)) ;
gabrieltetar 21:d137ec53c3a9 568 break;
gabrieltetar 21:d137ec53c3a9 569 case 3:
goldmas 32:7f8e3ee2adac 570 choix_groupe = 1 ;
goldmas 32:7f8e3ee2adac 571 SendMsgCan(VENT_AT, &choix_groupe, sizeof(choix_groupe)) ;
gabrieltetar 21:d137ec53c3a9 572 break;
gabrieltetar 21:d137ec53c3a9 573 case 4:
goldmas 32:7f8e3ee2adac 574 choix_groupe = 1 ;
goldmas 32:7f8e3ee2adac 575 SendMsgCan(VENT_RE, &choix_groupe, sizeof(choix_groupe)) ;
gabrieltetar 21:d137ec53c3a9 576 break;
gabrieltetar 21:d137ec53c3a9 577 case 5:
goldmas 32:7f8e3ee2adac 578 choix_groupe = 2 ;
goldmas 32:7f8e3ee2adac 579 SendMsgCan(VENT_AT, &choix_groupe, sizeof(choix_groupe)) ;
gabrieltetar 21:d137ec53c3a9 580 break;
gabrieltetar 21:d137ec53c3a9 581 case 6:
goldmas 32:7f8e3ee2adac 582 choix_groupe = 2 ;
goldmas 32:7f8e3ee2adac 583 SendMsgCan(VENT_RE, &choix_groupe, sizeof(choix_groupe)) ;
goldmas 32:7f8e3ee2adac 584 break;
goldmas 32:7f8e3ee2adac 585 case 7:
goldmas 32:7f8e3ee2adac 586 choix_groupe = 3 ;
goldmas 32:7f8e3ee2adac 587 SendMsgCan(VENT_AT, &choix_groupe, sizeof(choix_groupe)) ;
goldmas 32:7f8e3ee2adac 588 break;
goldmas 32:7f8e3ee2adac 589 case 8:
goldmas 32:7f8e3ee2adac 590 choix_groupe = 3 ;
goldmas 32:7f8e3ee2adac 591 SendMsgCan(VENT_RE, &choix_groupe, sizeof(choix_groupe)) ;
goldmas 32:7f8e3ee2adac 592 break;
goldmas 32:7f8e3ee2adac 593 case 9:
goldmas 32:7f8e3ee2adac 594 choix_groupe = 4 ;
goldmas 32:7f8e3ee2adac 595 SendMsgCan(VENT_AT, &choix_groupe, sizeof(choix_groupe)) ;
goldmas 32:7f8e3ee2adac 596 break;
goldmas 32:7f8e3ee2adac 597 case 10:
goldmas 32:7f8e3ee2adac 598 choix_groupe = 4 ;
goldmas 32:7f8e3ee2adac 599 SendMsgCan(VENT_RE, &choix_groupe, sizeof(choix_groupe)) ;
goldmas 32:7f8e3ee2adac 600 break;
goldmas 32:7f8e3ee2adac 601 case 11:
goldmas 32:7f8e3ee2adac 602 choix_groupe = 5 ;
goldmas 32:7f8e3ee2adac 603 SendMsgCan(VENT_AT, &choix_groupe, sizeof(choix_groupe)) ;
goldmas 32:7f8e3ee2adac 604 break;
goldmas 32:7f8e3ee2adac 605 case 12:
goldmas 32:7f8e3ee2adac 606 choix_groupe = 5 ;
goldmas 32:7f8e3ee2adac 607 SendMsgCan(VENT_RE, &choix_groupe, sizeof(choix_groupe)) ;
gabrieltetar 21:d137ec53c3a9 608 break;
gabrieltetar 21:d137ec53c3a9 609 }
gabrieltetar 21:d137ec53c3a9 610 } else if(TEST_PLUS.Touched()) {
gabrieltetar 21:d137ec53c3a9 611 while (TEST_PLUS.Touched());
gabrieltetar 21:d137ec53c3a9 612 TEST_PLUS.Draw(BLEU, BLANC);
gabrieltetar 21:d137ec53c3a9 613 if(maximilien!=6)maximilien++;
gabrieltetar 21:d137ec53c3a9 614 sprintf(toto,"%hd",maximilien);
gabrieltetar 21:d137ec53c3a9 615 lcd.SetBackColor(LCD_COLOR_WHITE);
gabrieltetar 21:d137ec53c3a9 616 lcd.SetTextColor(LCD_COLOR_BLACK);
gabrieltetar 21:d137ec53c3a9 617 lcd.DisplayStringAt(50, LINE(20), (unsigned char *)toto, LEFT_MODE);
gabrieltetar 21:d137ec53c3a9 618 } else if(TEST_MOINS.Touched()) {
gabrieltetar 21:d137ec53c3a9 619 while (TEST_MOINS.Touched());
gabrieltetar 21:d137ec53c3a9 620 TEST_MOINS.Draw(BLEU, BLANC);
gabrieltetar 21:d137ec53c3a9 621 if(maximilien!=1)maximilien--;
gabrieltetar 21:d137ec53c3a9 622 sprintf(toto,"%hd",maximilien);
gabrieltetar 21:d137ec53c3a9 623 lcd.SetBackColor(LCD_COLOR_WHITE);
gabrieltetar 21:d137ec53c3a9 624 lcd.SetTextColor(LCD_COLOR_BLACK);
gabrieltetar 21:d137ec53c3a9 625 lcd.DisplayStringAt(50, LINE(20), (unsigned char *)toto, LEFT_MODE);
gabrieltetar 21:d137ec53c3a9 626 }
gabrieltetar 21:d137ec53c3a9 627 }
goldmas 34:c314feaa0d3e 628 break;*/
gabrieltetar 21:d137ec53c3a9 629
gabrieltetar 24:1a13c998c7ac 630 case TEST_ELECTROV:
gabrieltetar 21:d137ec53c3a9 631 lcd.SetBackColor(LCD_COLOR_WHITE);
gabrieltetar 21:d137ec53c3a9 632 lcd.SetTextColor(LCD_COLOR_BLACK);
gabrieltetar 21:d137ec53c3a9 633 lcd.Clear (LCD_COLOR_WHITE);
gabrieltetar 21:d137ec53c3a9 634 lcd.Clear (LCD_COLOR_WHITE);
gabrieltetar 21:d137ec53c3a9 635 lcd.DisplayStringAt(0, LINE(0), (uint8_t *)"A : Manches B : Pavillon", LEFT_MODE);
gabrieltetar 21:d137ec53c3a9 636 RETOUR.Draw(0xFFFF0000,0);
gabrieltetar 21:d137ec53c3a9 637 TEST_A.Draw(BLEU, BLANC);
gabrieltetar 21:d137ec53c3a9 638 TEST_B.Draw(BLEU, BLANC);
gabrieltetar 24:1a13c998c7ac 639 while(strat_etat_s==TEST_ELECTROV) {
gabrieltetar 21:d137ec53c3a9 640 if(RETOUR.Touched()) {
gabrieltetar 21:d137ec53c3a9 641 while (RETOUR.Touched());
gabrieltetar 24:1a13c998c7ac 642 strat_etat_s=DEMO;
gabrieltetar 21:d137ec53c3a9 643 } else if(TEST_A.Touched()) {
gabrieltetar 21:d137ec53c3a9 644 while (TEST_A.Touched());
gabrieltetar 21:d137ec53c3a9 645 //SendRawId(TEST_ELECTROV_A);
gabrieltetar 21:d137ec53c3a9 646 TEST_A.Draw(BLEU, BLANC);
gabrieltetar 21:d137ec53c3a9 647 } else if(TEST_B.Touched()) {
gabrieltetar 21:d137ec53c3a9 648 while (TEST_B.Touched());
gabrieltetar 21:d137ec53c3a9 649 //SendRawId(TEST_ELECTROV_A);
gabrieltetar 21:d137ec53c3a9 650 TEST_B.Draw(BLEU, BLANC);
gabrieltetar 21:d137ec53c3a9 651 }
gabrieltetar 21:d137ec53c3a9 652 }
gabrieltetar 21:d137ec53c3a9 653 break;
gabrieltetar 24:1a13c998c7ac 654
gabrieltetar 21:d137ec53c3a9 655 case TEST_AUD:
gabrieltetar 21:d137ec53c3a9 656
gabrieltetar 21:d137ec53c3a9 657 lcd.SetBackColor(LCD_COLOR_WHITE);
gabrieltetar 21:d137ec53c3a9 658 lcd.SetTextColor(LCD_COLOR_BLACK);
gabrieltetar 21:d137ec53c3a9 659 lcd.Clear (LCD_COLOR_WHITE);
gabrieltetar 21:d137ec53c3a9 660 lcd.Clear (LCD_COLOR_WHITE);
gabrieltetar 21:d137ec53c3a9 661 lcd.DisplayStringAt(0, LINE(0), (uint8_t *)"Test Audio", LEFT_MODE);
gabrieltetar 21:d137ec53c3a9 662 sprintf(toto,"%hd",maximilien);
gabrieltetar 21:d137ec53c3a9 663 lcd.DisplayStringAt(50, LINE(20), (unsigned char *)toto, LEFT_MODE);
gabrieltetar 21:d137ec53c3a9 664 RETOUR.Draw(0xFFFF0000,0);
gabrieltetar 21:d137ec53c3a9 665 TEST_NUM.Draw(BLEU, BLANC);
gabrieltetar 21:d137ec53c3a9 666 TEST_PLUS.Draw(BLEU, BLANC);
gabrieltetar 21:d137ec53c3a9 667 TEST_MOINS.Draw(BLEU, BLANC);
gabrieltetar 21:d137ec53c3a9 668 while(strat_etat_s==TEST_AUD) {
gabrieltetar 21:d137ec53c3a9 669 if(RETOUR.Touched()) {
gabrieltetar 21:d137ec53c3a9 670 while (RETOUR.Touched());
gabrieltetar 21:d137ec53c3a9 671 strat_etat_s=DEMO;
gabrieltetar 21:d137ec53c3a9 672 } else if(TEST_NUM.Touched()) {
gabrieltetar 21:d137ec53c3a9 673 while (TEST_NUM.Touched());
gabrieltetar 21:d137ec53c3a9 674 TEST_NUM.Draw(BLEU, BLANC);
gabrieltetar 21:d137ec53c3a9 675 Debug_Audio(3,maximilien);
gabrieltetar 21:d137ec53c3a9 676 } else if(TEST_PLUS.Touched()) {
gabrieltetar 21:d137ec53c3a9 677 while (TEST_PLUS.Touched());
gabrieltetar 21:d137ec53c3a9 678 TEST_PLUS.Draw(BLEU, BLANC);
gabrieltetar 21:d137ec53c3a9 679 if(maximilien!=20)maximilien++;
gabrieltetar 21:d137ec53c3a9 680 sprintf(toto,"%hd",maximilien);
gabrieltetar 21:d137ec53c3a9 681 lcd.SetBackColor(LCD_COLOR_WHITE);
gabrieltetar 21:d137ec53c3a9 682 lcd.SetTextColor(LCD_COLOR_BLACK);
gabrieltetar 21:d137ec53c3a9 683 lcd.DisplayStringAt(50, LINE(20), (unsigned char *)toto, LEFT_MODE);
gabrieltetar 21:d137ec53c3a9 684 } else if(TEST_MOINS.Touched()) {
gabrieltetar 21:d137ec53c3a9 685 while (TEST_MOINS.Touched());
gabrieltetar 21:d137ec53c3a9 686 TEST_MOINS.Draw(BLEU, BLANC);
gabrieltetar 21:d137ec53c3a9 687 if(maximilien!=1)maximilien--;
gabrieltetar 21:d137ec53c3a9 688 sprintf(toto,"%hd",maximilien);
gabrieltetar 21:d137ec53c3a9 689 lcd.SetBackColor(LCD_COLOR_WHITE);
gabrieltetar 21:d137ec53c3a9 690 lcd.SetTextColor(LCD_COLOR_BLACK);
gabrieltetar 21:d137ec53c3a9 691 lcd.DisplayStringAt(50, LINE(20), (unsigned char *)toto, LEFT_MODE);
gabrieltetar 21:d137ec53c3a9 692 }
gabrieltetar 21:d137ec53c3a9 693 }
gabrieltetar 21:d137ec53c3a9 694 break;
gabrieltetar 21:d137ec53c3a9 695
gabrieltetar 21:d137ec53c3a9 696 case TEST_SERVO_BRAS:
goldmas 33:c54841d11156 697 char bras_select_0 = 7, bras_select_1 = 0, bras_select_2 = 0, bras_select_3 = 0, bras_select_4 = 0, bras_select_5 = 0 ;
goldmas 33:c54841d11156 698 unsigned char choix_bras;
gabrieltetar 21:d137ec53c3a9 699 lcd.SetBackColor(LCD_COLOR_WHITE);
gabrieltetar 21:d137ec53c3a9 700 lcd.SetTextColor(LCD_COLOR_BLACK);
gabrieltetar 21:d137ec53c3a9 701 lcd.Clear (LCD_COLOR_WHITE);
gabrieltetar 21:d137ec53c3a9 702 lcd.Clear (LCD_COLOR_WHITE);
gabrieltetar 21:d137ec53c3a9 703 lcd.DisplayStringAt(0, LINE(0), (uint8_t *)"Test Bras", LEFT_MODE);
gabrieltetar 21:d137ec53c3a9 704 sprintf(toto,"%hd",maximilien);
gabrieltetar 21:d137ec53c3a9 705 lcd.DisplayStringAt(50, LINE(20), (unsigned char *)toto, LEFT_MODE);
gabrieltetar 21:d137ec53c3a9 706 RETOUR.Draw(0xFFFF0000,0);
goldmas 32:7f8e3ee2adac 707 TEST_ATTRAPER.Draw(BLEU, BLANC);
goldmas 32:7f8e3ee2adac 708 TEST_RELACHER.Draw(BLEU, BLANC);
goldmas 32:7f8e3ee2adac 709 TEST_SERVO_0.Draw(BLEU, BLANC);
goldmas 32:7f8e3ee2adac 710 TEST_SERVO_1.Draw(BLEU, BLANC);
goldmas 32:7f8e3ee2adac 711 TEST_SERVO_2.Draw(BLEU, BLANC);
goldmas 32:7f8e3ee2adac 712 TEST_SERVO_3.Draw(BLEU, BLANC);
goldmas 32:7f8e3ee2adac 713 TEST_SERVO_4.Draw(BLEU, BLANC);
goldmas 32:7f8e3ee2adac 714 TEST_SERVO_5.Draw(BLEU, BLANC);
goldmas 32:7f8e3ee2adac 715 while(strat_etat_s==TEST_SERVO_BRAS)
goldmas 32:7f8e3ee2adac 716 {
goldmas 32:7f8e3ee2adac 717 if(RETOUR.Touched())
goldmas 32:7f8e3ee2adac 718 {
gabrieltetar 21:d137ec53c3a9 719 while (RETOUR.Touched());
gabrieltetar 21:d137ec53c3a9 720 strat_etat_s=DEMO;
goldmas 32:7f8e3ee2adac 721 }
goldmas 32:7f8e3ee2adac 722 else if(TEST_SERVO_0.Touched())
goldmas 32:7f8e3ee2adac 723 {
goldmas 32:7f8e3ee2adac 724 while (TEST_SERVO_0.Touched());
goldmas 33:c54841d11156 725 if(bras_select_0 == 0)
goldmas 33:c54841d11156 726 {
goldmas 33:c54841d11156 727 bras_select_0 = 7 ;
goldmas 33:c54841d11156 728 TEST_SERVO_0.Draw(BLEU, BLANC);
goldmas 33:c54841d11156 729 }
goldmas 33:c54841d11156 730 else
goldmas 32:7f8e3ee2adac 731 {
goldmas 32:7f8e3ee2adac 732 bras_select_0 = 0 ;
goldmas 32:7f8e3ee2adac 733 TEST_SERVO_0.Draw(DIY_GREY, BLANC);
goldmas 32:7f8e3ee2adac 734 }
goldmas 32:7f8e3ee2adac 735 }
goldmas 32:7f8e3ee2adac 736 else if(TEST_SERVO_1.Touched())
goldmas 32:7f8e3ee2adac 737 {
goldmas 32:7f8e3ee2adac 738 while (TEST_SERVO_1.Touched());
goldmas 33:c54841d11156 739 if(bras_select_1 == 1)
goldmas 32:7f8e3ee2adac 740 {
goldmas 32:7f8e3ee2adac 741 bras_select_1 = 0 ;
goldmas 33:c54841d11156 742 TEST_SERVO_1.Draw(BLEU, BLANC);
goldmas 32:7f8e3ee2adac 743 }
goldmas 32:7f8e3ee2adac 744 else
goldmas 32:7f8e3ee2adac 745 {
goldmas 32:7f8e3ee2adac 746 bras_select_1 = 1 ;
goldmas 33:c54841d11156 747 TEST_SERVO_1.Draw(DIY_GREY, BLANC);
goldmas 32:7f8e3ee2adac 748 }
goldmas 32:7f8e3ee2adac 749 }
goldmas 32:7f8e3ee2adac 750 else if(TEST_SERVO_2.Touched())
goldmas 32:7f8e3ee2adac 751 {
goldmas 32:7f8e3ee2adac 752 while (TEST_SERVO_2.Touched());
goldmas 33:c54841d11156 753 if(bras_select_2 == 2)
goldmas 32:7f8e3ee2adac 754 {
goldmas 32:7f8e3ee2adac 755 bras_select_2 = 0 ;
goldmas 33:c54841d11156 756 TEST_SERVO_2.Draw(BLEU, BLANC);
goldmas 32:7f8e3ee2adac 757 }
goldmas 32:7f8e3ee2adac 758 else
goldmas 32:7f8e3ee2adac 759 {
goldmas 33:c54841d11156 760 bras_select_2 = 2 ;
goldmas 33:c54841d11156 761 TEST_SERVO_2.Draw(DIY_GREY, BLANC);
gabrieltetar 21:d137ec53c3a9 762 }
goldmas 32:7f8e3ee2adac 763 }
goldmas 32:7f8e3ee2adac 764 else if(TEST_SERVO_3.Touched())
goldmas 32:7f8e3ee2adac 765 {
goldmas 32:7f8e3ee2adac 766 while (TEST_SERVO_3.Touched());
goldmas 33:c54841d11156 767 if(bras_select_3 == 3)
goldmas 32:7f8e3ee2adac 768 {
goldmas 32:7f8e3ee2adac 769 bras_select_3 = 0 ;
goldmas 33:c54841d11156 770 TEST_SERVO_3.Draw(BLEU, BLANC);
goldmas 32:7f8e3ee2adac 771 }
goldmas 32:7f8e3ee2adac 772 else
goldmas 32:7f8e3ee2adac 773 {
goldmas 33:c54841d11156 774 bras_select_3 = 3 ;
goldmas 33:c54841d11156 775 TEST_SERVO_3.Draw(DIY_GREY, BLANC);
goldmas 32:7f8e3ee2adac 776 }
goldmas 32:7f8e3ee2adac 777 }
goldmas 32:7f8e3ee2adac 778 else if(TEST_SERVO_4.Touched())
goldmas 32:7f8e3ee2adac 779 {
goldmas 32:7f8e3ee2adac 780 while (TEST_SERVO_4.Touched());
goldmas 33:c54841d11156 781 if(bras_select_4 == 4)
goldmas 32:7f8e3ee2adac 782 {
goldmas 32:7f8e3ee2adac 783 bras_select_4 = 0 ;
goldmas 33:c54841d11156 784 TEST_SERVO_4.Draw(BLEU, BLANC);
goldmas 32:7f8e3ee2adac 785 }
goldmas 32:7f8e3ee2adac 786 else
goldmas 32:7f8e3ee2adac 787 {
goldmas 33:c54841d11156 788 bras_select_4 = 4 ;
goldmas 33:c54841d11156 789 TEST_SERVO_4.Draw(DIY_GREY, BLANC);
goldmas 32:7f8e3ee2adac 790 }
goldmas 32:7f8e3ee2adac 791 }
goldmas 32:7f8e3ee2adac 792 else if(TEST_SERVO_5.Touched())
goldmas 32:7f8e3ee2adac 793 {
goldmas 32:7f8e3ee2adac 794 while (TEST_SERVO_5.Touched());
goldmas 33:c54841d11156 795 if(bras_select_5 == 5)
goldmas 32:7f8e3ee2adac 796 {
goldmas 32:7f8e3ee2adac 797 bras_select_5 = 0 ;
goldmas 33:c54841d11156 798 TEST_SERVO_5.Draw(BLEU, BLANC);
goldmas 32:7f8e3ee2adac 799 }
goldmas 32:7f8e3ee2adac 800 else
goldmas 32:7f8e3ee2adac 801 {
goldmas 33:c54841d11156 802 bras_select_5 = 5 ;
goldmas 33:c54841d11156 803 TEST_SERVO_5.Draw(DIY_GREY, BLANC);
goldmas 32:7f8e3ee2adac 804 }
goldmas 32:7f8e3ee2adac 805 }
goldmas 32:7f8e3ee2adac 806 else if (TEST_ATTRAPER.Touched())
goldmas 32:7f8e3ee2adac 807 {
goldmas 33:c54841d11156 808 while(TEST_ATTRAPER.Touched()) ;
goldmas 33:c54841d11156 809 unsigned char message_droit_at, message_gauche_at, nombre_de_chiffre_droite, nombre_de_chiffre_gauche;
goldmas 33:c54841d11156 810 message_droit_at = 100 * bras_select_2 + 10 * bras_select_1 + bras_select_0 ;
goldmas 33:c54841d11156 811 message_gauche_at = 100 * bras_select_5 + 10 * bras_select_4 + bras_select_3 ;
goldmas 33:c54841d11156 812
goldmas 33:c54841d11156 813 switch (message_gauche_at)
goldmas 33:c54841d11156 814 {
goldmas 33:c54841d11156 815 case 31 : //on dépasse la taille d'un char donc on met la valeur en comptant le dépassement
goldmas 33:c54841d11156 816 choix_bras = 66 ;
goldmas 33:c54841d11156 817 SendMsgCan(BRAS_AT, &choix_bras,sizeof(choix_bras));
goldmas 33:c54841d11156 818 waitingAckFrom = 0;
goldmas 33:c54841d11156 819 waitingAckID =0;
goldmas 33:c54841d11156 820 break ;
goldmas 33:c54841d11156 821 case 28 : //on dépasse la taille d'un char donc on met la valeur en comptant le dépassement
goldmas 33:c54841d11156 822 choix_bras = 54 ;
goldmas 33:c54841d11156 823 SendMsgCan(BRAS_AT, &choix_bras,sizeof(choix_bras));
goldmas 33:c54841d11156 824 waitingAckFrom = 0;
goldmas 33:c54841d11156 825 waitingAckID =0;
goldmas 33:c54841d11156 826 break ;
goldmas 33:c54841d11156 827 case 247 : //on dépasse la taille d'un char donc on met la valeur en comptant le dépassement
goldmas 33:c54841d11156 828 choix_bras = 53 ;
goldmas 33:c54841d11156 829 SendMsgCan(BRAS_AT, &choix_bras,sizeof(choix_bras));
goldmas 33:c54841d11156 830 waitingAckFrom = 0;
goldmas 33:c54841d11156 831 waitingAckID =0;
goldmas 33:c54841d11156 832 break ;
goldmas 33:c54841d11156 833 case 43 :
goldmas 33:c54841d11156 834 choix_bras = 43 ;
goldmas 33:c54841d11156 835 SendMsgCan(BRAS_AT, &choix_bras,sizeof(choix_bras));
goldmas 33:c54841d11156 836 waitingAckFrom = 0;
goldmas 33:c54841d11156 837 waitingAckID =0;
goldmas 33:c54841d11156 838 break ;
goldmas 33:c54841d11156 839 case 244 : //on dépasse la taille d'un char donc on met la valeur en comptant le dépassement
goldmas 33:c54841d11156 840 choix_bras = 5 ;
goldmas 33:c54841d11156 841 SendMsgCan(BRAS_AT, &choix_bras,sizeof(choix_bras));
goldmas 33:c54841d11156 842 waitingAckFrom = 0;
goldmas 33:c54841d11156 843 waitingAckID =0;
goldmas 33:c54841d11156 844 break ;
goldmas 33:c54841d11156 845 case 40 :
goldmas 33:c54841d11156 846 choix_bras = 4 ;
goldmas 33:c54841d11156 847 SendMsgCan(BRAS_AT, &choix_bras,sizeof(choix_bras));
goldmas 33:c54841d11156 848 waitingAckFrom = 0;
goldmas 33:c54841d11156 849 waitingAckID =0;
goldmas 33:c54841d11156 850 break ;
goldmas 33:c54841d11156 851 case 3 :
goldmas 33:c54841d11156 852 choix_bras = 3 ;
goldmas 33:c54841d11156 853 SendMsgCan(BRAS_AT, &choix_bras,sizeof(choix_bras));
goldmas 33:c54841d11156 854 waitingAckFrom = 0;
goldmas 33:c54841d11156 855 waitingAckID =0;
goldmas 33:c54841d11156 856 break ;
goldmas 33:c54841d11156 857 }
goldmas 33:c54841d11156 858
goldmas 33:c54841d11156 859 switch (message_droit_at)
goldmas 33:c54841d11156 860 {
goldmas 33:c54841d11156 861 case 210 :
goldmas 33:c54841d11156 862 choix_bras = 210 ;
goldmas 33:c54841d11156 863 SendMsgCan(BRAS_AT, &choix_bras,sizeof(choix_bras));
goldmas 33:c54841d11156 864 waitingAckFrom = 0;
goldmas 33:c54841d11156 865 waitingAckID =0;
goldmas 33:c54841d11156 866 break ;
goldmas 33:c54841d11156 867 case 217 :
goldmas 33:c54841d11156 868 choix_bras = 21 ;
goldmas 33:c54841d11156 869 SendMsgCan(BRAS_AT, &choix_bras,sizeof(choix_bras));
goldmas 33:c54841d11156 870 waitingAckFrom = 0;
goldmas 33:c54841d11156 871 waitingAckID =0;
goldmas 33:c54841d11156 872 break ;
goldmas 33:c54841d11156 873 case 200 :
goldmas 33:c54841d11156 874 choix_bras = 20 ;
goldmas 33:c54841d11156 875 SendMsgCan(BRAS_AT, &choix_bras,sizeof(choix_bras));
goldmas 33:c54841d11156 876 waitingAckFrom = 0;
goldmas 33:c54841d11156 877 waitingAckID =0;
goldmas 33:c54841d11156 878 break ;
goldmas 33:c54841d11156 879 case 10 :
goldmas 33:c54841d11156 880 choix_bras = 10 ;
goldmas 33:c54841d11156 881 SendMsgCan(BRAS_AT, &choix_bras,sizeof(choix_bras));
goldmas 33:c54841d11156 882 waitingAckFrom = 0;
goldmas 33:c54841d11156 883 waitingAckID =0;
goldmas 33:c54841d11156 884 break ;
goldmas 33:c54841d11156 885 case 207 :
goldmas 33:c54841d11156 886 choix_bras = 2 ;
goldmas 33:c54841d11156 887 SendMsgCan(BRAS_AT, &choix_bras,sizeof(choix_bras));
goldmas 33:c54841d11156 888 waitingAckFrom = 0;
goldmas 33:c54841d11156 889 waitingAckID =0;
goldmas 33:c54841d11156 890 break ;
goldmas 33:c54841d11156 891 case 17 :
goldmas 33:c54841d11156 892 choix_bras = 1 ;
goldmas 33:c54841d11156 893 SendMsgCan(BRAS_AT, &choix_bras,sizeof(choix_bras));
goldmas 33:c54841d11156 894 waitingAckFrom = 0;
goldmas 33:c54841d11156 895 waitingAckID =0;
goldmas 33:c54841d11156 896 break ;
goldmas 33:c54841d11156 897 case 0 :
goldmas 33:c54841d11156 898 choix_bras = 0 ;
goldmas 33:c54841d11156 899 SendMsgCan(BRAS_AT, &choix_bras,sizeof(choix_bras));
goldmas 33:c54841d11156 900 waitingAckFrom = 0;
goldmas 33:c54841d11156 901 waitingAckID =0;
goldmas 33:c54841d11156 902 break ;
goldmas 33:c54841d11156 903 }
goldmas 33:c54841d11156 904
goldmas 33:c54841d11156 905 message_droit_at = 0 ;
goldmas 33:c54841d11156 906 message_gauche_at = 0 ;
goldmas 33:c54841d11156 907
goldmas 33:c54841d11156 908 TEST_ATTRAPER.Draw(BLEU, BLANC);
goldmas 33:c54841d11156 909 }
goldmas 33:c54841d11156 910 else if (TEST_RELACHER.Touched())
goldmas 33:c54841d11156 911 {
goldmas 33:c54841d11156 912 while(TEST_RELACHER.Touched());
goldmas 33:c54841d11156 913 unsigned char message_droit_re, message_gauche_re;
goldmas 33:c54841d11156 914 message_droit_re = 100 * bras_select_2 + 10 * bras_select_1 + bras_select_0 ;
goldmas 33:c54841d11156 915 message_gauche_re = 100 * bras_select_5 + 10 * bras_select_4 + bras_select_3 ;
goldmas 33:c54841d11156 916 switch (message_droit_re)
goldmas 33:c54841d11156 917 {
goldmas 33:c54841d11156 918 case 210 :
goldmas 33:c54841d11156 919 choix_bras = 210 ;
goldmas 33:c54841d11156 920 SendMsgCan(BRAS_RE, &choix_bras,sizeof(choix_bras));
goldmas 33:c54841d11156 921 waitingAckFrom = 0;
goldmas 33:c54841d11156 922 waitingAckID =0;
goldmas 33:c54841d11156 923 break ;
goldmas 33:c54841d11156 924 case 217 :
goldmas 33:c54841d11156 925 choix_bras = 21 ;
goldmas 33:c54841d11156 926 SendMsgCan(BRAS_RE, &choix_bras,sizeof(choix_bras));
goldmas 33:c54841d11156 927 waitingAckFrom = 0;
goldmas 33:c54841d11156 928 waitingAckID =0;
goldmas 33:c54841d11156 929 break ;
goldmas 33:c54841d11156 930 case 200 :
goldmas 33:c54841d11156 931 choix_bras = 20 ;
goldmas 33:c54841d11156 932 SendMsgCan(BRAS_RE, &choix_bras,sizeof(choix_bras));
goldmas 33:c54841d11156 933 waitingAckFrom = 0;
goldmas 33:c54841d11156 934 waitingAckID =0;
goldmas 33:c54841d11156 935 break ;
goldmas 33:c54841d11156 936 case 10 :
goldmas 33:c54841d11156 937 choix_bras = 10 ;
goldmas 33:c54841d11156 938 SendMsgCan(BRAS_RE, &choix_bras,sizeof(choix_bras));
goldmas 33:c54841d11156 939 waitingAckFrom = 0;
goldmas 33:c54841d11156 940 waitingAckID =0;
goldmas 33:c54841d11156 941 break ;
goldmas 33:c54841d11156 942 case 207 :
goldmas 33:c54841d11156 943 choix_bras = 2 ;
goldmas 33:c54841d11156 944 SendMsgCan(BRAS_RE, &choix_bras,sizeof(choix_bras));
goldmas 33:c54841d11156 945 waitingAckFrom = 0;
goldmas 33:c54841d11156 946 waitingAckID =0;
goldmas 33:c54841d11156 947 break ;
goldmas 33:c54841d11156 948 case 17 :
goldmas 33:c54841d11156 949 choix_bras = 1 ;
goldmas 33:c54841d11156 950 SendMsgCan(BRAS_RE, &choix_bras,sizeof(choix_bras));
goldmas 33:c54841d11156 951 waitingAckFrom = 0;
goldmas 33:c54841d11156 952 waitingAckID =0;
goldmas 33:c54841d11156 953 break ;
goldmas 33:c54841d11156 954 case 0 :
goldmas 33:c54841d11156 955 choix_bras = 0 ;
goldmas 33:c54841d11156 956 SendMsgCan(BRAS_RE, &choix_bras,sizeof(choix_bras));
goldmas 33:c54841d11156 957 waitingAckFrom = 0;
goldmas 33:c54841d11156 958 waitingAckID =0;
goldmas 33:c54841d11156 959 break ;
goldmas 33:c54841d11156 960 }
goldmas 33:c54841d11156 961
goldmas 33:c54841d11156 962 switch (message_gauche_re)
goldmas 33:c54841d11156 963 {
goldmas 33:c54841d11156 964 case 31 :
goldmas 33:c54841d11156 965 choix_bras = 66 ;
goldmas 33:c54841d11156 966 SendMsgCan(BRAS_RE, &choix_bras,sizeof(choix_bras));
goldmas 33:c54841d11156 967 waitingAckFrom = 0;
goldmas 33:c54841d11156 968 waitingAckID =0;
goldmas 33:c54841d11156 969 break ;
goldmas 33:c54841d11156 970 case 28 :
goldmas 33:c54841d11156 971 choix_bras = 54 ;
goldmas 33:c54841d11156 972 SendMsgCan(BRAS_RE, &choix_bras,sizeof(choix_bras));
goldmas 33:c54841d11156 973 waitingAckFrom = 0;
goldmas 33:c54841d11156 974 waitingAckID =0;
goldmas 33:c54841d11156 975 break ;
goldmas 33:c54841d11156 976 case 247 :
goldmas 33:c54841d11156 977 choix_bras = 53 ;
goldmas 33:c54841d11156 978 SendMsgCan(BRAS_RE, &choix_bras,sizeof(choix_bras));
goldmas 33:c54841d11156 979 waitingAckFrom = 0;
goldmas 33:c54841d11156 980 waitingAckID =0;
goldmas 33:c54841d11156 981 break ;
goldmas 33:c54841d11156 982 case 43 :
goldmas 33:c54841d11156 983 choix_bras = 43 ;
goldmas 33:c54841d11156 984 SendMsgCan(BRAS_RE, &choix_bras,sizeof(choix_bras));
goldmas 33:c54841d11156 985 waitingAckFrom = 0;
goldmas 33:c54841d11156 986 waitingAckID =0;
goldmas 33:c54841d11156 987 break ;
goldmas 33:c54841d11156 988 case 244 :
goldmas 33:c54841d11156 989 choix_bras = 5 ;
goldmas 33:c54841d11156 990 SendMsgCan(BRAS_RE, &choix_bras,sizeof(choix_bras));
goldmas 33:c54841d11156 991 waitingAckFrom = 0;
goldmas 33:c54841d11156 992 waitingAckID =0;
goldmas 33:c54841d11156 993 break ;
goldmas 33:c54841d11156 994 case 40 :
goldmas 33:c54841d11156 995 choix_bras = 4 ;
goldmas 33:c54841d11156 996 SendMsgCan(BRAS_RE, &choix_bras,sizeof(choix_bras));
goldmas 33:c54841d11156 997 waitingAckFrom = 0;
goldmas 33:c54841d11156 998 waitingAckID =0;
goldmas 33:c54841d11156 999 break ;
goldmas 33:c54841d11156 1000 case 3 :
goldmas 33:c54841d11156 1001 choix_bras = 3 ;
goldmas 33:c54841d11156 1002 SendMsgCan(BRAS_RE, &choix_bras,sizeof(choix_bras));
goldmas 33:c54841d11156 1003 waitingAckFrom = 0;
goldmas 33:c54841d11156 1004 waitingAckID =0;
goldmas 33:c54841d11156 1005 break ;
goldmas 33:c54841d11156 1006 }
goldmas 33:c54841d11156 1007 message_droit_re = 0 ;
goldmas 33:c54841d11156 1008 message_gauche_re = 0 ;
goldmas 33:c54841d11156 1009
goldmas 33:c54841d11156 1010 TEST_RELACHER.Draw(BLEU, BLANC);
goldmas 32:7f8e3ee2adac 1011
gabrieltetar 21:d137ec53c3a9 1012 }
gabrieltetar 21:d137ec53c3a9 1013 }
gabrieltetar 21:d137ec53c3a9 1014 break;
gabrieltetar 21:d137ec53c3a9 1015
gabrieltetar 21:d137ec53c3a9 1016 case TEST_COULEUR:
gabrieltetar 21:d137ec53c3a9 1017 lcd.Clear (LCD_COLOR_WHITE);
gabrieltetar 21:d137ec53c3a9 1018 lcd.DisplayStringAt(0, LINE(0), (uint8_t *)"Test Couleur", LEFT_MODE);
gabrieltetar 24:1a13c998c7ac 1019 TEST_A.Draw(BLEU, BLANC);
gabrieltetar 24:1a13c998c7ac 1020 TEST_B.Draw(BLEU, BLANC);
gabrieltetar 24:1a13c998c7ac 1021 TEST_C.Draw(BLEU, BLANC);
gabrieltetar 24:1a13c998c7ac 1022 TEST_D.Draw(BLEU, BLANC);
gabrieltetar 21:d137ec53c3a9 1023 RETOUR.Draw(0xFFFF0000,0);
gabrieltetar 21:d137ec53c3a9 1024 while(strat_etat_s==TEST_COULEUR) {
gabrieltetar 21:d137ec53c3a9 1025 if(RETOUR.Touched()) {
gabrieltetar 21:d137ec53c3a9 1026 while (RETOUR.Touched());
gabrieltetar 21:d137ec53c3a9 1027 strat_etat_s=DEMO;
gabrieltetar 21:d137ec53c3a9 1028 lcd.Clear (LCD_COLOR_WHITE);
gabrieltetar 24:1a13c998c7ac 1029 }else if(TEST_A.Touched()) {
gabrieltetar 24:1a13c998c7ac 1030 while (TEST_A.Touched());
gabrieltetar 24:1a13c998c7ac 1031 SendRawId(TEST_BRAS_A);
gabrieltetar 24:1a13c998c7ac 1032 TEST_A.Draw(BLEU, BLANC);
gabrieltetar 24:1a13c998c7ac 1033 } else if(TEST_B.Touched()) {
gabrieltetar 24:1a13c998c7ac 1034 while (TEST_B.Touched());
gabrieltetar 24:1a13c998c7ac 1035 SendRawId(TEST_BRAS_B);
gabrieltetar 24:1a13c998c7ac 1036 TEST_B.Draw(BLEU, BLANC);
gabrieltetar 24:1a13c998c7ac 1037 } else if(TEST_C.Touched()) {
gabrieltetar 24:1a13c998c7ac 1038 while (TEST_C.Touched());
gabrieltetar 24:1a13c998c7ac 1039 SendRawId(TEST_BRAS_C);
gabrieltetar 24:1a13c998c7ac 1040 TEST_C.Draw(BLEU, BLANC);
gabrieltetar 24:1a13c998c7ac 1041 } else if(TEST_D.Touched()) {
gabrieltetar 24:1a13c998c7ac 1042 while (TEST_D.Touched());
gabrieltetar 24:1a13c998c7ac 1043 SendRawId(TEST_BRAS_D);
gabrieltetar 24:1a13c998c7ac 1044 TEST_D.Draw(BLEU, BLANC);
gabrieltetar 21:d137ec53c3a9 1045 }
gabrieltetar 21:d137ec53c3a9 1046 }
gabrieltetar 21:d137ec53c3a9 1047 break;
gabrieltetar 21:d137ec53c3a9 1048
gabrieltetar 21:d137ec53c3a9 1049 case TEST_MOTEUR:
gabrieltetar 21:d137ec53c3a9 1050 lcd.SetBackColor(LCD_COLOR_WHITE);
gabrieltetar 21:d137ec53c3a9 1051 lcd.SetTextColor(LCD_COLOR_BLACK);
gabrieltetar 21:d137ec53c3a9 1052 lcd.Clear (LCD_COLOR_WHITE);
gabrieltetar 21:d137ec53c3a9 1053 lcd.Clear (LCD_COLOR_WHITE);
gabrieltetar 21:d137ec53c3a9 1054 lcd.DisplayStringAt(0, LINE(0), (uint8_t *)"Test Moteur", LEFT_MODE);
gabrieltetar 21:d137ec53c3a9 1055 RETOUR.Draw(0xFFFF0000,0);
gabrieltetar 21:d137ec53c3a9 1056 TEST_A.Draw(BLEU, BLANC);
gabrieltetar 21:d137ec53c3a9 1057 TEST_B.Draw(BLEU, BLANC);
gabrieltetar 21:d137ec53c3a9 1058 while(strat_etat_s==TEST_MOTEUR) {
gabrieltetar 21:d137ec53c3a9 1059 if(RETOUR.Touched()) {
gabrieltetar 21:d137ec53c3a9 1060 while (RETOUR.Touched());
gabrieltetar 21:d137ec53c3a9 1061 strat_etat_s=DEMO;
gabrieltetar 21:d137ec53c3a9 1062 } else if(TEST_A.Touched()) {
gabrieltetar 21:d137ec53c3a9 1063 while (TEST_A.Touched());
gabrieltetar 21:d137ec53c3a9 1064 BendRadius(150,1800,1,0);
gabrieltetar 21:d137ec53c3a9 1065 TEST_A.Draw(BLEU, BLANC);
gabrieltetar 21:d137ec53c3a9 1066 } else if(TEST_B.Touched()) {
gabrieltetar 21:d137ec53c3a9 1067 while (TEST_B.Touched());
gabrieltetar 21:d137ec53c3a9 1068 BendRadius(150,1800,0,0);
gabrieltetar 21:d137ec53c3a9 1069 TEST_B.Draw(BLEU, BLANC);
gabrieltetar 21:d137ec53c3a9 1070 }
gabrieltetar 21:d137ec53c3a9 1071 }
gabrieltetar 21:d137ec53c3a9 1072 break; ///////////////////////////////////////////FIN DES DEMOS/////////////////////////////////////////////////
gabrieltetar 21:d137ec53c3a9 1073
gabrieltetar 21:d137ec53c3a9 1074
gabrieltetar 21:d137ec53c3a9 1075 case SELECT_SIDE : // CHOIX DU COTE DU TERRAIN + INVERSION DE LA STRAT SI COTE ORANGE+ ENVOI DU COTE A LA CARTE CAPTEUR/ACTIONNEURS
gabrieltetar 21:d137ec53c3a9 1076 lcd.Clear(LCD_COLOR_WHITE);
gabrieltetar 21:d137ec53c3a9 1077 lcd.SetBackColor(LCD_COLOR_WHITE);
gabrieltetar 21:d137ec53c3a9 1078 lcd.SetTextColor(LCD_COLOR_BLACK);
gabrieltetar 21:d137ec53c3a9 1079
gabrieltetar 21:d137ec53c3a9 1080 lcd.DisplayStringAt(70, LINE(0), (uint8_t *)"Choisir le cote", LEFT_MODE);
gabrieltetar 21:d137ec53c3a9 1081 COTE_JAUNE.Draw(JAUNE, 0);
gabrieltetar 21:d137ec53c3a9 1082 COTE_VIOLET.Draw(VIOLET, 0);
gabrieltetar 21:d137ec53c3a9 1083 RETOUR.Draw(LCD_COLOR_RED, 0);
gabrieltetar 21:d137ec53c3a9 1084
gabrieltetar 21:d137ec53c3a9 1085
gabrieltetar 21:d137ec53c3a9 1086 while (strat_etat_s == SELECT_SIDE) {
gabrieltetar 21:d137ec53c3a9 1087 canProcessRx();
gabrieltetar 21:d137ec53c3a9 1088 if(COTE_JAUNE.Touched()) {
maximilienlv 28:7f2990747e09 1089 Cote = 0x1;
gabrieltetar 21:d137ec53c3a9 1090 InversStrat = Cote;
gabrieltetar 21:d137ec53c3a9 1091 strat_etat_s = TACTIQUE;
gabrieltetar 21:d137ec53c3a9 1092 CANMessage trame_Tx = CANMessage();
gabrieltetar 21:d137ec53c3a9 1093 trame_Tx.len = 1;
gabrieltetar 21:d137ec53c3a9 1094 trame_Tx.format = CANStandard;
gabrieltetar 21:d137ec53c3a9 1095 trame_Tx.type = CANData;
gabrieltetar 21:d137ec53c3a9 1096 trame_Tx.id=CHOICE_COLOR;
gabrieltetar 21:d137ec53c3a9 1097 trame_Tx.data[0]=Cote;
gabrieltetar 21:d137ec53c3a9 1098 can2.write(trame_Tx);
gabrieltetar 21:d137ec53c3a9 1099 while(COTE_JAUNE.Touched());
gabrieltetar 21:d137ec53c3a9 1100
gabrieltetar 21:d137ec53c3a9 1101 }
gabrieltetar 21:d137ec53c3a9 1102
gabrieltetar 21:d137ec53c3a9 1103 if(COTE_VIOLET.Touched()) {
maximilienlv 28:7f2990747e09 1104 Cote = 0x0;
gabrieltetar 21:d137ec53c3a9 1105 InversStrat= Cote;
gabrieltetar 21:d137ec53c3a9 1106 strat_etat_s = TACTIQUE;
gabrieltetar 21:d137ec53c3a9 1107 CANMessage trame_Tx = CANMessage();
gabrieltetar 21:d137ec53c3a9 1108 trame_Tx.len = 1;
gabrieltetar 21:d137ec53c3a9 1109 trame_Tx.format = CANStandard;
gabrieltetar 21:d137ec53c3a9 1110 trame_Tx.type = CANData;
gabrieltetar 21:d137ec53c3a9 1111 trame_Tx.id=CHOICE_COLOR;
gabrieltetar 21:d137ec53c3a9 1112 trame_Tx.data[0]=Cote;
gabrieltetar 21:d137ec53c3a9 1113 can2.write(trame_Tx);
gabrieltetar 21:d137ec53c3a9 1114 while(COTE_VIOLET.Touched());
gabrieltetar 21:d137ec53c3a9 1115 }
gabrieltetar 21:d137ec53c3a9 1116
gabrieltetar 21:d137ec53c3a9 1117 if(RETOUR.Touched()) {
gabrieltetar 21:d137ec53c3a9 1118 strat_etat_s = CHOIX;
gabrieltetar 21:d137ec53c3a9 1119 while(RETOUR.Touched());
gabrieltetar 21:d137ec53c3a9 1120 }
gabrieltetar 21:d137ec53c3a9 1121 }
gabrieltetar 21:d137ec53c3a9 1122
gabrieltetar 21:d137ec53c3a9 1123 break;
gabrieltetar 21:d137ec53c3a9 1124
gabrieltetar 21:d137ec53c3a9 1125 case TACTIQUE : //AFFICHE LA LISTE DES STRATS AFIN DE SELECTIONNER CELLE VOULUE
slowness 29:ff575aff301f 1126 if (Cote == 1) {
gabrieltetar 21:d137ec53c3a9 1127 lcd.Clear(JAUNE);
gabrieltetar 21:d137ec53c3a9 1128 lcd.SetBackColor(JAUNE);
slowness 29:ff575aff301f 1129 } else if (Cote == 0) {
gabrieltetar 21:d137ec53c3a9 1130 lcd.Clear(VIOLET);
gabrieltetar 21:d137ec53c3a9 1131 lcd.SetBackColor(VIOLET);
gabrieltetar 21:d137ec53c3a9 1132 } else {
gabrieltetar 21:d137ec53c3a9 1133 lcd.Clear(BLEU);
gabrieltetar 21:d137ec53c3a9 1134 lcd.SetBackColor(BLEU);
gabrieltetar 21:d137ec53c3a9 1135 }
gabrieltetar 21:d137ec53c3a9 1136
gabrieltetar 21:d137ec53c3a9 1137 lcd.SetTextColor(LCD_COLOR_BLACK);
gabrieltetar 21:d137ec53c3a9 1138
gabrieltetar 21:d137ec53c3a9 1139 lcd.DisplayStringAt(20, LINE(0), (uint8_t *)"Choisir une strategie", LEFT_MODE);
gabrieltetar 21:d137ec53c3a9 1140
gabrieltetar 21:d137ec53c3a9 1141 nbStrat = Bouton_Strat(); // retourne valeur de Strategie si bouton strat renvoi -1 on reviens en arriere
gabrieltetar 21:d137ec53c3a9 1142 if (nbStrat == -1) {
gabrieltetar 21:d137ec53c3a9 1143 strat_etat_s = SELECT_SIDE;
gabrieltetar 21:d137ec53c3a9 1144 } else {
gabrieltetar 21:d137ec53c3a9 1145 strat_etat_s = DETAILS;
gabrieltetar 21:d137ec53c3a9 1146 }
gabrieltetar 21:d137ec53c3a9 1147 wait(0.1);
gabrieltetar 21:d137ec53c3a9 1148 break;
gabrieltetar 21:d137ec53c3a9 1149
gabrieltetar 21:d137ec53c3a9 1150 case DETAILS : //SECONDE VALIDATION DE LA STRAT
gabrieltetar 21:d137ec53c3a9 1151 lcd.Clear(LCD_COLOR_WHITE);
gabrieltetar 21:d137ec53c3a9 1152 lcd.SetBackColor(LCD_COLOR_WHITE);
gabrieltetar 21:d137ec53c3a9 1153 lcd.SetTextColor(LCD_COLOR_BLACK);
gabrieltetar 21:d137ec53c3a9 1154 CHECK.Draw(VERT);
gabrieltetar 21:d137ec53c3a9 1155 RETOUR.Draw(LCD_COLOR_RED);
gabrieltetar 21:d137ec53c3a9 1156
gabrieltetar 21:d137ec53c3a9 1157 SelectionStrat(nbStrat); //affiche la stratégie selectionnée
gabrieltetar 21:d137ec53c3a9 1158
gabrieltetar 21:d137ec53c3a9 1159 while (strat_etat_s == DETAILS) {
gabrieltetar 21:d137ec53c3a9 1160 canProcessRx();
gabrieltetar 21:d137ec53c3a9 1161 if (CHECK.Touched()) {
gabrieltetar 21:d137ec53c3a9 1162 if(gameEtat == ETAT_CONFIG) {
gabrieltetar 21:d137ec53c3a9 1163 gameEtat = ETAT_GAME_INIT;
gabrieltetar 21:d137ec53c3a9 1164 strat_etat_s=LECTURE;
gabrieltetar 21:d137ec53c3a9 1165
gabrieltetar 21:d137ec53c3a9 1166 }
gabrieltetar 21:d137ec53c3a9 1167 while(CHECK.Touched());
gabrieltetar 21:d137ec53c3a9 1168 }
gabrieltetar 21:d137ec53c3a9 1169
gabrieltetar 21:d137ec53c3a9 1170 if(RETOUR.Touched()) {
gabrieltetar 21:d137ec53c3a9 1171 strat_etat_s = TACTIQUE;
gabrieltetar 21:d137ec53c3a9 1172 while(RETOUR.Touched());
gabrieltetar 21:d137ec53c3a9 1173 }
gabrieltetar 21:d137ec53c3a9 1174 }
gabrieltetar 21:d137ec53c3a9 1175 break;
gabrieltetar 21:d137ec53c3a9 1176
gabrieltetar 21:d137ec53c3a9 1177
gabrieltetar 21:d137ec53c3a9 1178 case LECTURE :
gabrieltetar 21:d137ec53c3a9 1179 break;
gabrieltetar 21:d137ec53c3a9 1180 case AFF_WAIT_JACK : //FONCTIONS D'AFFICHAGE DE L'ATTENTE DU JACK
gabrieltetar 21:d137ec53c3a9 1181 lcd.Clear(BLANC);
gabrieltetar 21:d137ec53c3a9 1182 lcd.SetBackColor(LCD_COLOR_WHITE);
gabrieltetar 21:d137ec53c3a9 1183 lcd.SetTextColor(LCD_COLOR_BLACK);
gabrieltetar 21:d137ec53c3a9 1184
gabrieltetar 21:d137ec53c3a9 1185 if (Cote == 0) {
goldmas 35:2a745eeb7922 1186 lcd.Clear(LCD_COLOR_WHITE);
goldmas 35:2a745eeb7922 1187 lcd.SetBackColor(LCD_COLOR_WHITE);
gabrieltetar 21:d137ec53c3a9 1188 } else if (Cote == 1) {
goldmas 35:2a745eeb7922 1189 lcd.Clear(LCD_COLOR_WHITE);
goldmas 35:2a745eeb7922 1190 lcd.SetBackColor(LCD_COLOR_WHITE);
gabrieltetar 21:d137ec53c3a9 1191 } else {
gabrieltetar 21:d137ec53c3a9 1192 lcd.Clear(VERT);
gabrieltetar 21:d137ec53c3a9 1193 lcd.SetBackColor(VERT);
gabrieltetar 21:d137ec53c3a9 1194 }
gabrieltetar 21:d137ec53c3a9 1195 canProcessRx();
gabrieltetar 21:d137ec53c3a9 1196 lcd.DisplayStringAt(0, LINE(0), (uint8_t *)"En attente du Jack", CENTER_MODE);
gabrieltetar 21:d137ec53c3a9 1197 strat_etat_s=WAIT_JACK;
goldmas 35:2a745eeb7922 1198
gabrieltetar 21:d137ec53c3a9 1199 break;
gabrieltetar 21:d137ec53c3a9 1200
goldmas 35:2a745eeb7922 1201 case WAIT_JACK :
goldmas 35:2a745eeb7922 1202 if(unique == 0)
goldmas 35:2a745eeb7922 1203 {
goldmas 35:2a745eeb7922 1204 lcd.SetTextColor(LCD_COLOR_BLUE);
goldmas 35:2a745eeb7922 1205 lcd.DrawRect(0,50,400,320);
goldmas 35:2a745eeb7922 1206 lcd.DisplayStringAt(100, LINE(8), (unsigned char *)"Score :", LEFT_MODE);
goldmas 35:2a745eeb7922 1207 lcd.SetTextColor(LCD_COLOR_RED);
goldmas 35:2a745eeb7922 1208 lcd.DrawRect(0,400,400,320);
goldmas 35:2a745eeb7922 1209 lcd.DisplayStringAt(100, LINE(22), (unsigned char *)"Timer :", LEFT_MODE);
goldmas 35:2a745eeb7922 1210 unique = 1;
goldmas 35:2a745eeb7922 1211 }
goldmas 35:2a745eeb7922 1212 int x_offsetc = -145*cos(theta_robot*M_PI/1800) - 0*sin(theta_robot*M_PI*1800);
goldmas 35:2a745eeb7922 1213 int y_offsetc = -145*sin(theta_robot*M_PI/1800) + 0*cos(theta_robot*M_PI*1800);
goldmas 35:2a745eeb7922 1214
goldmas 35:2a745eeb7922 1215 lcd.SetTextColor(LCD_COLOR_BLACK);
goldmas 35:2a745eeb7922 1216 lcd.DisplayStringAt(100, LINE(14), (unsigned char *)"x_robot :", LEFT_MODE);
goldmas 35:2a745eeb7922 1217 sprintf(toto,"%04d",(short)(x_robot+x_offsetc));
goldmas 35:2a745eeb7922 1218 lcd.DisplayStringAt(250, LINE(14), (unsigned char *)toto, LEFT_MODE);
goldmas 35:2a745eeb7922 1219
goldmas 35:2a745eeb7922 1220 lcd.DisplayStringAt(100, LINE(15), (unsigned char *)"y_robot :", LEFT_MODE);
goldmas 35:2a745eeb7922 1221 sprintf(toto,"%04d",(short)(y_robot+y_offsetc));
goldmas 35:2a745eeb7922 1222 lcd.DisplayStringAt(250, LINE(15), (unsigned char *)toto, LEFT_MODE);
goldmas 35:2a745eeb7922 1223
goldmas 35:2a745eeb7922 1224 lcd.DisplayStringAt(100, LINE(16), (unsigned char *)"t_robot :", LEFT_MODE);
goldmas 35:2a745eeb7922 1225 sprintf(toto,"%04d",theta_robot);
goldmas 35:2a745eeb7922 1226 lcd.DisplayStringAt(250, LINE(16), (unsigned char *)toto, LEFT_MODE);
goldmas 35:2a745eeb7922 1227
goldmas 35:2a745eeb7922 1228 lcd.DisplayStringAt(100, LINE(17), (unsigned char *)"g_vert :", LEFT_MODE);
goldmas 35:2a745eeb7922 1229 sprintf(toto,"%04d",gobelet_vert);
goldmas 35:2a745eeb7922 1230 lcd.DisplayStringAt(250, LINE(17), (unsigned char *)toto, LEFT_MODE);
goldmas 35:2a745eeb7922 1231
goldmas 35:2a745eeb7922 1232 lcd.DisplayStringAt(100, LINE(18), (unsigned char *)"g_rouge :", LEFT_MODE);
goldmas 35:2a745eeb7922 1233 sprintf(toto,"%04d",gobelet_rouge);
goldmas 35:2a745eeb7922 1234 lcd.DisplayStringAt(250, LINE(18), (unsigned char *)toto, LEFT_MODE);
goldmas 35:2a745eeb7922 1235
goldmas 35:2a745eeb7922 1236 lcd.DisplayStringAt(100, LINE(19), (unsigned char *)"g_port :", LEFT_MODE);
goldmas 35:2a745eeb7922 1237 sprintf(toto,"%04d",gobelet_port);
goldmas 35:2a745eeb7922 1238 lcd.DisplayStringAt(250, LINE(19), (unsigned char *)toto, LEFT_MODE);
goldmas 35:2a745eeb7922 1239
goldmas 35:2a745eeb7922 1240 actual_time = gameTimer.read();
goldmas 35:2a745eeb7922 1241 if(actual_time != old_time)
goldmas 35:2a745eeb7922 1242 {
goldmas 35:2a745eeb7922 1243 lcd.SetTextColor(LCD_COLOR_BLUE);
goldmas 35:2a745eeb7922 1244 sprintf(toto,"%hd",score_final);
goldmas 35:2a745eeb7922 1245 lcd.DisplayStringAt(250, LINE(8), (unsigned char *)toto, LEFT_MODE);
goldmas 35:2a745eeb7922 1246
goldmas 35:2a745eeb7922 1247 lcd.SetTextColor(LCD_COLOR_RED);
goldmas 35:2a745eeb7922 1248 sprintf(toto,"%hd",actual_time);
goldmas 35:2a745eeb7922 1249 lcd.DisplayStringAt(250, LINE(22), (unsigned char *)toto, LEFT_MODE);
goldmas 35:2a745eeb7922 1250 old_time = actual_time;
goldmas 35:2a745eeb7922 1251 }
gabrieltetar 21:d137ec53c3a9 1252 break;
goldmas 35:2a745eeb7922 1253
goldmas 35:2a745eeb7922 1254
gabrieltetar 21:d137ec53c3a9 1255 case FIN : //AFFICHAGE DE FIN AVEC LE SCORE FINAL
goldmas 35:2a745eeb7922 1256 // lcd.Clear(LCD_COLOR_WHITE);
goldmas 35:2a745eeb7922 1257 // lcd.SetBackColor(LCD_COLOR_WHITE);
gabrieltetar 21:d137ec53c3a9 1258
gabrieltetar 21:d137ec53c3a9 1259
gabrieltetar 21:d137ec53c3a9 1260 while(1); // force le redemarage du robot
gabrieltetar 21:d137ec53c3a9 1261 //break;
goldmas 35:2a745eeb7922 1262 }
gabrieltetar 21:d137ec53c3a9 1263 }
gabrieltetar 21:d137ec53c3a9 1264 /****************************************************************************************/
gabrieltetar 21:d137ec53c3a9 1265 /* FUNCTION NAME: Bouton_Strat */
gabrieltetar 21:d137ec53c3a9 1266 /* DESCRIPTION : Sélection de la strat sur le lcd puis envoie sur CAN (à modifier!) */
gabrieltetar 21:d137ec53c3a9 1267 /****************************************************************************************/
gabrieltetar 21:d137ec53c3a9 1268 signed char Bouton_Strat (void)
gabrieltetar 21:d137ec53c3a9 1269 {
gabrieltetar 21:d137ec53c3a9 1270 char Ack_strat = 0;
gabrieltetar 21:d137ec53c3a9 1271 signed char Strat = 0;
gabrieltetar 21:d137ec53c3a9 1272 Button STRAT_1 (0, 30, 190, 110, strat_sd[0]);
gabrieltetar 21:d137ec53c3a9 1273 Button STRAT_2 (210, 30, 190, 110, strat_sd[1]);
gabrieltetar 21:d137ec53c3a9 1274 Button STRAT_3 (0, 150, 190, 110, strat_sd[2]);
gabrieltetar 21:d137ec53c3a9 1275 Button STRAT_4 (210, 150, 190, 110, strat_sd[3]);
gabrieltetar 21:d137ec53c3a9 1276 Button STRAT_5 (0, 270, 190, 110,strat_sd[4]);
gabrieltetar 21:d137ec53c3a9 1277 Button STRAT_6 (210, 270, 190, 110, strat_sd[5]);
gabrieltetar 21:d137ec53c3a9 1278 Button STRAT_7 (0, 390, 190, 110, strat_sd[6]);
gabrieltetar 21:d137ec53c3a9 1279 Button STRAT_8 (210, 390, 190, 110, strat_sd[7]);
gabrieltetar 21:d137ec53c3a9 1280 Button STRAT_9 (0, 510, 190, 110, strat_sd[8]);
gabrieltetar 21:d137ec53c3a9 1281 Button STRAT_10 (210, 510, 190, 110, strat_sd[9]);
gabrieltetar 21:d137ec53c3a9 1282 Button RETOUR (0, 680, 400, 110, "--Precedent--");
gabrieltetar 21:d137ec53c3a9 1283 //Definition des boutons
gabrieltetar 21:d137ec53c3a9 1284
gabrieltetar 21:d137ec53c3a9 1285 Ack_strat = 0;
gabrieltetar 21:d137ec53c3a9 1286 Strat = 0;
gabrieltetar 21:d137ec53c3a9 1287 STRAT_1.Draw(0xFFF0F0F0, 0);
gabrieltetar 21:d137ec53c3a9 1288 STRAT_2.Draw(0xFFF0F0F0, 0);
gabrieltetar 21:d137ec53c3a9 1289 STRAT_3.Draw(0xFFF0F0F0, 0);
gabrieltetar 21:d137ec53c3a9 1290 STRAT_4.Draw(0xFFF0F0F0, 0);
gabrieltetar 21:d137ec53c3a9 1291 STRAT_5.Draw(0xFFF0F0F0, 0);
gabrieltetar 21:d137ec53c3a9 1292 STRAT_6.Draw(0xFFF0F0F0, 0);
gabrieltetar 21:d137ec53c3a9 1293 STRAT_7.Draw(0xFFF0F0F0, 0);
gabrieltetar 21:d137ec53c3a9 1294 STRAT_8.Draw(0xFFF0F0F0, 0);
gabrieltetar 21:d137ec53c3a9 1295 STRAT_9.Draw(0xFFF0F0F0, 0);
gabrieltetar 21:d137ec53c3a9 1296 STRAT_10.Draw(0xFFF0F0F0, 0);
gabrieltetar 21:d137ec53c3a9 1297 RETOUR.Draw(0xFFFF0000, 0);
gabrieltetar 21:d137ec53c3a9 1298
gabrieltetar 21:d137ec53c3a9 1299 while(Ack_strat == 0) {
gabrieltetar 21:d137ec53c3a9 1300 canProcessRx();
gabrieltetar 21:d137ec53c3a9 1301 CANMessage msgTx=CANMessage();
gabrieltetar 21:d137ec53c3a9 1302 //msgTx.id=ECRAN_CHOICE_STRAT;
gabrieltetar 21:d137ec53c3a9 1303 if (RETOUR.Touched())
gabrieltetar 21:d137ec53c3a9 1304 return -1;
gabrieltetar 21:d137ec53c3a9 1305 while(RETOUR.Touched());
gabrieltetar 21:d137ec53c3a9 1306 //////////////////////////////STRATEGIE N°1
gabrieltetar 21:d137ec53c3a9 1307 if (STRAT_1.Touched()) {
gabrieltetar 21:d137ec53c3a9 1308 Strat = 0;
gabrieltetar 21:d137ec53c3a9 1309 //msgTx.data[0] = 0x1;
gabrieltetar 21:d137ec53c3a9 1310 //can2.write(msgTx);
gabrieltetar 21:d137ec53c3a9 1311 while(STRAT_1.Touched());
gabrieltetar 21:d137ec53c3a9 1312 Ack_strat =1;
gabrieltetar 21:d137ec53c3a9 1313 }
gabrieltetar 21:d137ec53c3a9 1314 /////////////////////////////STRATEGIE N°2
gabrieltetar 21:d137ec53c3a9 1315 if (STRAT_2.Touched()) {
gabrieltetar 21:d137ec53c3a9 1316 Strat = 1;
gabrieltetar 21:d137ec53c3a9 1317 //msgTx.data[0] = 0x2;
gabrieltetar 21:d137ec53c3a9 1318 //can2.write(msgTx);
gabrieltetar 21:d137ec53c3a9 1319 while(STRAT_2.Touched());
gabrieltetar 21:d137ec53c3a9 1320 Ack_strat =1;
gabrieltetar 21:d137ec53c3a9 1321 }
gabrieltetar 21:d137ec53c3a9 1322 //////////////////////////////STRATEGIE N°3
gabrieltetar 21:d137ec53c3a9 1323 if (STRAT_3.Touched()) {
gabrieltetar 21:d137ec53c3a9 1324 Strat = 2;
gabrieltetar 21:d137ec53c3a9 1325 //msgTx.data[0] = 0x3;
gabrieltetar 21:d137ec53c3a9 1326 //can2.write(msgTx);
gabrieltetar 21:d137ec53c3a9 1327 while(STRAT_3.Touched());
gabrieltetar 21:d137ec53c3a9 1328 Ack_strat =1;
gabrieltetar 21:d137ec53c3a9 1329 }
gabrieltetar 21:d137ec53c3a9 1330 /////////////////////////////STRATEGIE N°4
gabrieltetar 21:d137ec53c3a9 1331 if (STRAT_4.Touched()) {
gabrieltetar 21:d137ec53c3a9 1332 Strat = 3;
gabrieltetar 21:d137ec53c3a9 1333 //msgTx.data[0] = 0x4;
gabrieltetar 21:d137ec53c3a9 1334 //can2.write(msgTx);
gabrieltetar 21:d137ec53c3a9 1335 while(STRAT_4.Touched());
gabrieltetar 21:d137ec53c3a9 1336 Ack_strat =1;
gabrieltetar 21:d137ec53c3a9 1337 }
gabrieltetar 21:d137ec53c3a9 1338 ///////////////////////////////STRATEGIE N°5
gabrieltetar 21:d137ec53c3a9 1339 if (STRAT_5.Touched()) {
gabrieltetar 21:d137ec53c3a9 1340 Strat = 4;
gabrieltetar 21:d137ec53c3a9 1341 //msgTx.data[0] = 0x5;
gabrieltetar 21:d137ec53c3a9 1342 //can2.write(msgTx);
gabrieltetar 21:d137ec53c3a9 1343 while(STRAT_5.Touched());
gabrieltetar 21:d137ec53c3a9 1344 Ack_strat =1;
gabrieltetar 21:d137ec53c3a9 1345 }
gabrieltetar 21:d137ec53c3a9 1346 ////////////////////////////////STRATEGIE N°6
gabrieltetar 21:d137ec53c3a9 1347 if (STRAT_6.Touched()) {
gabrieltetar 21:d137ec53c3a9 1348 Strat = 5;
gabrieltetar 21:d137ec53c3a9 1349 //msgTx.data[0] = 0x6;
gabrieltetar 21:d137ec53c3a9 1350 //can2.write(msgTx);
gabrieltetar 21:d137ec53c3a9 1351 while(STRAT_6.Touched());
gabrieltetar 21:d137ec53c3a9 1352 Ack_strat =1;
gabrieltetar 21:d137ec53c3a9 1353 }
gabrieltetar 21:d137ec53c3a9 1354 /////////////////////////////////STRATEGIE N°7
gabrieltetar 21:d137ec53c3a9 1355 if (STRAT_7.Touched()) {
gabrieltetar 21:d137ec53c3a9 1356 Strat = 6;
gabrieltetar 21:d137ec53c3a9 1357 //msgTx.data[0] = 0x7;
gabrieltetar 21:d137ec53c3a9 1358 //can2.write(msgTx);
gabrieltetar 21:d137ec53c3a9 1359 while(STRAT_7.Touched());
gabrieltetar 21:d137ec53c3a9 1360 Ack_strat =1;
gabrieltetar 21:d137ec53c3a9 1361 }
gabrieltetar 21:d137ec53c3a9 1362 /////////////////////////////////STRATEGIE N°8
gabrieltetar 21:d137ec53c3a9 1363 if (STRAT_8.Touched()) {
gabrieltetar 21:d137ec53c3a9 1364 Strat = 7;
gabrieltetar 21:d137ec53c3a9 1365 //msgTx.data[0] = 0x8;
gabrieltetar 21:d137ec53c3a9 1366 //can2.write(msgTx);
gabrieltetar 21:d137ec53c3a9 1367 while(STRAT_8.Touched());
gabrieltetar 21:d137ec53c3a9 1368 Ack_strat =1;
gabrieltetar 21:d137ec53c3a9 1369 }
gabrieltetar 21:d137ec53c3a9 1370 /////////////////////////////////STRATEGIE N°9
gabrieltetar 21:d137ec53c3a9 1371 if (STRAT_9.Touched()) {
gabrieltetar 21:d137ec53c3a9 1372 Strat = 8;
gabrieltetar 21:d137ec53c3a9 1373 //msgTx.data[0] = 0x9;
gabrieltetar 21:d137ec53c3a9 1374 //can2.write(msgTx);
gabrieltetar 21:d137ec53c3a9 1375 while(STRAT_9.Touched());
gabrieltetar 21:d137ec53c3a9 1376 Ack_strat =1;
gabrieltetar 21:d137ec53c3a9 1377 }
gabrieltetar 21:d137ec53c3a9 1378 ///////////////////////////////////STRATEGIE N°10
gabrieltetar 21:d137ec53c3a9 1379 if (STRAT_10.Touched()) {
gabrieltetar 21:d137ec53c3a9 1380 Strat = 9;
gabrieltetar 21:d137ec53c3a9 1381 //msgTx.data[0] = 0xA;
gabrieltetar 21:d137ec53c3a9 1382 //can2.write(msgTx);
gabrieltetar 21:d137ec53c3a9 1383 while(STRAT_10.Touched());
gabrieltetar 21:d137ec53c3a9 1384 Ack_strat =1;
gabrieltetar 21:d137ec53c3a9 1385 }
gabrieltetar 21:d137ec53c3a9 1386
gabrieltetar 21:d137ec53c3a9 1387 }
gabrieltetar 21:d137ec53c3a9 1388 return Strat;
gabrieltetar 21:d137ec53c3a9 1389
gabrieltetar 21:d137ec53c3a9 1390 }
gabrieltetar 21:d137ec53c3a9 1391 /****************************************************************************************/
gabrieltetar 21:d137ec53c3a9 1392 /* FUNCTION NAME: SelectionStrat */
gabrieltetar 21:d137ec53c3a9 1393 /* DESCRIPTION : Affiche la Stratégie sélectionnée sur l'ihm */
gabrieltetar 21:d137ec53c3a9 1394 /****************************************************************************************/
gabrieltetar 21:d137ec53c3a9 1395
gabrieltetar 21:d137ec53c3a9 1396
gabrieltetar 21:d137ec53c3a9 1397 void SelectionStrat (unsigned char Strategie)
gabrieltetar 21:d137ec53c3a9 1398 {
gabrieltetar 21:d137ec53c3a9 1399 lcd.SetBackColor(LCD_COLOR_WHITE);
gabrieltetar 21:d137ec53c3a9 1400 lcd.SetTextColor(LCD_COLOR_BLACK);
gabrieltetar 21:d137ec53c3a9 1401
gabrieltetar 21:d137ec53c3a9 1402 switch (Strategie+1) {
gabrieltetar 21:d137ec53c3a9 1403 case 0x1 :
gabrieltetar 21:d137ec53c3a9 1404 //description de Strategie n°1
gabrieltetar 21:d137ec53c3a9 1405 lcd.DisplayStringAt(150, 0, (uint8_t *)strat_sd[Strategie], LEFT_MODE);
gabrieltetar 21:d137ec53c3a9 1406 break;
gabrieltetar 21:d137ec53c3a9 1407
gabrieltetar 21:d137ec53c3a9 1408 case 0x2 :
gabrieltetar 21:d137ec53c3a9 1409 //description de Strategie n°2
gabrieltetar 21:d137ec53c3a9 1410 lcd.DisplayStringAt(150,0, (uint8_t *)strat_sd[Strategie], LEFT_MODE);
gabrieltetar 21:d137ec53c3a9 1411 break;
gabrieltetar 21:d137ec53c3a9 1412
gabrieltetar 21:d137ec53c3a9 1413 case 0x3 :
gabrieltetar 21:d137ec53c3a9 1414 //description de Strategie n°3
gabrieltetar 21:d137ec53c3a9 1415 lcd.DisplayStringAt(150,0, (uint8_t *)strat_sd[Strategie], LEFT_MODE);
gabrieltetar 21:d137ec53c3a9 1416 break;
gabrieltetar 21:d137ec53c3a9 1417
gabrieltetar 21:d137ec53c3a9 1418 case 0x4 :
gabrieltetar 21:d137ec53c3a9 1419 //description de Strategie n°4
gabrieltetar 21:d137ec53c3a9 1420 lcd.DisplayStringAt(150,0, (uint8_t *)strat_sd[Strategie], LEFT_MODE);
gabrieltetar 21:d137ec53c3a9 1421 break;
gabrieltetar 21:d137ec53c3a9 1422
gabrieltetar 21:d137ec53c3a9 1423 case 0x5 :
gabrieltetar 21:d137ec53c3a9 1424 //description de Strategie n°5
gabrieltetar 21:d137ec53c3a9 1425 lcd.DisplayStringAt(150,0, (uint8_t *)strat_sd[Strategie], LEFT_MODE);
gabrieltetar 21:d137ec53c3a9 1426 break;
gabrieltetar 21:d137ec53c3a9 1427
gabrieltetar 21:d137ec53c3a9 1428 case 0x6 :
gabrieltetar 21:d137ec53c3a9 1429 //description de Strategie n°5
gabrieltetar 21:d137ec53c3a9 1430 lcd.DisplayStringAt(150,0, (uint8_t *)strat_sd[Strategie], LEFT_MODE);
gabrieltetar 21:d137ec53c3a9 1431 break;
gabrieltetar 21:d137ec53c3a9 1432
gabrieltetar 21:d137ec53c3a9 1433 case 0x7 :
gabrieltetar 21:d137ec53c3a9 1434 //description de Strategie n°5
gabrieltetar 21:d137ec53c3a9 1435 lcd.DisplayStringAt(150,0, (uint8_t *)strat_sd[Strategie], LEFT_MODE);
gabrieltetar 21:d137ec53c3a9 1436 break;
gabrieltetar 21:d137ec53c3a9 1437
gabrieltetar 21:d137ec53c3a9 1438 case 0x8 :
gabrieltetar 21:d137ec53c3a9 1439 //description de Strategie n°5
gabrieltetar 21:d137ec53c3a9 1440 lcd.DisplayStringAt(150,0, (uint8_t *)strat_sd[Strategie], LEFT_MODE);
gabrieltetar 21:d137ec53c3a9 1441 break;
gabrieltetar 21:d137ec53c3a9 1442
gabrieltetar 21:d137ec53c3a9 1443 case 0x9 :
gabrieltetar 21:d137ec53c3a9 1444 //description de Strategie n°5
gabrieltetar 21:d137ec53c3a9 1445 lcd.DisplayStringAt(150,0, (uint8_t *)strat_sd[Strategie], LEFT_MODE);
gabrieltetar 21:d137ec53c3a9 1446 break;
gabrieltetar 21:d137ec53c3a9 1447
gabrieltetar 21:d137ec53c3a9 1448 case 0xA :
gabrieltetar 21:d137ec53c3a9 1449 //description de Strategie n°5
gabrieltetar 21:d137ec53c3a9 1450 lcd.DisplayStringAt(150,0, (uint8_t *)strat_sd[Strategie], LEFT_MODE);
gabrieltetar 21:d137ec53c3a9 1451 break;
gabrieltetar 21:d137ec53c3a9 1452 }
gabrieltetar 27:ff70537a7619 1453 }
gabrieltetar 27:ff70537a7619 1454
gabrieltetar 27:ff70537a7619 1455 void DrawC (int l,int h,int x, int y, unsigned char fill){
gabrieltetar 27:ff70537a7619 1456 Point c[8]={{l,0},{l,h/6},{l/5,h/3},{l/5,2*(h/3)},{l,5*(h/6)},{l,h},{0,5*(h/6)},{0,h/6}};
gabrieltetar 27:ff70537a7619 1457 for(int a=0;a<8;a++){
gabrieltetar 27:ff70537a7619 1458 c[a].X+=x;
gabrieltetar 27:ff70537a7619 1459 c[a].Y+=y;
gabrieltetar 27:ff70537a7619 1460 }
gabrieltetar 27:ff70537a7619 1461 lcd.DrawPolygon(c, 8);
gabrieltetar 27:ff70537a7619 1462
gabrieltetar 27:ff70537a7619 1463 }
gabrieltetar 27:ff70537a7619 1464 void DrawR (int l,int h,int x, int y, unsigned char fill){
gabrieltetar 27:ff70537a7619 1465 Point r[10]={{0,0},{5*(l/6),0},{l,h/3},{5*(l/6),h/2},{l/2,h/2},{l,h},{2*(l/3),h},{l/4,h/2},{l/4,h},{0,h}};
gabrieltetar 27:ff70537a7619 1466 for(int a=0;a<10;a++){
gabrieltetar 27:ff70537a7619 1467 r[a].X+=x;
gabrieltetar 27:ff70537a7619 1468 r[a].Y+=y;
gabrieltetar 27:ff70537a7619 1469 }
gabrieltetar 27:ff70537a7619 1470 lcd.DrawPolygon(r, 10);
gabrieltetar 27:ff70537a7619 1471 }
gabrieltetar 27:ff70537a7619 1472 void DrawA (int l,int h,int x, int y, unsigned char fill){
gabrieltetar 27:ff70537a7619 1473 Point a[8]={{l/4,0},{3*(l/4),0},{l,h},{5*(l/6),h},{4*(l/6),h/2},{2*(l/6),h/2},{l/6,h},{0,h}};
gabrieltetar 27:ff70537a7619 1474 for(int z=0;z<8;z++){
gabrieltetar 27:ff70537a7619 1475 a[z].X+=x;
gabrieltetar 27:ff70537a7619 1476 a[z].Y+=y;
gabrieltetar 27:ff70537a7619 1477 }
gabrieltetar 27:ff70537a7619 1478 lcd.DrawPolygon(a, 8);
gabrieltetar 27:ff70537a7619 1479 }
gabrieltetar 27:ff70537a7619 1480 void DrawCheck (int l,int h,int x, int y, int cochage){
gabrieltetar 27:ff70537a7619 1481 if(x<3)x=3;
gabrieltetar 27:ff70537a7619 1482 if(cochage == 1){
gabrieltetar 27:ff70537a7619 1483 lcd.SetTextColor(VERT_F);
gabrieltetar 27:ff70537a7619 1484 lcd.DrawLine(x,y-(h/2),x+l/2,y+h/2);
gabrieltetar 27:ff70537a7619 1485 lcd.DrawLine(x-1,y-(h/2),x+l/2,y+h/2+1);
gabrieltetar 27:ff70537a7619 1486 lcd.DrawLine(x-2,y-(h/2),x+l/2,y+h/2+2);
gabrieltetar 27:ff70537a7619 1487 lcd.DrawLine(x+l/2,y+h/2,x+(4*(l/3)),y);
gabrieltetar 27:ff70537a7619 1488 lcd.DrawLine(x+l/2,y+h/2+1,x+(4*(l/3))+1,y);
gabrieltetar 27:ff70537a7619 1489 lcd.DrawLine(x+l/2,y+h/2+2,x+(4*(l/3))+2,y);
gabrieltetar 27:ff70537a7619 1490 lcd.SetTextColor(NOIR);
gabrieltetar 27:ff70537a7619 1491 } else {
gabrieltetar 27:ff70537a7619 1492 Point a[4]={{0,0},{l,0},{l,h},{0,h}};
gabrieltetar 27:ff70537a7619 1493 for(int z=0;z<8;z++){
gabrieltetar 27:ff70537a7619 1494 a[z].X+=x;
gabrieltetar 27:ff70537a7619 1495 a[z].Y+=y;
gabrieltetar 27:ff70537a7619 1496 }
gabrieltetar 27:ff70537a7619 1497 lcd.DrawPolygon(a, 4);
gabrieltetar 27:ff70537a7619 1498 }
gabrieltetar 21:d137ec53c3a9 1499 }