code avec modifs, programme mit dans les robots pour les derniers matchs

Dependencies:   mbed SerialHalfDuplex SDFileSystem liaison_Bluetooth ident_crac DISCO-F469NI_portrait

Committer:
goldmas
Date:
Mon May 31 13:36:03 2021 +0000
Revision:
36:c37dbe2be916
Parent:
35:2a745eeb7922
Child:
37:ee2c72e76d9c
Child:
38:9d6a3ccc0582
dernier code vallable;

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