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:
Tue May 11 15:02:31 2021 +0000
Revision:
32:7f8e3ee2adac
Parent:
29:ff575aff301f
Child:
33:c54841d11156
Code avec la nouvelle interface ihm avec les new identifants;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
gabrieltetar 21:d137ec53c3a9 1 #include "global.h"
gabrieltetar 21:d137ec53c3a9 2
gabrieltetar 21:d137ec53c3a9 3 #define VERT 0xFF00FF00
gabrieltetar 21:d137ec53c3a9 4 #define ROUGE 0xFFFF0000
gabrieltetar 21:d137ec53c3a9 5 #define BLEU 0xFF0000FF
gabrieltetar 21:d137ec53c3a9 6 #define JAUNE 0xFFFDD835//FEFE00
gabrieltetar 21:d137ec53c3a9 7 #define BLANC 0xFF000000
gabrieltetar 21:d137ec53c3a9 8 #define ORANGE 0xFFFFA500
gabrieltetar 21:d137ec53c3a9 9 #define NOIR 0xFF000000
gabrieltetar 21:d137ec53c3a9 10 #define DIY_GREY 0xFFDFDFDF
gabrieltetar 21:d137ec53c3a9 11 #define VIOLET 0xFF4527A0
gabrieltetar 27:ff70537a7619 12 #define VERT_F 0xFF00C400
gabrieltetar 21:d137ec53c3a9 13 TS_DISCO_F469NI ts;
gabrieltetar 21:d137ec53c3a9 14 LCD_DISCO_F469NI lcd;
gabrieltetar 21:d137ec53c3a9 15
gabrieltetar 21:d137ec53c3a9 16
gabrieltetar 21:d137ec53c3a9 17 TS_StateTypeDef TS_State;
gabrieltetar 21:d137ec53c3a9 18
gabrieltetar 21:d137ec53c3a9 19
gabrieltetar 21:d137ec53c3a9 20 /////////////////DEFINITION DES BOUTONS////////////////////
gabrieltetar 21:d137ec53c3a9 21 Button COTE_JAUNE(0, 25, 400, 300, "JAUNE");
gabrieltetar 21:d137ec53c3a9 22 Button COTE_VIOLET(0, 350, 400, 300, "VIOLET");
gabrieltetar 21:d137ec53c3a9 23 Button RETOUR (0, 680, 400, 110, "--Precedent--");
gabrieltetar 21:d137ec53c3a9 24 Button LANCER (0, 200, 400, 200, "--LANCER--");
gabrieltetar 21:d137ec53c3a9 25 Button CHECK (0, 420, 400, 200, "Valider");
gabrieltetar 21:d137ec53c3a9 26 Button MATCH (0, 50, 400, 320, "Match");
gabrieltetar 21:d137ec53c3a9 27 Button DEMONSTRATION (0, 400, 400, 320, "Demo");
gabrieltetar 21:d137ec53c3a9 28 //menu demo
gabrieltetar 21:d137ec53c3a9 29 Button TEST_VENT(0, 25, 400, 100, "Test ventouses");
gabrieltetar 21:d137ec53c3a9 30 Button TEST_MOT(0, 135, 400, 100, "Test moteur");
gabrieltetar 21:d137ec53c3a9 31 Button TEST_COUL(0,245,400,100,"Test capteurs couleur");
gabrieltetar 21:d137ec53c3a9 32 Button TEST_BRAS(0,355,400,100,"Test Bras");
gabrieltetar 21:d137ec53c3a9 33 Button TEST_AUDIO(0,465,400,100,"Test Audio");
gabrieltetar 22:c7763a7ec6c7 34
gabrieltetar 22:c7763a7ec6c7 35 Button TEST_NEXT(0,575,400,100,"------>");
gabrieltetar 22:c7763a7ec6c7 36 Button TEST_DIV(0,25,400,100,"Test Divers");
gabrieltetar 22:c7763a7ec6c7 37 Button TEST_ASSERV(0, 135, 400, 100, "Test asserv");
gabrieltetar 21:d137ec53c3a9 38 //menu demo/demo/
gabrieltetar 21:d137ec53c3a9 39 Button TEST_A(0,25,195,100,"A");
gabrieltetar 21:d137ec53c3a9 40 Button TEST_B(205,25,195,100,"B");
gabrieltetar 21:d137ec53c3a9 41 Button TEST_C(0,135,195,100,"C");
gabrieltetar 21:d137ec53c3a9 42 Button TEST_D(205,135,195,100,"D");
gabrieltetar 22:c7763a7ec6c7 43 Button TEST_NUM(0,245,400,100,"Num");
goldmas 32:7f8e3ee2adac 44 Button TEST_ATTRAPER(0,300,400,100,"Attraper");
goldmas 32:7f8e3ee2adac 45 Button TEST_RELACHER(0,450,400,100,"Relacher");
goldmas 32:7f8e3ee2adac 46
gabrieltetar 21:d137ec53c3a9 47 Button TEST_PLUS(205,355,195,100,"+");
gabrieltetar 21:d137ec53c3a9 48 Button TEST_MOINS(0,355,195,100,"-");
goldmas 32:7f8e3ee2adac 49 Button TEST_SERVO_0(0,50,120,100,"Bras 0");
goldmas 32:7f8e3ee2adac 50 Button TEST_SERVO_1(140,50,120,100,"Bras 1");
goldmas 32:7f8e3ee2adac 51 Button TEST_SERVO_2(280,50,120,100,"Bras 2");
goldmas 32:7f8e3ee2adac 52 Button TEST_SERVO_3(0,160,120,100,"Bras 3");
goldmas 32:7f8e3ee2adac 53 Button TEST_SERVO_4(140,160,120,100,"Bras 4");
goldmas 32:7f8e3ee2adac 54 Button TEST_SERVO_5(280,160,120,100,"Bras 5");
gabrieltetar 22:c7763a7ec6c7 55 Button FORCE_LAUNCH(0, 600, 400, 100, "Force Launch");
gabrieltetar 21:d137ec53c3a9 56 Button SUIVANT(0,380,200,100,"Suivant");
gabrieltetar 21:d137ec53c3a9 57 ////////////////////////////////////////////////////////////
gabrieltetar 24:1a13c998c7ac 58
gabrieltetar 21:d137ec53c3a9 59 signed char Bouton_Strat (void);
gabrieltetar 27:ff70537a7619 60 void DrawC (int l,int h,int x, int y, unsigned char fill);
gabrieltetar 27:ff70537a7619 61 void DrawR (int l,int h,int x, int y, unsigned char fill);
gabrieltetar 27:ff70537a7619 62 void DrawA (int l,int h,int x, int y, unsigned char fill);
gabrieltetar 24:1a13c998c7ac 63
gabrieltetar 21:d137ec53c3a9 64 void SelectionStrat (unsigned char numeroStrat);
gabrieltetar 21:d137ec53c3a9 65
gabrieltetar 21:d137ec53c3a9 66 /****************************************************************************************/
gabrieltetar 21:d137ec53c3a9 67 /* FUNCTION NAME: automate_etat_ihm */
gabrieltetar 21:d137ec53c3a9 68 /* DESCRIPTION : Automate de gestion de l'affichage */
gabrieltetar 21:d137ec53c3a9 69 /****************************************************************************************/
gabrieltetar 21:d137ec53c3a9 70 void automate_etat_ihm(void)
gabrieltetar 21:d137ec53c3a9 71 {
goldmas 32:7f8e3ee2adac 72 char toto[12];
gabrieltetar 21:d137ec53c3a9 73 int j;
goldmas 32:7f8e3ee2adac 74 unsigned char maximilien=1, choix_groupe;
gabrieltetar 21:d137ec53c3a9 75 if (j==0) {
gabrieltetar 21:d137ec53c3a9 76 ts.Init(lcd.GetXSize(), lcd.GetYSize());
gabrieltetar 21:d137ec53c3a9 77 j++;
gabrieltetar 21:d137ec53c3a9 78 }
gabrieltetar 21:d137ec53c3a9 79 ts.GetState(&TS_State);
gabrieltetar 21:d137ec53c3a9 80 switch (strat_etat_s) {
gabrieltetar 24:1a13c998c7ac 81 case INIT : //intialise l'écran et passe à l'attente d'initialisation des cartes
gabrieltetar 21:d137ec53c3a9 82 ts.GetState(&TS_State);
gabrieltetar 22:c7763a7ec6c7 83 canProcessRx();
gabrieltetar 24:1a13c998c7ac 84 lcd.SetBackColor(LCD_COLOR_WHITE);
gabrieltetar 24:1a13c998c7ac 85 lcd.SetTextColor(LCD_COLOR_BLACK);
gabrieltetar 24:1a13c998c7ac 86 lcd.Clear (LCD_COLOR_WHITE);
gabrieltetar 24:1a13c998c7ac 87 wait(0.15);
gabrieltetar 27:ff70537a7619 88 DrawC(95,150,0,50,0);
gabrieltetar 27:ff70537a7619 89 DrawR(95,150,105,50,0);
gabrieltetar 27:ff70537a7619 90 DrawA(95,150,210,50,0);
gabrieltetar 27:ff70537a7619 91 DrawC(95,150,315,50,0);
gabrieltetar 27:ff70537a7619 92 DrawCheck(30,30,50,243,0);
gabrieltetar 27:ff70537a7619 93 DrawCheck(30,30,50,293,0);
gabrieltetar 27:ff70537a7619 94 DrawCheck(30,30,50,343,0);
gabrieltetar 27:ff70537a7619 95 DrawCheck(30,30,50,393,0);
gabrieltetar 27:ff70537a7619 96 lcd.DisplayStringAt(100, 250, (uint8_t *)"Init CAN", LEFT_MODE);
slowness 29:ff575aff301f 97 DrawCheck(30,30,50,243,can_present);
gabrieltetar 27:ff70537a7619 98 lcd.DisplayStringAt(100, 300, (uint8_t *)"Micro SD", LEFT_MODE);
slowness 29:ff575aff301f 99 DrawCheck(30,30,50,293,sd_present);
gabrieltetar 27:ff70537a7619 100 lcd.DisplayStringAt(100, 350, (uint8_t *)"Carte Moteur", LEFT_MODE);
gabrieltetar 27:ff70537a7619 101 lcd.DisplayStringAt(100, 400, (uint8_t *)"Balise IR", LEFT_MODE);
gabrieltetar 24:1a13c998c7ac 102 FORCE_LAUNCH.Draw(0xFFFF0000, 0);
gabrieltetar 24:1a13c998c7ac 103
gabrieltetar 24:1a13c998c7ac 104 strat_etat_s=ATT;
gabrieltetar 24:1a13c998c7ac 105 break;
gabrieltetar 24:1a13c998c7ac 106
gabrieltetar 24:1a13c998c7ac 107 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 108 if (flag_check_carte==1) {
gabrieltetar 24:1a13c998c7ac 109 strat_etat_s = CHOIX;
gabrieltetar 24:1a13c998c7ac 110 gameEtat = ETAT_CONFIG;
gabrieltetar 24:1a13c998c7ac 111 } else if (FORCE_LAUNCH.Touched()) {
gabrieltetar 24:1a13c998c7ac 112 strat_etat_s = CHOIX;
gabrieltetar 24:1a13c998c7ac 113 gameEtat = ETAT_CONFIG;
gabrieltetar 24:1a13c998c7ac 114 while(FORCE_LAUNCH.Touched());
gabrieltetar 21:d137ec53c3a9 115 }
gabrieltetar 24:1a13c998c7ac 116
gabrieltetar 21:d137ec53c3a9 117 break;
gabrieltetar 24:1a13c998c7ac 118
gabrieltetar 24:1a13c998c7ac 119
gabrieltetar 21:d137ec53c3a9 120 case CHOIX : //Match ou DEMO
gabrieltetar 21:d137ec53c3a9 121 lcd.SetBackColor(LCD_COLOR_WHITE);
gabrieltetar 21:d137ec53c3a9 122 lcd.SetTextColor(LCD_COLOR_BLACK);
gabrieltetar 21:d137ec53c3a9 123 lcd.Clear (LCD_COLOR_WHITE);
gabrieltetar 21:d137ec53c3a9 124 lcd.DisplayStringAt(0, LINE(0), (uint8_t *)"Match ou demonstration ?", LEFT_MODE);
gabrieltetar 21:d137ec53c3a9 125 DEMONSTRATION.Draw(LCD_COLOR_LIGHTGREEN, 0);
gabrieltetar 21:d137ec53c3a9 126 MATCH.Draw(0xFFF01010, 0);
gabrieltetar 21:d137ec53c3a9 127 while(strat_etat_s == CHOIX) {
gabrieltetar 21:d137ec53c3a9 128 canProcessRx();
gabrieltetar 21:d137ec53c3a9 129 if(DEMONSTRATION.Touched()) {
gabrieltetar 21:d137ec53c3a9 130 strat_etat_s = DEMO;
gabrieltetar 21:d137ec53c3a9 131 while(DEMONSTRATION.Touched());
gabrieltetar 21:d137ec53c3a9 132 }
gabrieltetar 21:d137ec53c3a9 133
gabrieltetar 21:d137ec53c3a9 134 if(MATCH.Touched()) {
gabrieltetar 21:d137ec53c3a9 135 strat_etat_s = SELECT_SIDE;
gabrieltetar 21:d137ec53c3a9 136 while(MATCH.Touched());
gabrieltetar 21:d137ec53c3a9 137 }
gabrieltetar 21:d137ec53c3a9 138
gabrieltetar 21:d137ec53c3a9 139 }
gabrieltetar 21:d137ec53c3a9 140 break;
gabrieltetar 21:d137ec53c3a9 141
gabrieltetar 21:d137ec53c3a9 142 case DEMO :
gabrieltetar 21:d137ec53c3a9 143 lcd.SetBackColor(LCD_COLOR_WHITE);
gabrieltetar 21:d137ec53c3a9 144 lcd.SetTextColor(LCD_COLOR_BLACK);
gabrieltetar 21:d137ec53c3a9 145 lcd.Clear (LCD_COLOR_WHITE);
gabrieltetar 22:c7763a7ec6c7 146 lcd.DisplayStringAt(0, LINE(0), (uint8_t *)"DEMO 1/2", LEFT_MODE);
gabrieltetar 21:d137ec53c3a9 147 RETOUR.Draw(0xFFFF0000, 0);
gabrieltetar 21:d137ec53c3a9 148 TEST_VENT.Draw(VERT, 0);
gabrieltetar 21:d137ec53c3a9 149 TEST_MOT.Draw(VERT, 0);
gabrieltetar 21:d137ec53c3a9 150 TEST_COUL.Draw(VERT, 0);
gabrieltetar 21:d137ec53c3a9 151 TEST_BRAS.Draw(VERT, 0);
gabrieltetar 21:d137ec53c3a9 152 TEST_AUDIO.Draw(VERT, 0);
gabrieltetar 22:c7763a7ec6c7 153 TEST_NEXT.Draw(BLEU, 0);
gabrieltetar 21:d137ec53c3a9 154 maximilien=0;
gabrieltetar 21:d137ec53c3a9 155 while (strat_etat_s == DEMO) {
gabrieltetar 21:d137ec53c3a9 156 canProcessRx();
gabrieltetar 21:d137ec53c3a9 157 if(TEST_VENT.Touched()) {
gabrieltetar 21:d137ec53c3a9 158 while(TEST_VENT.Touched());
gabrieltetar 21:d137ec53c3a9 159 strat_etat_s = TEST_VENTOUSE;
gabrieltetar 21:d137ec53c3a9 160 } else if(TEST_MOT.Touched()) {
gabrieltetar 21:d137ec53c3a9 161 while(TEST_MOT.Touched());
gabrieltetar 21:d137ec53c3a9 162 strat_etat_s = TEST_MOTEUR;
gabrieltetar 22:c7763a7ec6c7 163 } else if(TEST_NEXT.Touched()) {
gabrieltetar 22:c7763a7ec6c7 164 while(TEST_NEXT.Touched());
gabrieltetar 22:c7763a7ec6c7 165 strat_etat_s = DEMO2;
gabrieltetar 21:d137ec53c3a9 166 } else if (TEST_COUL.Touched()) {
gabrieltetar 21:d137ec53c3a9 167 while(TEST_COUL.Touched());
gabrieltetar 21:d137ec53c3a9 168 strat_etat_s =TEST_COULEUR ;
gabrieltetar 21:d137ec53c3a9 169 } else if (TEST_BRAS.Touched()) {
gabrieltetar 21:d137ec53c3a9 170 while(TEST_BRAS.Touched());
gabrieltetar 21:d137ec53c3a9 171 strat_etat_s =TEST_SERVO_BRAS ;
gabrieltetar 21:d137ec53c3a9 172 } else if(TEST_AUDIO.Touched()) {
gabrieltetar 21:d137ec53c3a9 173 while(TEST_AUDIO.Touched());
gabrieltetar 21:d137ec53c3a9 174 strat_etat_s=TEST_AUD;
gabrieltetar 21:d137ec53c3a9 175 } else if(RETOUR.Touched()) {
gabrieltetar 21:d137ec53c3a9 176 while(RETOUR.Touched());
gabrieltetar 21:d137ec53c3a9 177 strat_etat_s = CHOIX;
gabrieltetar 21:d137ec53c3a9 178 }
gabrieltetar 21:d137ec53c3a9 179 }
gabrieltetar 21:d137ec53c3a9 180 break;
gabrieltetar 24:1a13c998c7ac 181
gabrieltetar 24:1a13c998c7ac 182 case DEMO2 :
gabrieltetar 22:c7763a7ec6c7 183 lcd.SetBackColor(LCD_COLOR_WHITE);
gabrieltetar 22:c7763a7ec6c7 184 lcd.SetTextColor(LCD_COLOR_BLACK);
gabrieltetar 22:c7763a7ec6c7 185 lcd.Clear (LCD_COLOR_WHITE);
gabrieltetar 22:c7763a7ec6c7 186 lcd.DisplayStringAt(0, LINE(0), (uint8_t *)"DEMO 2/2", LEFT_MODE);
gabrieltetar 22:c7763a7ec6c7 187 RETOUR.Draw(0xFFFF0000, 0);
gabrieltetar 22:c7763a7ec6c7 188 TEST_DIV.Draw(VERT, 0);
gabrieltetar 22:c7763a7ec6c7 189 TEST_ASSERV.Draw(VERT, 0);
gabrieltetar 22:c7763a7ec6c7 190 TEST_NEXT.Draw(BLEU, 0);
gabrieltetar 22:c7763a7ec6c7 191 maximilien=0;
gabrieltetar 22:c7763a7ec6c7 192 while (strat_etat_s == DEMO2) {
gabrieltetar 22:c7763a7ec6c7 193 canProcessRx();
gabrieltetar 22:c7763a7ec6c7 194 if(TEST_NEXT.Touched()) {
gabrieltetar 22:c7763a7ec6c7 195 while(TEST_NEXT.Touched());
gabrieltetar 22:c7763a7ec6c7 196 strat_etat_s = DEMO;
gabrieltetar 22:c7763a7ec6c7 197 } else if(TEST_DIV.Touched()) {
gabrieltetar 22:c7763a7ec6c7 198 while(TEST_DIV.Touched());
gabrieltetar 22:c7763a7ec6c7 199 strat_etat_s = TEST_DIVE;
gabrieltetar 22:c7763a7ec6c7 200 } else if(TEST_ASSERV.Touched()) {
gabrieltetar 22:c7763a7ec6c7 201 while(TEST_ASSERV.Touched());
gabrieltetar 22:c7763a7ec6c7 202 strat_etat_s = TEST_ASSERVE;
gabrieltetar 22:c7763a7ec6c7 203 } else if(RETOUR.Touched()) {
gabrieltetar 22:c7763a7ec6c7 204 while(RETOUR.Touched());
gabrieltetar 22:c7763a7ec6c7 205 strat_etat_s = CHOIX;
gabrieltetar 22:c7763a7ec6c7 206 }
gabrieltetar 22:c7763a7ec6c7 207 }
gabrieltetar 24:1a13c998c7ac 208 break;
gabrieltetar 24:1a13c998c7ac 209
gabrieltetar 24:1a13c998c7ac 210 case TEST_ASSERVE:
gabrieltetar 24:1a13c998c7ac 211 lcd.SetBackColor(LCD_COLOR_WHITE);
gabrieltetar 24:1a13c998c7ac 212 lcd.SetTextColor(LCD_COLOR_BLACK);
gabrieltetar 24:1a13c998c7ac 213 lcd.Clear (LCD_COLOR_WHITE);
gabrieltetar 24:1a13c998c7ac 214 lcd.DisplayStringAt(0, LINE(0), (uint8_t *)"Asservissements", LEFT_MODE);
gabrieltetar 24:1a13c998c7ac 215 RETOUR.Draw(0xFFFF0000,0);
gabrieltetar 24:1a13c998c7ac 216 TEST_A.Draw(BLEU, BLANC);
gabrieltetar 24:1a13c998c7ac 217 TEST_B.Draw(BLEU, BLANC);
gabrieltetar 24:1a13c998c7ac 218 while(strat_etat_s==TEST_ASSERVE) {
gabrieltetar 24:1a13c998c7ac 219 if(RETOUR.Touched()) {
gabrieltetar 24:1a13c998c7ac 220 while (RETOUR.Touched());
gabrieltetar 24:1a13c998c7ac 221 strat_etat_s=DEMO2;
gabrieltetar 24:1a13c998c7ac 222 } else if(TEST_A.Touched()) {
gabrieltetar 24:1a13c998c7ac 223 while (TEST_A.Touched());
gabrieltetar 24:1a13c998c7ac 224 GoToPosition(2000,0,0,0);
gabrieltetar 24:1a13c998c7ac 225 TEST_A.Draw(BLEU, BLANC);
gabrieltetar 24:1a13c998c7ac 226 } else if(TEST_B.Touched()) {
gabrieltetar 24:1a13c998c7ac 227 while (TEST_B.Touched());
gabrieltetar 24:1a13c998c7ac 228 Rotate(3599);
gabrieltetar 24:1a13c998c7ac 229 TEST_B.Draw(BLEU, BLANC);
gabrieltetar 24:1a13c998c7ac 230 }
gabrieltetar 24:1a13c998c7ac 231 }
gabrieltetar 24:1a13c998c7ac 232 break;
gabrieltetar 24:1a13c998c7ac 233
gabrieltetar 24:1a13c998c7ac 234 case TEST_DIVE:
gabrieltetar 24:1a13c998c7ac 235
gabrieltetar 24:1a13c998c7ac 236 while(strat_etat_s==TEST_DIVE) {
gabrieltetar 24:1a13c998c7ac 237 canProcessRx();
gabrieltetar 24:1a13c998c7ac 238 lcd.SetBackColor(LCD_COLOR_WHITE);
gabrieltetar 24:1a13c998c7ac 239 lcd.SetTextColor(LCD_COLOR_BLACK);
gabrieltetar 24:1a13c998c7ac 240 lcd.Clear (LCD_COLOR_WHITE);
gabrieltetar 24:1a13c998c7ac 241 lcd.DisplayStringAt(0, LINE(0), (uint8_t *)"Coordonnees", LEFT_MODE);
gabrieltetar 24:1a13c998c7ac 242 RETOUR.Draw(0xFFFF0000,0);
gabrieltetar 24:1a13c998c7ac 243 sprintf(toto,"%hd",x_robot);
gabrieltetar 24:1a13c998c7ac 244 lcd.DisplayStringAt(0, LINE(10), (unsigned char *)"X :", LEFT_MODE);
gabrieltetar 24:1a13c998c7ac 245 lcd.DisplayStringAt(50, LINE(10), (unsigned char *)toto, LEFT_MODE);
gabrieltetar 24:1a13c998c7ac 246 sprintf(toto,"%hd",y_robot);
gabrieltetar 24:1a13c998c7ac 247 lcd.DisplayStringAt(0, LINE(11), (unsigned char *)"Y :", LEFT_MODE);
gabrieltetar 24:1a13c998c7ac 248 lcd.DisplayStringAt(50, LINE(11), (unsigned char *)toto, LEFT_MODE);
gabrieltetar 24:1a13c998c7ac 249 sprintf(toto,"%hd",theta_robot);
gabrieltetar 24:1a13c998c7ac 250 lcd.DisplayStringAt(0, LINE(12), (unsigned char *)"T :", LEFT_MODE);
gabrieltetar 24:1a13c998c7ac 251 lcd.DisplayStringAt(50, LINE(12), (unsigned char *) toto, LEFT_MODE);
gabrieltetar 24:1a13c998c7ac 252 if(RETOUR.Touched()) {
gabrieltetar 24:1a13c998c7ac 253 while (RETOUR.Touched());
gabrieltetar 24:1a13c998c7ac 254 strat_etat_s=DEMO2;
gabrieltetar 24:1a13c998c7ac 255 }
gabrieltetar 24:1a13c998c7ac 256 wait(0.2);
gabrieltetar 24:1a13c998c7ac 257 }
gabrieltetar 24:1a13c998c7ac 258 break;
gabrieltetar 21:d137ec53c3a9 259
gabrieltetar 21:d137ec53c3a9 260 case TEST_VENTOUSE:
gabrieltetar 21:d137ec53c3a9 261 lcd.SetBackColor(LCD_COLOR_WHITE);
gabrieltetar 21:d137ec53c3a9 262 lcd.SetTextColor(LCD_COLOR_BLACK);
gabrieltetar 21:d137ec53c3a9 263 lcd.Clear (LCD_COLOR_WHITE);
gabrieltetar 21:d137ec53c3a9 264 lcd.Clear (LCD_COLOR_WHITE);
gabrieltetar 21:d137ec53c3a9 265 lcd.DisplayStringAt(0, LINE(0), (uint8_t *)"Test Ventouse", LEFT_MODE);
gabrieltetar 21:d137ec53c3a9 266 sprintf(toto,"%hd",maximilien);
gabrieltetar 21:d137ec53c3a9 267 lcd.DisplayStringAt(50, LINE(20), (unsigned char *)toto, LEFT_MODE);
gabrieltetar 21:d137ec53c3a9 268 RETOUR.Draw(0xFFFF0000,0);
gabrieltetar 21:d137ec53c3a9 269 TEST_A.Draw(BLEU, BLANC);
gabrieltetar 21:d137ec53c3a9 270 TEST_NUM.Draw(BLEU, BLANC);
gabrieltetar 21:d137ec53c3a9 271 TEST_PLUS.Draw(BLEU, BLANC);
gabrieltetar 21:d137ec53c3a9 272 TEST_MOINS.Draw(BLEU, BLANC);
gabrieltetar 21:d137ec53c3a9 273 while(strat_etat_s==TEST_VENTOUSE) {
gabrieltetar 21:d137ec53c3a9 274 if(RETOUR.Touched()) {
gabrieltetar 21:d137ec53c3a9 275 while (RETOUR.Touched());
gabrieltetar 21:d137ec53c3a9 276 strat_etat_s=DEMO;
gabrieltetar 21:d137ec53c3a9 277 } else if(TEST_A.Touched()) {
gabrieltetar 21:d137ec53c3a9 278 while (TEST_A.Touched());
maximilienlv 28:7f2990747e09 279 SendRawId(VENT_ETAT);
gabrieltetar 21:d137ec53c3a9 280 TEST_A.Draw(BLEU, BLANC);
gabrieltetar 21:d137ec53c3a9 281 } else if(TEST_NUM.Touched()) {
gabrieltetar 21:d137ec53c3a9 282 while (TEST_NUM.Touched());
gabrieltetar 21:d137ec53c3a9 283 TEST_NUM.Draw(BLEU, BLANC);
gabrieltetar 21:d137ec53c3a9 284 switch(maximilien){
gabrieltetar 21:d137ec53c3a9 285 case 1:
goldmas 32:7f8e3ee2adac 286 choix_groupe = 0 ;
goldmas 32:7f8e3ee2adac 287 SendMsgCan(VENT_AT, &choix_groupe, sizeof(choix_groupe)) ;
gabrieltetar 21:d137ec53c3a9 288 break;
gabrieltetar 21:d137ec53c3a9 289 case 2:
goldmas 32:7f8e3ee2adac 290 choix_groupe = 0 ;
goldmas 32:7f8e3ee2adac 291 SendMsgCan(VENT_RE, &choix_groupe, sizeof(choix_groupe)) ;
gabrieltetar 21:d137ec53c3a9 292 break;
gabrieltetar 21:d137ec53c3a9 293 case 3:
goldmas 32:7f8e3ee2adac 294 choix_groupe = 1 ;
goldmas 32:7f8e3ee2adac 295 SendMsgCan(VENT_AT, &choix_groupe, sizeof(choix_groupe)) ;
gabrieltetar 21:d137ec53c3a9 296 break;
gabrieltetar 21:d137ec53c3a9 297 case 4:
goldmas 32:7f8e3ee2adac 298 choix_groupe = 1 ;
goldmas 32:7f8e3ee2adac 299 SendMsgCan(VENT_RE, &choix_groupe, sizeof(choix_groupe)) ;
gabrieltetar 21:d137ec53c3a9 300 break;
gabrieltetar 21:d137ec53c3a9 301 case 5:
goldmas 32:7f8e3ee2adac 302 choix_groupe = 2 ;
goldmas 32:7f8e3ee2adac 303 SendMsgCan(VENT_AT, &choix_groupe, sizeof(choix_groupe)) ;
gabrieltetar 21:d137ec53c3a9 304 break;
gabrieltetar 21:d137ec53c3a9 305 case 6:
goldmas 32:7f8e3ee2adac 306 choix_groupe = 2 ;
goldmas 32:7f8e3ee2adac 307 SendMsgCan(VENT_RE, &choix_groupe, sizeof(choix_groupe)) ;
goldmas 32:7f8e3ee2adac 308 break;
goldmas 32:7f8e3ee2adac 309 case 7:
goldmas 32:7f8e3ee2adac 310 choix_groupe = 3 ;
goldmas 32:7f8e3ee2adac 311 SendMsgCan(VENT_AT, &choix_groupe, sizeof(choix_groupe)) ;
goldmas 32:7f8e3ee2adac 312 break;
goldmas 32:7f8e3ee2adac 313 case 8:
goldmas 32:7f8e3ee2adac 314 choix_groupe = 3 ;
goldmas 32:7f8e3ee2adac 315 SendMsgCan(VENT_RE, &choix_groupe, sizeof(choix_groupe)) ;
goldmas 32:7f8e3ee2adac 316 break;
goldmas 32:7f8e3ee2adac 317 case 9:
goldmas 32:7f8e3ee2adac 318 choix_groupe = 4 ;
goldmas 32:7f8e3ee2adac 319 SendMsgCan(VENT_AT, &choix_groupe, sizeof(choix_groupe)) ;
goldmas 32:7f8e3ee2adac 320 break;
goldmas 32:7f8e3ee2adac 321 case 10:
goldmas 32:7f8e3ee2adac 322 choix_groupe = 4 ;
goldmas 32:7f8e3ee2adac 323 SendMsgCan(VENT_RE, &choix_groupe, sizeof(choix_groupe)) ;
goldmas 32:7f8e3ee2adac 324 break;
goldmas 32:7f8e3ee2adac 325 case 11:
goldmas 32:7f8e3ee2adac 326 choix_groupe = 5 ;
goldmas 32:7f8e3ee2adac 327 SendMsgCan(VENT_AT, &choix_groupe, sizeof(choix_groupe)) ;
goldmas 32:7f8e3ee2adac 328 break;
goldmas 32:7f8e3ee2adac 329 case 12:
goldmas 32:7f8e3ee2adac 330 choix_groupe = 5 ;
goldmas 32:7f8e3ee2adac 331 SendMsgCan(VENT_RE, &choix_groupe, sizeof(choix_groupe)) ;
gabrieltetar 21:d137ec53c3a9 332 break;
gabrieltetar 21:d137ec53c3a9 333 }
gabrieltetar 21:d137ec53c3a9 334 } else if(TEST_PLUS.Touched()) {
gabrieltetar 21:d137ec53c3a9 335 while (TEST_PLUS.Touched());
gabrieltetar 21:d137ec53c3a9 336 TEST_PLUS.Draw(BLEU, BLANC);
gabrieltetar 21:d137ec53c3a9 337 if(maximilien!=6)maximilien++;
gabrieltetar 21:d137ec53c3a9 338 sprintf(toto,"%hd",maximilien);
gabrieltetar 21:d137ec53c3a9 339 lcd.SetBackColor(LCD_COLOR_WHITE);
gabrieltetar 21:d137ec53c3a9 340 lcd.SetTextColor(LCD_COLOR_BLACK);
gabrieltetar 21:d137ec53c3a9 341 lcd.DisplayStringAt(50, LINE(20), (unsigned char *)toto, LEFT_MODE);
gabrieltetar 21:d137ec53c3a9 342 } else if(TEST_MOINS.Touched()) {
gabrieltetar 21:d137ec53c3a9 343 while (TEST_MOINS.Touched());
gabrieltetar 21:d137ec53c3a9 344 TEST_MOINS.Draw(BLEU, BLANC);
gabrieltetar 21:d137ec53c3a9 345 if(maximilien!=1)maximilien--;
gabrieltetar 21:d137ec53c3a9 346 sprintf(toto,"%hd",maximilien);
gabrieltetar 21:d137ec53c3a9 347 lcd.SetBackColor(LCD_COLOR_WHITE);
gabrieltetar 21:d137ec53c3a9 348 lcd.SetTextColor(LCD_COLOR_BLACK);
gabrieltetar 21:d137ec53c3a9 349 lcd.DisplayStringAt(50, LINE(20), (unsigned char *)toto, LEFT_MODE);
gabrieltetar 21:d137ec53c3a9 350 }
gabrieltetar 21:d137ec53c3a9 351 }
gabrieltetar 21:d137ec53c3a9 352 break;
gabrieltetar 21:d137ec53c3a9 353
gabrieltetar 24:1a13c998c7ac 354 case TEST_ELECTROV:
gabrieltetar 21:d137ec53c3a9 355 lcd.SetBackColor(LCD_COLOR_WHITE);
gabrieltetar 21:d137ec53c3a9 356 lcd.SetTextColor(LCD_COLOR_BLACK);
gabrieltetar 21:d137ec53c3a9 357 lcd.Clear (LCD_COLOR_WHITE);
gabrieltetar 21:d137ec53c3a9 358 lcd.Clear (LCD_COLOR_WHITE);
gabrieltetar 21:d137ec53c3a9 359 lcd.DisplayStringAt(0, LINE(0), (uint8_t *)"A : Manches B : Pavillon", LEFT_MODE);
gabrieltetar 21:d137ec53c3a9 360 RETOUR.Draw(0xFFFF0000,0);
gabrieltetar 21:d137ec53c3a9 361 TEST_A.Draw(BLEU, BLANC);
gabrieltetar 21:d137ec53c3a9 362 TEST_B.Draw(BLEU, BLANC);
gabrieltetar 24:1a13c998c7ac 363 while(strat_etat_s==TEST_ELECTROV) {
gabrieltetar 21:d137ec53c3a9 364 if(RETOUR.Touched()) {
gabrieltetar 21:d137ec53c3a9 365 while (RETOUR.Touched());
gabrieltetar 24:1a13c998c7ac 366 strat_etat_s=DEMO;
gabrieltetar 21:d137ec53c3a9 367 } else if(TEST_A.Touched()) {
gabrieltetar 21:d137ec53c3a9 368 while (TEST_A.Touched());
gabrieltetar 21:d137ec53c3a9 369 //SendRawId(TEST_ELECTROV_A);
gabrieltetar 21:d137ec53c3a9 370 TEST_A.Draw(BLEU, BLANC);
gabrieltetar 21:d137ec53c3a9 371 } else if(TEST_B.Touched()) {
gabrieltetar 21:d137ec53c3a9 372 while (TEST_B.Touched());
gabrieltetar 21:d137ec53c3a9 373 //SendRawId(TEST_ELECTROV_A);
gabrieltetar 21:d137ec53c3a9 374 TEST_B.Draw(BLEU, BLANC);
gabrieltetar 21:d137ec53c3a9 375 }
gabrieltetar 21:d137ec53c3a9 376 }
gabrieltetar 21:d137ec53c3a9 377 break;
gabrieltetar 24:1a13c998c7ac 378
gabrieltetar 21:d137ec53c3a9 379 case TEST_AUD:
gabrieltetar 21:d137ec53c3a9 380
gabrieltetar 21:d137ec53c3a9 381 lcd.SetBackColor(LCD_COLOR_WHITE);
gabrieltetar 21:d137ec53c3a9 382 lcd.SetTextColor(LCD_COLOR_BLACK);
gabrieltetar 21:d137ec53c3a9 383 lcd.Clear (LCD_COLOR_WHITE);
gabrieltetar 21:d137ec53c3a9 384 lcd.Clear (LCD_COLOR_WHITE);
gabrieltetar 21:d137ec53c3a9 385 lcd.DisplayStringAt(0, LINE(0), (uint8_t *)"Test Audio", LEFT_MODE);
gabrieltetar 21:d137ec53c3a9 386 sprintf(toto,"%hd",maximilien);
gabrieltetar 21:d137ec53c3a9 387 lcd.DisplayStringAt(50, LINE(20), (unsigned char *)toto, LEFT_MODE);
gabrieltetar 21:d137ec53c3a9 388 RETOUR.Draw(0xFFFF0000,0);
gabrieltetar 21:d137ec53c3a9 389 TEST_NUM.Draw(BLEU, BLANC);
gabrieltetar 21:d137ec53c3a9 390 TEST_PLUS.Draw(BLEU, BLANC);
gabrieltetar 21:d137ec53c3a9 391 TEST_MOINS.Draw(BLEU, BLANC);
gabrieltetar 21:d137ec53c3a9 392 while(strat_etat_s==TEST_AUD) {
gabrieltetar 21:d137ec53c3a9 393 if(RETOUR.Touched()) {
gabrieltetar 21:d137ec53c3a9 394 while (RETOUR.Touched());
gabrieltetar 21:d137ec53c3a9 395 strat_etat_s=DEMO;
gabrieltetar 21:d137ec53c3a9 396 } else if(TEST_NUM.Touched()) {
gabrieltetar 21:d137ec53c3a9 397 while (TEST_NUM.Touched());
gabrieltetar 21:d137ec53c3a9 398 TEST_NUM.Draw(BLEU, BLANC);
gabrieltetar 21:d137ec53c3a9 399 Debug_Audio(3,maximilien);
gabrieltetar 21:d137ec53c3a9 400 } else if(TEST_PLUS.Touched()) {
gabrieltetar 21:d137ec53c3a9 401 while (TEST_PLUS.Touched());
gabrieltetar 21:d137ec53c3a9 402 TEST_PLUS.Draw(BLEU, BLANC);
gabrieltetar 21:d137ec53c3a9 403 if(maximilien!=20)maximilien++;
gabrieltetar 21:d137ec53c3a9 404 sprintf(toto,"%hd",maximilien);
gabrieltetar 21:d137ec53c3a9 405 lcd.SetBackColor(LCD_COLOR_WHITE);
gabrieltetar 21:d137ec53c3a9 406 lcd.SetTextColor(LCD_COLOR_BLACK);
gabrieltetar 21:d137ec53c3a9 407 lcd.DisplayStringAt(50, LINE(20), (unsigned char *)toto, LEFT_MODE);
gabrieltetar 21:d137ec53c3a9 408 } else if(TEST_MOINS.Touched()) {
gabrieltetar 21:d137ec53c3a9 409 while (TEST_MOINS.Touched());
gabrieltetar 21:d137ec53c3a9 410 TEST_MOINS.Draw(BLEU, BLANC);
gabrieltetar 21:d137ec53c3a9 411 if(maximilien!=1)maximilien--;
gabrieltetar 21:d137ec53c3a9 412 sprintf(toto,"%hd",maximilien);
gabrieltetar 21:d137ec53c3a9 413 lcd.SetBackColor(LCD_COLOR_WHITE);
gabrieltetar 21:d137ec53c3a9 414 lcd.SetTextColor(LCD_COLOR_BLACK);
gabrieltetar 21:d137ec53c3a9 415 lcd.DisplayStringAt(50, LINE(20), (unsigned char *)toto, LEFT_MODE);
gabrieltetar 21:d137ec53c3a9 416 }
gabrieltetar 21:d137ec53c3a9 417 }
gabrieltetar 21:d137ec53c3a9 418 break;
gabrieltetar 21:d137ec53c3a9 419
gabrieltetar 21:d137ec53c3a9 420 case TEST_SERVO_BRAS:
goldmas 32:7f8e3ee2adac 421 char bras_select_0 = 0, bras_select_1 = 0, bras_select_2 = 0, bras_select_3 = 0, bras_select_4 = 0, bras_select_5 = 0 ;
gabrieltetar 21:d137ec53c3a9 422 lcd.SetBackColor(LCD_COLOR_WHITE);
gabrieltetar 21:d137ec53c3a9 423 lcd.SetTextColor(LCD_COLOR_BLACK);
gabrieltetar 21:d137ec53c3a9 424 lcd.Clear (LCD_COLOR_WHITE);
gabrieltetar 21:d137ec53c3a9 425 lcd.Clear (LCD_COLOR_WHITE);
gabrieltetar 21:d137ec53c3a9 426 lcd.DisplayStringAt(0, LINE(0), (uint8_t *)"Test Bras", LEFT_MODE);
gabrieltetar 21:d137ec53c3a9 427 sprintf(toto,"%hd",maximilien);
gabrieltetar 21:d137ec53c3a9 428 lcd.DisplayStringAt(50, LINE(20), (unsigned char *)toto, LEFT_MODE);
gabrieltetar 21:d137ec53c3a9 429 RETOUR.Draw(0xFFFF0000,0);
goldmas 32:7f8e3ee2adac 430 TEST_ATTRAPER.Draw(BLEU, BLANC);
goldmas 32:7f8e3ee2adac 431 TEST_RELACHER.Draw(BLEU, BLANC);
goldmas 32:7f8e3ee2adac 432 TEST_SERVO_0.Draw(BLEU, BLANC);
goldmas 32:7f8e3ee2adac 433 TEST_SERVO_1.Draw(BLEU, BLANC);
goldmas 32:7f8e3ee2adac 434 TEST_SERVO_2.Draw(BLEU, BLANC);
goldmas 32:7f8e3ee2adac 435 TEST_SERVO_3.Draw(BLEU, BLANC);
goldmas 32:7f8e3ee2adac 436 TEST_SERVO_4.Draw(BLEU, BLANC);
goldmas 32:7f8e3ee2adac 437 TEST_SERVO_5.Draw(BLEU, BLANC);
goldmas 32:7f8e3ee2adac 438 while(strat_etat_s==TEST_SERVO_BRAS)
goldmas 32:7f8e3ee2adac 439 {
goldmas 32:7f8e3ee2adac 440 if(RETOUR.Touched())
goldmas 32:7f8e3ee2adac 441 {
gabrieltetar 21:d137ec53c3a9 442 while (RETOUR.Touched());
gabrieltetar 21:d137ec53c3a9 443 strat_etat_s=DEMO;
goldmas 32:7f8e3ee2adac 444 }
goldmas 32:7f8e3ee2adac 445 else if(TEST_SERVO_0.Touched())
goldmas 32:7f8e3ee2adac 446 {
goldmas 32:7f8e3ee2adac 447 while (TEST_SERVO_0.Touched());
goldmas 32:7f8e3ee2adac 448 if(bras_select_0)
goldmas 32:7f8e3ee2adac 449 {
goldmas 32:7f8e3ee2adac 450 bras_select_0 = 0 ;
goldmas 32:7f8e3ee2adac 451 TEST_SERVO_0.Draw(DIY_GREY, BLANC);
goldmas 32:7f8e3ee2adac 452 }
goldmas 32:7f8e3ee2adac 453 else
goldmas 32:7f8e3ee2adac 454 {
goldmas 32:7f8e3ee2adac 455 bras_select_0 = 1 ;
goldmas 32:7f8e3ee2adac 456 TEST_SERVO_0.Draw(BLEU, BLANC);
goldmas 32:7f8e3ee2adac 457 }
goldmas 32:7f8e3ee2adac 458 }
goldmas 32:7f8e3ee2adac 459 else if(TEST_SERVO_1.Touched())
goldmas 32:7f8e3ee2adac 460 {
goldmas 32:7f8e3ee2adac 461 while (TEST_SERVO_1.Touched());
goldmas 32:7f8e3ee2adac 462 if(bras_select_1)
goldmas 32:7f8e3ee2adac 463 {
goldmas 32:7f8e3ee2adac 464 bras_select_1 = 0 ;
goldmas 32:7f8e3ee2adac 465 TEST_SERVO_1.Draw(DIY_GREY, BLANC);
goldmas 32:7f8e3ee2adac 466 }
goldmas 32:7f8e3ee2adac 467 else
goldmas 32:7f8e3ee2adac 468 {
goldmas 32:7f8e3ee2adac 469 bras_select_1 = 1 ;
goldmas 32:7f8e3ee2adac 470 TEST_SERVO_1.Draw(BLEU, BLANC);
goldmas 32:7f8e3ee2adac 471 }
goldmas 32:7f8e3ee2adac 472 }
goldmas 32:7f8e3ee2adac 473 else if(TEST_SERVO_2.Touched())
goldmas 32:7f8e3ee2adac 474 {
goldmas 32:7f8e3ee2adac 475 while (TEST_SERVO_2.Touched());
goldmas 32:7f8e3ee2adac 476 if(bras_select_2)
goldmas 32:7f8e3ee2adac 477 {
goldmas 32:7f8e3ee2adac 478 bras_select_2 = 0 ;
goldmas 32:7f8e3ee2adac 479 TEST_SERVO_2.Draw(DIY_GREY, BLANC);
goldmas 32:7f8e3ee2adac 480 }
goldmas 32:7f8e3ee2adac 481 else
goldmas 32:7f8e3ee2adac 482 {
goldmas 32:7f8e3ee2adac 483 bras_select_2 = 1 ;
goldmas 32:7f8e3ee2adac 484 TEST_SERVO_2.Draw(BLEU, BLANC);
gabrieltetar 21:d137ec53c3a9 485 }
goldmas 32:7f8e3ee2adac 486 }
goldmas 32:7f8e3ee2adac 487 else if(TEST_SERVO_3.Touched())
goldmas 32:7f8e3ee2adac 488 {
goldmas 32:7f8e3ee2adac 489 while (TEST_SERVO_3.Touched());
goldmas 32:7f8e3ee2adac 490 if(bras_select_3)
goldmas 32:7f8e3ee2adac 491 {
goldmas 32:7f8e3ee2adac 492 bras_select_3 = 0 ;
goldmas 32:7f8e3ee2adac 493 TEST_SERVO_3.Draw(DIY_GREY, BLANC);
goldmas 32:7f8e3ee2adac 494 }
goldmas 32:7f8e3ee2adac 495 else
goldmas 32:7f8e3ee2adac 496 {
goldmas 32:7f8e3ee2adac 497 bras_select_3 = 1 ;
goldmas 32:7f8e3ee2adac 498 TEST_SERVO_3.Draw(BLEU, BLANC);
goldmas 32:7f8e3ee2adac 499 }
goldmas 32:7f8e3ee2adac 500 }
goldmas 32:7f8e3ee2adac 501 else if(TEST_SERVO_4.Touched())
goldmas 32:7f8e3ee2adac 502 {
goldmas 32:7f8e3ee2adac 503 while (TEST_SERVO_4.Touched());
goldmas 32:7f8e3ee2adac 504 if(bras_select_4)
goldmas 32:7f8e3ee2adac 505 {
goldmas 32:7f8e3ee2adac 506 bras_select_4 = 0 ;
goldmas 32:7f8e3ee2adac 507 TEST_SERVO_4.Draw(DIY_GREY, BLANC);
goldmas 32:7f8e3ee2adac 508 }
goldmas 32:7f8e3ee2adac 509 else
goldmas 32:7f8e3ee2adac 510 {
goldmas 32:7f8e3ee2adac 511 bras_select_4 = 1 ;
goldmas 32:7f8e3ee2adac 512 TEST_SERVO_4.Draw(BLEU, BLANC);
goldmas 32:7f8e3ee2adac 513 }
goldmas 32:7f8e3ee2adac 514 }
goldmas 32:7f8e3ee2adac 515 else if(TEST_SERVO_5.Touched())
goldmas 32:7f8e3ee2adac 516 {
goldmas 32:7f8e3ee2adac 517 while (TEST_SERVO_5.Touched());
goldmas 32:7f8e3ee2adac 518 if(bras_select_5)
goldmas 32:7f8e3ee2adac 519 {
goldmas 32:7f8e3ee2adac 520 bras_select_5 = 0 ;
goldmas 32:7f8e3ee2adac 521 TEST_SERVO_5.Draw(DIY_GREY, BLANC);
goldmas 32:7f8e3ee2adac 522 }
goldmas 32:7f8e3ee2adac 523 else
goldmas 32:7f8e3ee2adac 524 {
goldmas 32:7f8e3ee2adac 525 bras_select_5 = 1 ;
goldmas 32:7f8e3ee2adac 526 TEST_SERVO_5.Draw(BLEU, BLANC);
goldmas 32:7f8e3ee2adac 527 }
goldmas 32:7f8e3ee2adac 528 }
goldmas 32:7f8e3ee2adac 529 else if (TEST_ATTRAPER.Touched())
goldmas 32:7f8e3ee2adac 530 {
goldmas 32:7f8e3ee2adac 531
gabrieltetar 21:d137ec53c3a9 532 }
gabrieltetar 21:d137ec53c3a9 533 }
gabrieltetar 21:d137ec53c3a9 534 break;
gabrieltetar 21:d137ec53c3a9 535
gabrieltetar 21:d137ec53c3a9 536 case TEST_COULEUR:
gabrieltetar 21:d137ec53c3a9 537 lcd.Clear (LCD_COLOR_WHITE);
gabrieltetar 21:d137ec53c3a9 538 lcd.DisplayStringAt(0, LINE(0), (uint8_t *)"Test Couleur", LEFT_MODE);
gabrieltetar 24:1a13c998c7ac 539 TEST_A.Draw(BLEU, BLANC);
gabrieltetar 24:1a13c998c7ac 540 TEST_B.Draw(BLEU, BLANC);
gabrieltetar 24:1a13c998c7ac 541 TEST_C.Draw(BLEU, BLANC);
gabrieltetar 24:1a13c998c7ac 542 TEST_D.Draw(BLEU, BLANC);
gabrieltetar 21:d137ec53c3a9 543 RETOUR.Draw(0xFFFF0000,0);
gabrieltetar 21:d137ec53c3a9 544 while(strat_etat_s==TEST_COULEUR) {
gabrieltetar 21:d137ec53c3a9 545 if(RETOUR.Touched()) {
gabrieltetar 21:d137ec53c3a9 546 while (RETOUR.Touched());
gabrieltetar 21:d137ec53c3a9 547 strat_etat_s=DEMO;
gabrieltetar 21:d137ec53c3a9 548 lcd.Clear (LCD_COLOR_WHITE);
gabrieltetar 24:1a13c998c7ac 549 }else if(TEST_A.Touched()) {
gabrieltetar 24:1a13c998c7ac 550 while (TEST_A.Touched());
gabrieltetar 24:1a13c998c7ac 551 SendRawId(TEST_BRAS_A);
gabrieltetar 24:1a13c998c7ac 552 TEST_A.Draw(BLEU, BLANC);
gabrieltetar 24:1a13c998c7ac 553 } else if(TEST_B.Touched()) {
gabrieltetar 24:1a13c998c7ac 554 while (TEST_B.Touched());
gabrieltetar 24:1a13c998c7ac 555 SendRawId(TEST_BRAS_B);
gabrieltetar 24:1a13c998c7ac 556 TEST_B.Draw(BLEU, BLANC);
gabrieltetar 24:1a13c998c7ac 557 } else if(TEST_C.Touched()) {
gabrieltetar 24:1a13c998c7ac 558 while (TEST_C.Touched());
gabrieltetar 24:1a13c998c7ac 559 SendRawId(TEST_BRAS_C);
gabrieltetar 24:1a13c998c7ac 560 TEST_C.Draw(BLEU, BLANC);
gabrieltetar 24:1a13c998c7ac 561 } else if(TEST_D.Touched()) {
gabrieltetar 24:1a13c998c7ac 562 while (TEST_D.Touched());
gabrieltetar 24:1a13c998c7ac 563 SendRawId(TEST_BRAS_D);
gabrieltetar 24:1a13c998c7ac 564 TEST_D.Draw(BLEU, BLANC);
gabrieltetar 21:d137ec53c3a9 565 }
gabrieltetar 21:d137ec53c3a9 566 }
gabrieltetar 21:d137ec53c3a9 567 break;
gabrieltetar 21:d137ec53c3a9 568
gabrieltetar 21:d137ec53c3a9 569 case TEST_MOTEUR:
gabrieltetar 21:d137ec53c3a9 570 lcd.SetBackColor(LCD_COLOR_WHITE);
gabrieltetar 21:d137ec53c3a9 571 lcd.SetTextColor(LCD_COLOR_BLACK);
gabrieltetar 21:d137ec53c3a9 572 lcd.Clear (LCD_COLOR_WHITE);
gabrieltetar 21:d137ec53c3a9 573 lcd.Clear (LCD_COLOR_WHITE);
gabrieltetar 21:d137ec53c3a9 574 lcd.DisplayStringAt(0, LINE(0), (uint8_t *)"Test Moteur", LEFT_MODE);
gabrieltetar 21:d137ec53c3a9 575 RETOUR.Draw(0xFFFF0000,0);
gabrieltetar 21:d137ec53c3a9 576 TEST_A.Draw(BLEU, BLANC);
gabrieltetar 21:d137ec53c3a9 577 TEST_B.Draw(BLEU, BLANC);
gabrieltetar 21:d137ec53c3a9 578 while(strat_etat_s==TEST_MOTEUR) {
gabrieltetar 21:d137ec53c3a9 579 if(RETOUR.Touched()) {
gabrieltetar 21:d137ec53c3a9 580 while (RETOUR.Touched());
gabrieltetar 21:d137ec53c3a9 581 strat_etat_s=DEMO;
gabrieltetar 21:d137ec53c3a9 582 } else if(TEST_A.Touched()) {
gabrieltetar 21:d137ec53c3a9 583 while (TEST_A.Touched());
gabrieltetar 21:d137ec53c3a9 584 BendRadius(150,1800,1,0);
gabrieltetar 21:d137ec53c3a9 585 TEST_A.Draw(BLEU, BLANC);
gabrieltetar 21:d137ec53c3a9 586 } else if(TEST_B.Touched()) {
gabrieltetar 21:d137ec53c3a9 587 while (TEST_B.Touched());
gabrieltetar 21:d137ec53c3a9 588 BendRadius(150,1800,0,0);
gabrieltetar 21:d137ec53c3a9 589 TEST_B.Draw(BLEU, BLANC);
gabrieltetar 21:d137ec53c3a9 590 }
gabrieltetar 21:d137ec53c3a9 591 }
gabrieltetar 21:d137ec53c3a9 592 break; ///////////////////////////////////////////FIN DES DEMOS/////////////////////////////////////////////////
gabrieltetar 21:d137ec53c3a9 593
gabrieltetar 21:d137ec53c3a9 594
gabrieltetar 21:d137ec53c3a9 595 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 596 lcd.Clear(LCD_COLOR_WHITE);
gabrieltetar 21:d137ec53c3a9 597 lcd.SetBackColor(LCD_COLOR_WHITE);
gabrieltetar 21:d137ec53c3a9 598 lcd.SetTextColor(LCD_COLOR_BLACK);
gabrieltetar 21:d137ec53c3a9 599
gabrieltetar 21:d137ec53c3a9 600 lcd.DisplayStringAt(70, LINE(0), (uint8_t *)"Choisir le cote", LEFT_MODE);
gabrieltetar 21:d137ec53c3a9 601 COTE_JAUNE.Draw(JAUNE, 0);
gabrieltetar 21:d137ec53c3a9 602 COTE_VIOLET.Draw(VIOLET, 0);
gabrieltetar 21:d137ec53c3a9 603 RETOUR.Draw(LCD_COLOR_RED, 0);
gabrieltetar 21:d137ec53c3a9 604
gabrieltetar 21:d137ec53c3a9 605
gabrieltetar 21:d137ec53c3a9 606 while (strat_etat_s == SELECT_SIDE) {
gabrieltetar 21:d137ec53c3a9 607 canProcessRx();
gabrieltetar 21:d137ec53c3a9 608 if(COTE_JAUNE.Touched()) {
maximilienlv 28:7f2990747e09 609 Cote = 0x1;
gabrieltetar 21:d137ec53c3a9 610 InversStrat = Cote;
gabrieltetar 21:d137ec53c3a9 611 strat_etat_s = TACTIQUE;
gabrieltetar 21:d137ec53c3a9 612 CANMessage trame_Tx = CANMessage();
gabrieltetar 21:d137ec53c3a9 613 trame_Tx.len = 1;
gabrieltetar 21:d137ec53c3a9 614 trame_Tx.format = CANStandard;
gabrieltetar 21:d137ec53c3a9 615 trame_Tx.type = CANData;
gabrieltetar 21:d137ec53c3a9 616 trame_Tx.id=CHOICE_COLOR;
gabrieltetar 21:d137ec53c3a9 617 trame_Tx.data[0]=Cote;
gabrieltetar 21:d137ec53c3a9 618 can2.write(trame_Tx);
gabrieltetar 21:d137ec53c3a9 619 while(COTE_JAUNE.Touched());
gabrieltetar 21:d137ec53c3a9 620
gabrieltetar 21:d137ec53c3a9 621 }
gabrieltetar 21:d137ec53c3a9 622
gabrieltetar 21:d137ec53c3a9 623 if(COTE_VIOLET.Touched()) {
maximilienlv 28:7f2990747e09 624 Cote = 0x0;
gabrieltetar 21:d137ec53c3a9 625 InversStrat= Cote;
gabrieltetar 21:d137ec53c3a9 626 strat_etat_s = TACTIQUE;
gabrieltetar 21:d137ec53c3a9 627 CANMessage trame_Tx = CANMessage();
gabrieltetar 21:d137ec53c3a9 628 trame_Tx.len = 1;
gabrieltetar 21:d137ec53c3a9 629 trame_Tx.format = CANStandard;
gabrieltetar 21:d137ec53c3a9 630 trame_Tx.type = CANData;
gabrieltetar 21:d137ec53c3a9 631 trame_Tx.id=CHOICE_COLOR;
gabrieltetar 21:d137ec53c3a9 632 trame_Tx.data[0]=Cote;
gabrieltetar 21:d137ec53c3a9 633 can2.write(trame_Tx);
gabrieltetar 21:d137ec53c3a9 634 while(COTE_VIOLET.Touched());
gabrieltetar 21:d137ec53c3a9 635 }
gabrieltetar 21:d137ec53c3a9 636
gabrieltetar 21:d137ec53c3a9 637 if(RETOUR.Touched()) {
gabrieltetar 21:d137ec53c3a9 638 strat_etat_s = CHOIX;
gabrieltetar 21:d137ec53c3a9 639 while(RETOUR.Touched());
gabrieltetar 21:d137ec53c3a9 640 }
gabrieltetar 21:d137ec53c3a9 641 }
gabrieltetar 21:d137ec53c3a9 642
gabrieltetar 21:d137ec53c3a9 643 break;
gabrieltetar 21:d137ec53c3a9 644
gabrieltetar 21:d137ec53c3a9 645 case TACTIQUE : //AFFICHE LA LISTE DES STRATS AFIN DE SELECTIONNER CELLE VOULUE
slowness 29:ff575aff301f 646 if (Cote == 1) {
gabrieltetar 21:d137ec53c3a9 647 lcd.Clear(JAUNE);
gabrieltetar 21:d137ec53c3a9 648 lcd.SetBackColor(JAUNE);
slowness 29:ff575aff301f 649 } else if (Cote == 0) {
gabrieltetar 21:d137ec53c3a9 650 lcd.Clear(VIOLET);
gabrieltetar 21:d137ec53c3a9 651 lcd.SetBackColor(VIOLET);
gabrieltetar 21:d137ec53c3a9 652 } else {
gabrieltetar 21:d137ec53c3a9 653 lcd.Clear(BLEU);
gabrieltetar 21:d137ec53c3a9 654 lcd.SetBackColor(BLEU);
gabrieltetar 21:d137ec53c3a9 655 }
gabrieltetar 21:d137ec53c3a9 656
gabrieltetar 21:d137ec53c3a9 657 lcd.SetTextColor(LCD_COLOR_BLACK);
gabrieltetar 21:d137ec53c3a9 658
gabrieltetar 21:d137ec53c3a9 659 lcd.DisplayStringAt(20, LINE(0), (uint8_t *)"Choisir une strategie", LEFT_MODE);
gabrieltetar 21:d137ec53c3a9 660
gabrieltetar 21:d137ec53c3a9 661 nbStrat = Bouton_Strat(); // retourne valeur de Strategie si bouton strat renvoi -1 on reviens en arriere
gabrieltetar 21:d137ec53c3a9 662 if (nbStrat == -1) {
gabrieltetar 21:d137ec53c3a9 663 strat_etat_s = SELECT_SIDE;
gabrieltetar 21:d137ec53c3a9 664 } else {
gabrieltetar 21:d137ec53c3a9 665 strat_etat_s = DETAILS;
gabrieltetar 21:d137ec53c3a9 666 }
gabrieltetar 21:d137ec53c3a9 667 wait(0.1);
gabrieltetar 21:d137ec53c3a9 668 break;
gabrieltetar 21:d137ec53c3a9 669
gabrieltetar 21:d137ec53c3a9 670 case DETAILS : //SECONDE VALIDATION DE LA STRAT
gabrieltetar 21:d137ec53c3a9 671 lcd.Clear(LCD_COLOR_WHITE);
gabrieltetar 21:d137ec53c3a9 672 lcd.SetBackColor(LCD_COLOR_WHITE);
gabrieltetar 21:d137ec53c3a9 673 lcd.SetTextColor(LCD_COLOR_BLACK);
gabrieltetar 21:d137ec53c3a9 674 CHECK.Draw(VERT);
gabrieltetar 21:d137ec53c3a9 675 RETOUR.Draw(LCD_COLOR_RED);
gabrieltetar 21:d137ec53c3a9 676
gabrieltetar 21:d137ec53c3a9 677 SelectionStrat(nbStrat); //affiche la stratégie selectionnée
gabrieltetar 21:d137ec53c3a9 678
gabrieltetar 21:d137ec53c3a9 679 while (strat_etat_s == DETAILS) {
gabrieltetar 21:d137ec53c3a9 680 canProcessRx();
gabrieltetar 21:d137ec53c3a9 681 if (CHECK.Touched()) {
gabrieltetar 21:d137ec53c3a9 682 if(gameEtat == ETAT_CONFIG) {
gabrieltetar 21:d137ec53c3a9 683 gameEtat = ETAT_GAME_INIT;
gabrieltetar 21:d137ec53c3a9 684 strat_etat_s=LECTURE;
gabrieltetar 21:d137ec53c3a9 685
gabrieltetar 21:d137ec53c3a9 686 }
gabrieltetar 21:d137ec53c3a9 687 while(CHECK.Touched());
gabrieltetar 21:d137ec53c3a9 688 }
gabrieltetar 21:d137ec53c3a9 689
gabrieltetar 21:d137ec53c3a9 690 if(RETOUR.Touched()) {
gabrieltetar 21:d137ec53c3a9 691 strat_etat_s = TACTIQUE;
gabrieltetar 21:d137ec53c3a9 692 while(RETOUR.Touched());
gabrieltetar 21:d137ec53c3a9 693 }
gabrieltetar 21:d137ec53c3a9 694 }
gabrieltetar 21:d137ec53c3a9 695 break;
gabrieltetar 21:d137ec53c3a9 696
gabrieltetar 21:d137ec53c3a9 697
gabrieltetar 21:d137ec53c3a9 698 case LECTURE :
gabrieltetar 21:d137ec53c3a9 699 break;
gabrieltetar 21:d137ec53c3a9 700 case AFF_WAIT_JACK : //FONCTIONS D'AFFICHAGE DE L'ATTENTE DU JACK
gabrieltetar 21:d137ec53c3a9 701 lcd.Clear(BLANC);
gabrieltetar 21:d137ec53c3a9 702 lcd.SetBackColor(LCD_COLOR_WHITE);
gabrieltetar 21:d137ec53c3a9 703 lcd.SetTextColor(LCD_COLOR_BLACK);
gabrieltetar 21:d137ec53c3a9 704
gabrieltetar 21:d137ec53c3a9 705 if (Cote == 0) {
gabrieltetar 21:d137ec53c3a9 706 lcd.Clear(VERT);
gabrieltetar 21:d137ec53c3a9 707 lcd.SetBackColor(VERT);
gabrieltetar 21:d137ec53c3a9 708 } else if (Cote == 1) {
gabrieltetar 21:d137ec53c3a9 709 lcd.Clear(ORANGE);
gabrieltetar 21:d137ec53c3a9 710 lcd.SetBackColor(ORANGE);
gabrieltetar 21:d137ec53c3a9 711 } else {
gabrieltetar 21:d137ec53c3a9 712 lcd.Clear(VERT);
gabrieltetar 21:d137ec53c3a9 713 lcd.SetBackColor(VERT);
gabrieltetar 21:d137ec53c3a9 714 }
gabrieltetar 21:d137ec53c3a9 715 canProcessRx();
gabrieltetar 21:d137ec53c3a9 716 lcd.DisplayStringAt(0, LINE(0), (uint8_t *)"En attente du Jack", CENTER_MODE);
gabrieltetar 21:d137ec53c3a9 717 strat_etat_s=WAIT_JACK;
gabrieltetar 21:d137ec53c3a9 718 break;
gabrieltetar 21:d137ec53c3a9 719
gabrieltetar 21:d137ec53c3a9 720 case WAIT_JACK: //VERITABLE ATTENTE DU JACK
gabrieltetar 21:d137ec53c3a9 721 break;
gabrieltetar 21:d137ec53c3a9 722
gabrieltetar 21:d137ec53c3a9 723 case FIN : //AFFICHAGE DE FIN AVEC LE SCORE FINAL
gabrieltetar 21:d137ec53c3a9 724 lcd.Clear (LCD_COLOR_WHITE);
gabrieltetar 21:d137ec53c3a9 725 lcd.SetBackColor(LCD_COLOR_WHITE);
gabrieltetar 21:d137ec53c3a9 726
gabrieltetar 21:d137ec53c3a9 727
gabrieltetar 21:d137ec53c3a9 728 while(1); // force le redemarage du robot
gabrieltetar 21:d137ec53c3a9 729 //break;
gabrieltetar 21:d137ec53c3a9 730
gabrieltetar 21:d137ec53c3a9 731 }
gabrieltetar 21:d137ec53c3a9 732 }
gabrieltetar 21:d137ec53c3a9 733 /****************************************************************************************/
gabrieltetar 21:d137ec53c3a9 734 /* FUNCTION NAME: Bouton_Strat */
gabrieltetar 21:d137ec53c3a9 735 /* DESCRIPTION : Sélection de la strat sur le lcd puis envoie sur CAN (à modifier!) */
gabrieltetar 21:d137ec53c3a9 736 /****************************************************************************************/
gabrieltetar 21:d137ec53c3a9 737 signed char Bouton_Strat (void)
gabrieltetar 21:d137ec53c3a9 738 {
gabrieltetar 21:d137ec53c3a9 739 char Ack_strat = 0;
gabrieltetar 21:d137ec53c3a9 740 signed char Strat = 0;
gabrieltetar 21:d137ec53c3a9 741 Button STRAT_1 (0, 30, 190, 110, strat_sd[0]);
gabrieltetar 21:d137ec53c3a9 742 Button STRAT_2 (210, 30, 190, 110, strat_sd[1]);
gabrieltetar 21:d137ec53c3a9 743 Button STRAT_3 (0, 150, 190, 110, strat_sd[2]);
gabrieltetar 21:d137ec53c3a9 744 Button STRAT_4 (210, 150, 190, 110, strat_sd[3]);
gabrieltetar 21:d137ec53c3a9 745 Button STRAT_5 (0, 270, 190, 110,strat_sd[4]);
gabrieltetar 21:d137ec53c3a9 746 Button STRAT_6 (210, 270, 190, 110, strat_sd[5]);
gabrieltetar 21:d137ec53c3a9 747 Button STRAT_7 (0, 390, 190, 110, strat_sd[6]);
gabrieltetar 21:d137ec53c3a9 748 Button STRAT_8 (210, 390, 190, 110, strat_sd[7]);
gabrieltetar 21:d137ec53c3a9 749 Button STRAT_9 (0, 510, 190, 110, strat_sd[8]);
gabrieltetar 21:d137ec53c3a9 750 Button STRAT_10 (210, 510, 190, 110, strat_sd[9]);
gabrieltetar 21:d137ec53c3a9 751 Button RETOUR (0, 680, 400, 110, "--Precedent--");
gabrieltetar 21:d137ec53c3a9 752 //Definition des boutons
gabrieltetar 21:d137ec53c3a9 753
gabrieltetar 21:d137ec53c3a9 754 Ack_strat = 0;
gabrieltetar 21:d137ec53c3a9 755 Strat = 0;
gabrieltetar 21:d137ec53c3a9 756 STRAT_1.Draw(0xFFF0F0F0, 0);
gabrieltetar 21:d137ec53c3a9 757 STRAT_2.Draw(0xFFF0F0F0, 0);
gabrieltetar 21:d137ec53c3a9 758 STRAT_3.Draw(0xFFF0F0F0, 0);
gabrieltetar 21:d137ec53c3a9 759 STRAT_4.Draw(0xFFF0F0F0, 0);
gabrieltetar 21:d137ec53c3a9 760 STRAT_5.Draw(0xFFF0F0F0, 0);
gabrieltetar 21:d137ec53c3a9 761 STRAT_6.Draw(0xFFF0F0F0, 0);
gabrieltetar 21:d137ec53c3a9 762 STRAT_7.Draw(0xFFF0F0F0, 0);
gabrieltetar 21:d137ec53c3a9 763 STRAT_8.Draw(0xFFF0F0F0, 0);
gabrieltetar 21:d137ec53c3a9 764 STRAT_9.Draw(0xFFF0F0F0, 0);
gabrieltetar 21:d137ec53c3a9 765 STRAT_10.Draw(0xFFF0F0F0, 0);
gabrieltetar 21:d137ec53c3a9 766 RETOUR.Draw(0xFFFF0000, 0);
gabrieltetar 21:d137ec53c3a9 767
gabrieltetar 21:d137ec53c3a9 768 while(Ack_strat == 0) {
gabrieltetar 21:d137ec53c3a9 769 canProcessRx();
gabrieltetar 21:d137ec53c3a9 770 CANMessage msgTx=CANMessage();
gabrieltetar 21:d137ec53c3a9 771 //msgTx.id=ECRAN_CHOICE_STRAT;
gabrieltetar 21:d137ec53c3a9 772 if (RETOUR.Touched())
gabrieltetar 21:d137ec53c3a9 773 return -1;
gabrieltetar 21:d137ec53c3a9 774 while(RETOUR.Touched());
gabrieltetar 21:d137ec53c3a9 775 //////////////////////////////STRATEGIE N°1
gabrieltetar 21:d137ec53c3a9 776 if (STRAT_1.Touched()) {
gabrieltetar 21:d137ec53c3a9 777 Strat = 0;
gabrieltetar 21:d137ec53c3a9 778 //msgTx.data[0] = 0x1;
gabrieltetar 21:d137ec53c3a9 779 //can2.write(msgTx);
gabrieltetar 21:d137ec53c3a9 780 while(STRAT_1.Touched());
gabrieltetar 21:d137ec53c3a9 781 Ack_strat =1;
gabrieltetar 21:d137ec53c3a9 782 }
gabrieltetar 21:d137ec53c3a9 783 /////////////////////////////STRATEGIE N°2
gabrieltetar 21:d137ec53c3a9 784 if (STRAT_2.Touched()) {
gabrieltetar 21:d137ec53c3a9 785 Strat = 1;
gabrieltetar 21:d137ec53c3a9 786 //msgTx.data[0] = 0x2;
gabrieltetar 21:d137ec53c3a9 787 //can2.write(msgTx);
gabrieltetar 21:d137ec53c3a9 788 while(STRAT_2.Touched());
gabrieltetar 21:d137ec53c3a9 789 Ack_strat =1;
gabrieltetar 21:d137ec53c3a9 790 }
gabrieltetar 21:d137ec53c3a9 791 //////////////////////////////STRATEGIE N°3
gabrieltetar 21:d137ec53c3a9 792 if (STRAT_3.Touched()) {
gabrieltetar 21:d137ec53c3a9 793 Strat = 2;
gabrieltetar 21:d137ec53c3a9 794 //msgTx.data[0] = 0x3;
gabrieltetar 21:d137ec53c3a9 795 //can2.write(msgTx);
gabrieltetar 21:d137ec53c3a9 796 while(STRAT_3.Touched());
gabrieltetar 21:d137ec53c3a9 797 Ack_strat =1;
gabrieltetar 21:d137ec53c3a9 798 }
gabrieltetar 21:d137ec53c3a9 799 /////////////////////////////STRATEGIE N°4
gabrieltetar 21:d137ec53c3a9 800 if (STRAT_4.Touched()) {
gabrieltetar 21:d137ec53c3a9 801 Strat = 3;
gabrieltetar 21:d137ec53c3a9 802 //msgTx.data[0] = 0x4;
gabrieltetar 21:d137ec53c3a9 803 //can2.write(msgTx);
gabrieltetar 21:d137ec53c3a9 804 while(STRAT_4.Touched());
gabrieltetar 21:d137ec53c3a9 805 Ack_strat =1;
gabrieltetar 21:d137ec53c3a9 806 }
gabrieltetar 21:d137ec53c3a9 807 ///////////////////////////////STRATEGIE N°5
gabrieltetar 21:d137ec53c3a9 808 if (STRAT_5.Touched()) {
gabrieltetar 21:d137ec53c3a9 809 Strat = 4;
gabrieltetar 21:d137ec53c3a9 810 //msgTx.data[0] = 0x5;
gabrieltetar 21:d137ec53c3a9 811 //can2.write(msgTx);
gabrieltetar 21:d137ec53c3a9 812 while(STRAT_5.Touched());
gabrieltetar 21:d137ec53c3a9 813 Ack_strat =1;
gabrieltetar 21:d137ec53c3a9 814 }
gabrieltetar 21:d137ec53c3a9 815 ////////////////////////////////STRATEGIE N°6
gabrieltetar 21:d137ec53c3a9 816 if (STRAT_6.Touched()) {
gabrieltetar 21:d137ec53c3a9 817 Strat = 5;
gabrieltetar 21:d137ec53c3a9 818 //msgTx.data[0] = 0x6;
gabrieltetar 21:d137ec53c3a9 819 //can2.write(msgTx);
gabrieltetar 21:d137ec53c3a9 820 while(STRAT_6.Touched());
gabrieltetar 21:d137ec53c3a9 821 Ack_strat =1;
gabrieltetar 21:d137ec53c3a9 822 }
gabrieltetar 21:d137ec53c3a9 823 /////////////////////////////////STRATEGIE N°7
gabrieltetar 21:d137ec53c3a9 824 if (STRAT_7.Touched()) {
gabrieltetar 21:d137ec53c3a9 825 Strat = 6;
gabrieltetar 21:d137ec53c3a9 826 //msgTx.data[0] = 0x7;
gabrieltetar 21:d137ec53c3a9 827 //can2.write(msgTx);
gabrieltetar 21:d137ec53c3a9 828 while(STRAT_7.Touched());
gabrieltetar 21:d137ec53c3a9 829 Ack_strat =1;
gabrieltetar 21:d137ec53c3a9 830 }
gabrieltetar 21:d137ec53c3a9 831 /////////////////////////////////STRATEGIE N°8
gabrieltetar 21:d137ec53c3a9 832 if (STRAT_8.Touched()) {
gabrieltetar 21:d137ec53c3a9 833 Strat = 7;
gabrieltetar 21:d137ec53c3a9 834 //msgTx.data[0] = 0x8;
gabrieltetar 21:d137ec53c3a9 835 //can2.write(msgTx);
gabrieltetar 21:d137ec53c3a9 836 while(STRAT_8.Touched());
gabrieltetar 21:d137ec53c3a9 837 Ack_strat =1;
gabrieltetar 21:d137ec53c3a9 838 }
gabrieltetar 21:d137ec53c3a9 839 /////////////////////////////////STRATEGIE N°9
gabrieltetar 21:d137ec53c3a9 840 if (STRAT_9.Touched()) {
gabrieltetar 21:d137ec53c3a9 841 Strat = 8;
gabrieltetar 21:d137ec53c3a9 842 //msgTx.data[0] = 0x9;
gabrieltetar 21:d137ec53c3a9 843 //can2.write(msgTx);
gabrieltetar 21:d137ec53c3a9 844 while(STRAT_9.Touched());
gabrieltetar 21:d137ec53c3a9 845 Ack_strat =1;
gabrieltetar 21:d137ec53c3a9 846 }
gabrieltetar 21:d137ec53c3a9 847 ///////////////////////////////////STRATEGIE N°10
gabrieltetar 21:d137ec53c3a9 848 if (STRAT_10.Touched()) {
gabrieltetar 21:d137ec53c3a9 849 Strat = 9;
gabrieltetar 21:d137ec53c3a9 850 //msgTx.data[0] = 0xA;
gabrieltetar 21:d137ec53c3a9 851 //can2.write(msgTx);
gabrieltetar 21:d137ec53c3a9 852 while(STRAT_10.Touched());
gabrieltetar 21:d137ec53c3a9 853 Ack_strat =1;
gabrieltetar 21:d137ec53c3a9 854 }
gabrieltetar 21:d137ec53c3a9 855
gabrieltetar 21:d137ec53c3a9 856 }
gabrieltetar 21:d137ec53c3a9 857 return Strat;
gabrieltetar 21:d137ec53c3a9 858
gabrieltetar 21:d137ec53c3a9 859 }
gabrieltetar 21:d137ec53c3a9 860 /****************************************************************************************/
gabrieltetar 21:d137ec53c3a9 861 /* FUNCTION NAME: SelectionStrat */
gabrieltetar 21:d137ec53c3a9 862 /* DESCRIPTION : Affiche la Stratégie sélectionnée sur l'ihm */
gabrieltetar 21:d137ec53c3a9 863 /****************************************************************************************/
gabrieltetar 21:d137ec53c3a9 864
gabrieltetar 21:d137ec53c3a9 865
gabrieltetar 21:d137ec53c3a9 866 void SelectionStrat (unsigned char Strategie)
gabrieltetar 21:d137ec53c3a9 867 {
gabrieltetar 21:d137ec53c3a9 868 lcd.SetBackColor(LCD_COLOR_WHITE);
gabrieltetar 21:d137ec53c3a9 869 lcd.SetTextColor(LCD_COLOR_BLACK);
gabrieltetar 21:d137ec53c3a9 870
gabrieltetar 21:d137ec53c3a9 871 switch (Strategie+1) {
gabrieltetar 21:d137ec53c3a9 872 case 0x1 :
gabrieltetar 21:d137ec53c3a9 873 //description de Strategie n°1
gabrieltetar 21:d137ec53c3a9 874 lcd.DisplayStringAt(150, 0, (uint8_t *)strat_sd[Strategie], LEFT_MODE);
gabrieltetar 21:d137ec53c3a9 875 break;
gabrieltetar 21:d137ec53c3a9 876
gabrieltetar 21:d137ec53c3a9 877 case 0x2 :
gabrieltetar 21:d137ec53c3a9 878 //description de Strategie n°2
gabrieltetar 21:d137ec53c3a9 879 lcd.DisplayStringAt(150,0, (uint8_t *)strat_sd[Strategie], LEFT_MODE);
gabrieltetar 21:d137ec53c3a9 880 break;
gabrieltetar 21:d137ec53c3a9 881
gabrieltetar 21:d137ec53c3a9 882 case 0x3 :
gabrieltetar 21:d137ec53c3a9 883 //description de Strategie n°3
gabrieltetar 21:d137ec53c3a9 884 lcd.DisplayStringAt(150,0, (uint8_t *)strat_sd[Strategie], LEFT_MODE);
gabrieltetar 21:d137ec53c3a9 885 break;
gabrieltetar 21:d137ec53c3a9 886
gabrieltetar 21:d137ec53c3a9 887 case 0x4 :
gabrieltetar 21:d137ec53c3a9 888 //description de Strategie n°4
gabrieltetar 21:d137ec53c3a9 889 lcd.DisplayStringAt(150,0, (uint8_t *)strat_sd[Strategie], LEFT_MODE);
gabrieltetar 21:d137ec53c3a9 890 break;
gabrieltetar 21:d137ec53c3a9 891
gabrieltetar 21:d137ec53c3a9 892 case 0x5 :
gabrieltetar 21:d137ec53c3a9 893 //description de Strategie n°5
gabrieltetar 21:d137ec53c3a9 894 lcd.DisplayStringAt(150,0, (uint8_t *)strat_sd[Strategie], LEFT_MODE);
gabrieltetar 21:d137ec53c3a9 895 break;
gabrieltetar 21:d137ec53c3a9 896
gabrieltetar 21:d137ec53c3a9 897 case 0x6 :
gabrieltetar 21:d137ec53c3a9 898 //description de Strategie n°5
gabrieltetar 21:d137ec53c3a9 899 lcd.DisplayStringAt(150,0, (uint8_t *)strat_sd[Strategie], LEFT_MODE);
gabrieltetar 21:d137ec53c3a9 900 break;
gabrieltetar 21:d137ec53c3a9 901
gabrieltetar 21:d137ec53c3a9 902 case 0x7 :
gabrieltetar 21:d137ec53c3a9 903 //description de Strategie n°5
gabrieltetar 21:d137ec53c3a9 904 lcd.DisplayStringAt(150,0, (uint8_t *)strat_sd[Strategie], LEFT_MODE);
gabrieltetar 21:d137ec53c3a9 905 break;
gabrieltetar 21:d137ec53c3a9 906
gabrieltetar 21:d137ec53c3a9 907 case 0x8 :
gabrieltetar 21:d137ec53c3a9 908 //description de Strategie n°5
gabrieltetar 21:d137ec53c3a9 909 lcd.DisplayStringAt(150,0, (uint8_t *)strat_sd[Strategie], LEFT_MODE);
gabrieltetar 21:d137ec53c3a9 910 break;
gabrieltetar 21:d137ec53c3a9 911
gabrieltetar 21:d137ec53c3a9 912 case 0x9 :
gabrieltetar 21:d137ec53c3a9 913 //description de Strategie n°5
gabrieltetar 21:d137ec53c3a9 914 lcd.DisplayStringAt(150,0, (uint8_t *)strat_sd[Strategie], LEFT_MODE);
gabrieltetar 21:d137ec53c3a9 915 break;
gabrieltetar 21:d137ec53c3a9 916
gabrieltetar 21:d137ec53c3a9 917 case 0xA :
gabrieltetar 21:d137ec53c3a9 918 //description de Strategie n°5
gabrieltetar 21:d137ec53c3a9 919 lcd.DisplayStringAt(150,0, (uint8_t *)strat_sd[Strategie], LEFT_MODE);
gabrieltetar 21:d137ec53c3a9 920 break;
gabrieltetar 21:d137ec53c3a9 921 }
gabrieltetar 27:ff70537a7619 922 }
gabrieltetar 27:ff70537a7619 923
gabrieltetar 27:ff70537a7619 924 void DrawC (int l,int h,int x, int y, unsigned char fill){
gabrieltetar 27:ff70537a7619 925 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 926 for(int a=0;a<8;a++){
gabrieltetar 27:ff70537a7619 927 c[a].X+=x;
gabrieltetar 27:ff70537a7619 928 c[a].Y+=y;
gabrieltetar 27:ff70537a7619 929 }
gabrieltetar 27:ff70537a7619 930 lcd.DrawPolygon(c, 8);
gabrieltetar 27:ff70537a7619 931
gabrieltetar 27:ff70537a7619 932 }
gabrieltetar 27:ff70537a7619 933 void DrawR (int l,int h,int x, int y, unsigned char fill){
gabrieltetar 27:ff70537a7619 934 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 935 for(int a=0;a<10;a++){
gabrieltetar 27:ff70537a7619 936 r[a].X+=x;
gabrieltetar 27:ff70537a7619 937 r[a].Y+=y;
gabrieltetar 27:ff70537a7619 938 }
gabrieltetar 27:ff70537a7619 939 lcd.DrawPolygon(r, 10);
gabrieltetar 27:ff70537a7619 940 }
gabrieltetar 27:ff70537a7619 941 void DrawA (int l,int h,int x, int y, unsigned char fill){
gabrieltetar 27:ff70537a7619 942 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 943 for(int z=0;z<8;z++){
gabrieltetar 27:ff70537a7619 944 a[z].X+=x;
gabrieltetar 27:ff70537a7619 945 a[z].Y+=y;
gabrieltetar 27:ff70537a7619 946 }
gabrieltetar 27:ff70537a7619 947 lcd.DrawPolygon(a, 8);
gabrieltetar 27:ff70537a7619 948 }
gabrieltetar 27:ff70537a7619 949 void DrawCheck (int l,int h,int x, int y, int cochage){
gabrieltetar 27:ff70537a7619 950 if(x<3)x=3;
gabrieltetar 27:ff70537a7619 951 if(cochage == 1){
gabrieltetar 27:ff70537a7619 952 lcd.SetTextColor(VERT_F);
gabrieltetar 27:ff70537a7619 953 lcd.DrawLine(x,y-(h/2),x+l/2,y+h/2);
gabrieltetar 27:ff70537a7619 954 lcd.DrawLine(x-1,y-(h/2),x+l/2,y+h/2+1);
gabrieltetar 27:ff70537a7619 955 lcd.DrawLine(x-2,y-(h/2),x+l/2,y+h/2+2);
gabrieltetar 27:ff70537a7619 956 lcd.DrawLine(x+l/2,y+h/2,x+(4*(l/3)),y);
gabrieltetar 27:ff70537a7619 957 lcd.DrawLine(x+l/2,y+h/2+1,x+(4*(l/3))+1,y);
gabrieltetar 27:ff70537a7619 958 lcd.DrawLine(x+l/2,y+h/2+2,x+(4*(l/3))+2,y);
gabrieltetar 27:ff70537a7619 959 lcd.SetTextColor(NOIR);
gabrieltetar 27:ff70537a7619 960 } else {
gabrieltetar 27:ff70537a7619 961 Point a[4]={{0,0},{l,0},{l,h},{0,h}};
gabrieltetar 27:ff70537a7619 962 for(int z=0;z<8;z++){
gabrieltetar 27:ff70537a7619 963 a[z].X+=x;
gabrieltetar 27:ff70537a7619 964 a[z].Y+=y;
gabrieltetar 27:ff70537a7619 965 }
gabrieltetar 27:ff70537a7619 966 lcd.DrawPolygon(a, 4);
gabrieltetar 27:ff70537a7619 967 }
gabrieltetar 21:d137ec53c3a9 968 }