CRAC Team / Strategie_13h30

Fork of CRAC-Strat_2017_homologation_gros_rob by CRAC Team

Revision:
12:14729d584500
Parent:
8:0edc7dfb7f7e
Child:
14:c8fc06c4887f
diff -r ed13a480ddca -r 14729d584500 AX12-V2/AX12-V2.cpp
--- a/AX12-V2/AX12-V2.cpp	Mon May 02 19:40:59 2016 +0000
+++ b/AX12-V2/AX12-V2.cpp	Mon May 09 09:10:17 2016 +0000
@@ -105,7 +105,7 @@
 /****************************************************************************************/
 void AX12_notifyCANEnd(unsigned char id) 
 {
-    if(waitingAckFrom == SERVO_AX12_DONE) {
+    if(waitingAckFrom == SERVO_AX12_DONE && waitingAckID == id) {
         waitingAckFrom = 0;
         waitingAckID = 0;
     }
@@ -150,7 +150,7 @@
     int i=0;
     int dataToSendLength = 0;
     char dataToSend[100];
-
+    int sendTwice = 0;
     
     for(i=0;i<lastAX12Use;i++)
     {
@@ -179,11 +179,13 @@
     //printf("need to send %d data\n",dataToSendLength);
     if(dataToSendLength > 0)//Il y a des données à envoyer en local
     {
-        AX12_syncWrite(AX12_Serial1, AX12_REG_GOAL_POSITION, dataToSendLength, dataToSend);
-        //wait_ms(10);
-        AX12_syncWrite(AX12_Serial2, AX12_REG_GOAL_POSITION, dataToSendLength, dataToSend);
+        for(sendTwice=0;sendTwice<2;sendTwice++)
+        {
+            AX12_syncWrite(AX12_Serial1, AX12_REG_GOAL_POSITION, dataToSendLength, dataToSend);
+            //wait_ms(10);
+            AX12_syncWrite(AX12_Serial2, AX12_REG_GOAL_POSITION, dataToSendLength, dataToSend);
+        }
     }
-    
 }
 
 /****************************************************************************************/