
code avec modifs, programme mit dans les robots pour les derniers matchs
Dependencies: mbed SerialHalfDuplex SDFileSystem liaison_Bluetooth ident_crac DISCO-F469NI_portrait
Diff: Strategie/Strategie.cpp
- Revision:
- 19:e70b9d4a319c
- Parent:
- 18:746bc235199d
- Child:
- 20:2f0b1c48a35f
--- 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;