Programme carte strategie (disco)

Dependencies:   mbed SerialHalfDuplex SDFileSystem DISCO-F469NI_portrait liaison_Bluetooth ident_crac

Revision:
6:eddfa414fd11
Parent:
5:dcd817534b57
Child:
8:0edc7dfb7f7e
diff -r dcd817534b57 -r eddfa414fd11 Strategie/Strategie.cpp
--- a/Strategie/Strategie.cpp	Sat Apr 23 09:16:14 2016 +0000
+++ b/Strategie/Strategie.cpp	Mon Apr 25 10:59:22 2016 +0000
@@ -22,8 +22,8 @@
 unsigned short id_check[NOMBRE_CARTES]= {CHECK_BALISE,CHECK_MOTEUR};
 unsigned short id_alive[NOMBRE_CARTES]= {ALIVE_BALISE,ALIVE_MOTEUR};
 #else
-unsigned short id_check[NOMBRE_CARTES]= {CHECK_BALISE,CHECK_MOTEUR,CHECK_ACTIONNEURS};
-unsigned short id_alive[NOMBRE_CARTES]= {ALIVE_BALISE,ALIVE_MOTEUR,ALIVE_ACTIONNEURS};
+unsigned short id_check[NOMBRE_CARTES]= {CHECK_BALISE,CHECK_MOTEUR};
+unsigned short id_alive[NOMBRE_CARTES]= {ALIVE_BALISE,ALIVE_MOTEUR};
 #endif
 unsigned char checkCurrent = 0;
 unsigned char countAliveCard = 0; 
@@ -224,10 +224,22 @@
             switch(instruction.order)
             {
                 case MV_COURBURE:
-                    //TODO - mettre l'ACK à jour
+                    waitingAckID = ASSERVISSEMENT_COURBURE;
+                    waitingAckFrom = ACKNOWLEDGE_MOTEUR;
                     if(instruction.nextActionType == ENCHAINEMENT) {
-                        //TODO - flag dans le trame pour indiquer l'enchainement    
+                        MV_enchainement++;
+                        localData5 = 1;
+                    } else {
+                        if(MV_enchainement > 0) {
+                            localData5 = 2;
+                            MV_enchainement = 0;
+                        } else {
+                            localData5 = 0;
+                        }
                     }
+                    
+                    localData1 = ((instruction.direction == FORWARD)?1:-1);
+                    BendRadius (instruction.arg1, instruction.arg3, localData1, localData5);
                 break;
                 case MV_LINE:
                     waitingAckID = ASSERVISSEMENT_RECALAGE;
@@ -533,11 +545,14 @@
             break;
             case BALISE_STOP:
                 SendAck(ACKNOWLEDGE_BALISE, BALISE_STOP);
-                wait_ms(10);
-                SendRawId(ASSERVISSEMENT_STOP);
-                gameEtat = ETAT_WARNING_TIMEOUT;
-                timeoutWarning.reset();
-                timeoutWarning.start();//Reset du timer utiliser par le timeout
+                if(gameEtat > ETAT_GAME_START && gameEtat != ETAT_WARNING_TIMEOUT)
+                {
+                    wait_ms(10);
+                    SendRawId(ASSERVISSEMENT_STOP);
+                    gameEtat = ETAT_WARNING_TIMEOUT;
+                    timeoutWarning.reset();
+                    timeoutWarning.start();//Reset du timer utiliser par le timeout
+                }
             break;
             case BALISE_END_DANGER:
                 if(gameEtat == ETAT_WARNING_TIMEOUT) {