paparazzi-commits
[Top][All Lists]
Advanced

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

[paparazzi-commits] [5333] added error counter


From: antoine drouin
Subject: [paparazzi-commits] [5333] added error counter
Date: Thu, 12 Aug 2010 00:48:20 +0000

Revision: 5333
          http://svn.sv.gnu.org/viewvc/?view=rev&root=paparazzi&revision=5333
Author:   poine
Date:     2010-08-12 00:48:19 +0000 (Thu, 12 Aug 2010)
Log Message:
-----------
added error counter

Modified Paths:
--------------
    paparazzi3/trunk/sw/airborne/lisa/lisa_overo_link.h

Modified: paparazzi3/trunk/sw/airborne/lisa/lisa_overo_link.h
===================================================================
--- paparazzi3/trunk/sw/airborne/lisa/lisa_overo_link.h 2010-08-12 00:45:59 UTC 
(rev 5332)
+++ paparazzi3/trunk/sw/airborne/lisa/lisa_overo_link.h 2010-08-12 00:48:19 UTC 
(rev 5333)
@@ -5,23 +5,24 @@
 
 #include "fms/fms_autopilot_msg.h"
 
-enum LisaOveroLinkStatus {IDLE, BUSY, DATA_AVAILABLE, LOST};
+enum LisaOveroLinkStatus {IDLE, BUSY, DATA_AVAILABLE, LOST, CRC_ERROR};
 
 #define OVERO_LINK_TIMEOUT 10
 
 struct LisaOveroLink {
-       volatile uint8_t status;
-       union {
-               struct OVERO_LINK_MSG_UP msg;
-               uint8_t array[sizeof(union AutopilotMessage)];
-       } up;
-       union {
-               struct OVERO_LINK_MSG_DOWN msg;
-               uint8_t array[sizeof(union AutopilotMessage)];
-       } down;
-  uint8_t timeout;
+  volatile uint8_t status;
   uint32_t msg_cnt;
   uint32_t crc_err_cnt;
+  union {
+    struct OVERO_LINK_MSG_UP msg;
+    uint8_t array[sizeof(union AutopilotMessage)];
+  } up;
+  union {
+    struct OVERO_LINK_MSG_DOWN msg;
+    uint8_t array[sizeof(union AutopilotMessage)];
+  } down;
+  uint8_t timeout;
+  uint8_t crc_error;
 };
 
 extern struct LisaOveroLink overo_link;
@@ -35,31 +36,19 @@
 
 #include "lisa_overo_link_arch.h"
 
-#define OveroLinkPeriodic(_timeout_handler) {          \
-    if (overo_link.timeout < OVERO_LINK_TIMEOUT)       \
-      overo_link.timeout++;                            \
-    else {                                             \
-      if (overo_link.status != LOST) {                 \
-       overo_link.status = LOST;                       \
-       LED_OFF(OVERO_LINK_LED_OK);                     \
-       LED_ON(OVERO_LINK_LED_KO);                      \
-       _timeout_handler();                             \
-      }                                                        \
-    }                                                  \
+#define OveroLinkPeriodic(_timeout_handler) {                          \
+    if (overo_link.timeout < OVERO_LINK_TIMEOUT)                       \
+      overo_link.timeout++;                                            \
+    else {                                                             \
+      if (overo_link.status != LOST && overo_link.status != CRC_ERROR) { \
+       overo_link.status = LOST;                                       \
+       LED_OFF(OVERO_LINK_LED_OK);                                     \
+       LED_ON(OVERO_LINK_LED_KO);                                      \
+       _timeout_handler();                                             \
+      }                                                                        
\
+    }                                                                  \
   }
 
-#if 0
-#define OveroLinkEvent(_data_received_handler) {       \
-    if (overo_link.status == DATA_AVAILABLE) {         \
-      overo_link.timeout = 0;                          \
-      LED_TOGGLE(OVERO_LINK_LED_OK);                   \
-      LED_OFF(OVERO_LINK_LED_KO);                      \
-      _data_received_handler();                                \
-      overo_link_arch_prepare_next_transfert();                \
-      overo_link.status = IDLE;                                \
-    }                                                  \
-  }
-#endif
 
 
 /*




reply via email to

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