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