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