Console CAN 3.0 update du code testcan1 UPDATE 3.0 : capture la trame complète

Dependencies:   mbed

Dependents:   Robot_a_cables Robot_a_cables_v1_0

Fork of CAN_CONSOLE_v2 by RaC2018

Files at this revision

API Documentation at this revision

Comitter:
protongamer
Date:
Fri Mar 02 10:05:55 2018 +0000
Parent:
1:4d70e593345f
Commit message:
CAN CONSOLE 3.0

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 4d70e593345f -r 1e06fd49ea7b main.cpp
--- a/main.cpp	Wed Feb 28 11:34:52 2018 +0000
+++ b/main.cpp	Fri Mar 02 10:05:55 2018 +0000
@@ -63,6 +63,7 @@
 uint8_t state = 0;
 int data_rc;
 int data_report[100];
+bool dejafait = 0;
 CANMessage msg;
 
     pc.printf("CAN CONSOLE \r \n");
@@ -1126,23 +1127,29 @@
             pc.printf("%c \r\n",c);
             wait(2);
     
-    send(identif, octet_send, RemoteData, length );
+    
+    for(i = 0; i < 25; i++){
+        if(dejafait == 0){
+        send(identif, octet_send, RemoteData, length );
     data_rc = 0;
-    for(i = 0; i < 50; i++){
+    dejafait = 1;
+    }
+    
         pc.printf("Awaiting Data... \r\n");
         if(can2.read(msg)) {
-            pc.printf("Message received: 0x%x \r\n", msg.data[data_rc]);
-            data_report[data_rc] = msg.data[data_rc];
-            data_rc++;
+            pc.printf("Message received\r\n");
+            pc.printf("Number of octet: %d \r\n", msg.len);
+            
         } 
         }//end of for
         
         
-        for(i = 0; i < data_rc; i++){
-        pc.printf("Data captured %d : 0x%x \r\n", data_rc, data_report[i]);
+        for(i = 0; i < msg.len; i++){
+        pc.printf("Data captured %d : 0x%x \r\n", i, msg.data[i]);
         
         }
         data_rc = 0;
+        dejafait = 0;
         i = 0;
         state = 0;
         pc.printf("\r\n");