paparazzi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[paparazzi-commits] [4847] tweaks


From: antoine drouin
Subject: [paparazzi-commits] [4847] tweaks
Date: Wed, 21 Apr 2010 09:35:13 +0000

Revision: 4847
          http://svn.sv.gnu.org/viewvc/?view=rev&root=paparazzi&revision=4847
Author:   poine
Date:     2010-04-21 09:35:13 +0000 (Wed, 21 Apr 2010)
Log Message:
-----------
tweaks

Modified Paths:
--------------
    paparazzi3/trunk/sw/airborne/fms/fms_debug.h
    paparazzi3/trunk/sw/airborne/fms/overo_test_link.c

Modified: paparazzi3/trunk/sw/airborne/fms/fms_debug.h
===================================================================
--- paparazzi3/trunk/sw/airborne/fms/fms_debug.h        2010-04-21 09:28:42 UTC 
(rev 4846)
+++ paparazzi3/trunk/sw/airborne/fms/fms_debug.h        2010-04-21 09:35:13 UTC 
(rev 4847)
@@ -6,7 +6,7 @@
 #define TRACE_DEBUG 1
 #define TRACE_ERROR 2
 
-#if 0
+#if 1
 #define TRACE(type,fmt,args...) {               \
     fprintf(stderr, fmt, args);                 \
   }

Modified: paparazzi3/trunk/sw/airborne/fms/overo_test_link.c
===================================================================
--- paparazzi3/trunk/sw/airborne/fms/overo_test_link.c  2010-04-21 09:28:42 UTC 
(rev 4846)
+++ paparazzi3/trunk/sw/airborne/fms/overo_test_link.c  2010-04-21 09:35:13 UTC 
(rev 4847)
@@ -25,29 +25,53 @@
 #include <unistd.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 
 
+#include "fms_debug.h"
 #include "fms_spi_link.h"
 #include "fms_autopilot_msg.h"
 
+static void fill_msg(struct AutopilotMessageFoo* msg);
 
 int main(int argc, char *argv[]) {
   
-  if (spi_link_init())
+  if (spi_link_init()) {
+    TRACE(TRACE_ERROR, "%s", "failed to open SPI link \n");
     return -1;
-  uint32_t foo = 0;
+  }
   while (1) {
+    struct AutopilotMessageFoo msg_out_prev;
     struct AutopilotMessageFoo msg_out;
-    msg_out.foo  = foo;
-    msg_out.bar  = foo;
-    msg_out.blaa = foo;
+    memcpy(&msg_out_prev, &msg_out, sizeof(msg_out));
+    fill_msg(&msg_out);
     struct AutopilotMessageFoo msg_in;
     spi_link_send(&msg_out, sizeof(struct AutopilotMessageFoo), &msg_in);
-    printf("%d %d %d\n", msg_in.foo, msg_in.bar, msg_in.blaa);
-    //    usleep(1953);
-    usleep(50000);
-    foo++;
+    if (memcmp(&msg_in, &msg_out_prev, sizeof(msg_in))) {
+      printf("compare failed\n");
+      printf("expected %d %d %d\n", msg_out_prev.foo, msg_out_prev.bar, 
msg_out_prev.blaa);
+      printf("got      %d %d %d\n\n", msg_in.foo, msg_in.bar, msg_in.blaa);
+    }
+    else {
+      static uint32_t foo = 0;
+      if (!msg_in.foo) {
+       printf("passed %d\n", foo );
+       foo++;
+      }
+    }
+    usleep(1953);
+    //usleep(50000);
   }
 
   return 0;
 }
+
+
+
+static void fill_msg(struct AutopilotMessageFoo* msg) {
+  static uint32_t foo = 0;
+  msg->foo  = foo;
+  msg->bar  = foo+1;
+  msg->blaa = foo+2;
+  foo++;
+}





reply via email to

[Prev in Thread] Current Thread [Next in Thread]