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

Dependencies:   mbed SerialHalfDuplex SDFileSystem liaison_Bluetooth ident_crac DISCO-F469NI_portrait

Files at this revision

API Documentation at this revision

Comitter:
gabrieltetar
Date:
Mon May 25 18:25:20 2020 +0000
Parent:
18:746bc235199d
Child:
20:2f0b1c48a35f
Commit message:
correctif precedent publish + suppression affichage_debug

Changed in this revision

Debug/debug.h Show annotated file Show diff for this revision Revisions of this file
Globals/global.h Show annotated file Show diff for this revision Revisions of this file
Strategie/Strategie.cpp Show annotated file Show diff for this revision Revisions of this file
Strategie/Strategie.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/Debug/debug.h	Mon May 25 18:00:16 2020 +0000
+++ b/Debug/debug.h	Mon May 25 18:25:20 2020 +0000
@@ -32,6 +32,5 @@
 
 void debugXYTTarget(signed short target_x_robot, signed short target_y_robot, signed short target_theta_robot) ;
 
-//void affichage_debug(void);
 
 #endif
\ No newline at end of file
--- a/Globals/global.h	Mon May 25 18:00:16 2020 +0000
+++ b/Globals/global.h	Mon May 25 18:25:20 2020 +0000
@@ -25,9 +25,6 @@
 
 //#include "peripheriques.h"
 extern Serial pc;
-extern LiaisonBluetooth liaison_Tx;
-extern LiaisonBluetooth liaison_Rx;
-extern LiaisonBluetooth liaison_pr;
 
 extern CAN can1;
 extern CAN can2;
@@ -36,7 +33,7 @@
 extern char strat_sd[10][SIZE+8];
 extern char PATH[10][SIZE+8];
 
-extern signed char Strategie;
+extern signed char nbStrat;
 
 extern int ack_bluetooth;
 
--- a/Strategie/Strategie.cpp	Mon May 25 18:00:16 2020 +0000
+++ b/Strategie/Strategie.cpp	Mon May 25 18:25:20 2020 +0000
@@ -102,7 +102,7 @@
 
 
 
-signed char Strategie = 0; //N° de la strategie (1-10)
+signed char nbStrat = 0; //N° de la strategie (1-10)
 
 unsigned char ModeDemo = 0; // Si à 1, indique que l'on est dans le mode demo
 
@@ -301,32 +301,6 @@
 }
 
 
-/****************************************************************************************/
-/* FUNCTION NAME: affichage_debug                                                       */
-/* DESCRIPTION  : Affiche l'état de gameEtat sur l'écran lcd                            */
-/****************************************************************************************/
-void affichage_debug(int Var)
-{
-    int i;
-    int conv=(int)Var;
-    SUIVANT.Draw(ROUGE, 0);
-    for(i=0; i<9; i++) {
-        strcpy(tableau_aff[i],"");
-        strcpy(tableau_aff[i],tableau_aff[i+1]);
-    }
-    strcpy(tableau_aff[9],tableau_etat[conv]);
-    
-    for(i=0; i<10; i++) {
-        lcd.SetBackColor(VERT);
-        lcd.DisplayStringAt(0, LINE(20+i), (uint8_t *)tableau_aff[i], LEFT_MODE);
-    }
-    /*while(!ack_bluetooth){    // mode pas à pas en bluetooth ou via écran
-        //liaison_bluetooth();
-    }
-    ack_bluetooth=0;*/
-    /*while(SUIVANT.Touched()==0);
-    while(SUIVANT.Touched());*/
-}
 
 /****************************************************************************************/
 /* FUNCTION NAME: automate_etat_ihm                                                     */
@@ -550,8 +524,7 @@
                 }  else if(TEST_NUM.Touched()) {
                     while (TEST_NUM.Touched());
                     TEST_NUM.Draw(BLEU, BLANC);
-                    Debug_
-                    Audio(3,maximilien);
+                    Debug_Audio(3,maximilien);
                 } else if(TEST_PLUS.Touched()) {
                     while (TEST_PLUS.Touched());
                     TEST_PLUS.Draw(BLEU, BLANC);
@@ -757,8 +730,8 @@
 
             lcd.DisplayStringAt(20, LINE(0), (uint8_t *)"Choisir une strategie", LEFT_MODE);
 
-            Strategie = Bouton_Strat(); // retourne valeur de Strategie si bouton strat renvoi -1 on reviens en arriere
-            if (Strategie == -1) {
+            nbStrat = Bouton_Strat(); // retourne valeur de Strategie si bouton strat renvoi -1 on reviens en arriere
+            if (nbStrat == -1) {
                 etat = SELECT_SIDE;
             } else {
                 etat = DETAILS;
@@ -773,7 +746,7 @@
             CHECK.Draw(VERT);
             RETOUR.Draw(LCD_COLOR_RED);
 
-            SelectionStrat(Strategie); //affiche la stratégie selectionnée
+            SelectionStrat(nbStrat); //affiche la stratégie selectionnée
 
             while (etat == DETAILS) {
                 canProcessRx();
@@ -828,18 +801,11 @@
                 // affichage_compteur(100-cpt);
                 //affichage_compteur(SCORE_PR);
                 affichage_var(SCORE_PR);
-                if(liaison_pr.paquet_en_attente()) {
-                    PaquetDomotique *paquet=liaison_pr.lire();
-                    if(paquet->identifiant==PAQUET_IDENTIFIANT_AJOUTERSCORE) {
-                        SCORE_PR+=convertir_score(paquet);
-                    }
-                    delete paquet;
-                }
             }
             cpt1=cpt;
             flag_timer=0;
 
-            //affichage_debug(gameEtat);
+
             lcd.SetBackColor(LCD_COLOR_WHITE);
 
             break;
@@ -860,10 +826,10 @@
 
 
 /****************************************************************************************/
-/* FUNCTION NAME: automate_process                                                      */
+/* FUNCTION NAME: Strategie                                                             */
 /* DESCRIPTION  : Automate de gestion de la stratégie du robot                          */
 /****************************************************************************************/
-void automate_process(void)
+void Strategie(void)
 {
     static unsigned char AX12_enchainement = 0;
     static unsigned char MV_enchainement = 0;
@@ -970,7 +936,7 @@
         case ETAT_GAME_INIT:
             //On charge la liste des instructions
 
-            loadAllInstruction(Strategie);//Mise en cache de toute les instructions
+            loadAllInstruction(nbStrat);//Mise en cache de toute les instructions
             led3=1;
 
             SendRawId(GLOBAL_START);
@@ -1155,7 +1121,7 @@
             Traitement de l'instruction, envoie de la trame CAN
             */
             //debug_Instruction(instruction);
-            //affichage_debug(gameEtat);
+
             actionPrecedente = instruction.order;
             switch(instruction.order) {
                 case MV_BEZIER: {
@@ -2468,7 +2434,6 @@
 
         case 150:
             SCORE_PR+=arg1;
-            liaison_Tx.envoyer_short(0x30,SCORE_PR);
             waitingAckFrom = 0;
             waitingAckID = 0;
             break;
--- a/Strategie/Strategie.h	Mon May 25 18:00:16 2020 +0000
+++ b/Strategie/Strategie.h	Mon May 25 18:25:20 2020 +0000
@@ -1,7 +1,6 @@
 #ifndef CRAC_STRATEGIE
 #define CRAC_STRATEGIE
 
-// codeur droit A maron bleu, B maron
 typedef enum
 {
     RECALAGE_1,
@@ -21,7 +20,6 @@
     ETAT_CHECK_CARTES_WAIT_ACK, //Time out de 1s
     ETAT_WAIT_FORCE,//Attente du forçage du lancement
     ETAT_CONFIG, //attente reception du choix du mode( debug ou game)
-    
     ETAT_GAME_INIT,//Mise en mémoire du fichier de stratégie
     ETAT_GAME_WAIT_FOR_JACK,//Attente du retrait du jack
     ETAT_GAME_START,//Lancement du timer 90s
@@ -32,50 +30,15 @@
     ETAT_GAME_JUMP_CONFIG,
     ETAT_GAME_JUMP_POSITION,
     ETAT_GAME_WAIT_END_INSTRUCTION,
-    
-    /* A CHIER SERIEUX C NAZE
-    
-    ETAT_WARNING_TIMEOUT,//Attente de la trame fin de danger ou du timeout de 2s
-    ETAT_WARING_END_BALISE_WAIT,//Attente d'une seconde apres la fin d'un End Balise pour etre sur que c'est bon
-    ETAT_WARNING_END_LAST_INSTRUCTION,//trouver le meilleur moyen de reprendre l'instruction en cours
-    ETAT_WARNING_SWITCH_STRATEGIE,//Si à la fin du timeout il y a toujours un robot, passer à l'instruction d'erreur
-    
-    ETAT_TELEMETRE_BALANCE,
-    */
-
-    
     ETAT_END,
     ETAT_END_LOOP,
-    
 } E_stratGameEtat;
 
-/*
-typedef enum
-{
-    ETAT_INIT_EVITEMENT,
-    ETAT_ESTIMATION_POSITION,
-    ETAT_ESTIMATION_POSITION_ROTATION_ACK,
-    ETAT_ESTIMATION_POSITION_ROTATION_ACK_END,
-    ETAT_CALCUL_CHEMIN,
-    ETAT_FIN_EVITEMENT
-
-} E_Evitement;
-*/
-
-
-/****************************************************************************************/
-/* FUNCTION NAME: canProcessRx                                                          */
-/* DESCRIPTION  : Fonction de traitement des messages CAN                               */
-/****************************************************************************************/
 void canProcessRx(void);
-void automate_process(void);
+void Strategie(void);
 void automate_etat_ihm(void);
 void init_lcd(void);
-
-void affichage_debug(int var);
-
 short recalageAngulaireCapteur(void);
 short recalageDistanceX(void);
 short recalageDistanceY(void);
-
 #endif
--- a/main.cpp	Mon May 25 18:00:16 2020 +0000
+++ b/main.cpp	Mon May 25 18:25:20 2020 +0000
@@ -1,6 +1,4 @@
-#include "mbed.h"
 #include "global.h"
-#include <CAN.h>
 
 CAN can1(PB_8,PB_9); // Rx&Tx pour le CAN
 CAN can2(PB_5, PB_13);
@@ -53,7 +51,7 @@
     wait_ms(2000);//Attente pour que toutes les cartes se lancent et surtout le CANBlue
     while(true) {
         automate_etat_ihm();
-        automate_process();//Boucle dans l'automate principal
+        Strategie();//Boucle dans l'automate principal
         canProcessRx();
     }
 }