paparazzi-commits
[Top][All Lists]
Advanced

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

[paparazzi-commits] [4299] CSC updates for airspeed and baro


From: Allen Ibara
Subject: [paparazzi-commits] [4299] CSC updates for airspeed and baro
Date: Tue, 27 Oct 2009 18:02:24 +0000

Revision: 4299
          http://svn.sv.gnu.org/viewvc/?view=rev&root=paparazzi&revision=4299
Author:   aibara
Date:     2009-10-27 18:02:24 +0000 (Tue, 27 Oct 2009)
Log Message:
-----------
CSC updates for airspeed and baro

Modified Paths:
--------------
    paparazzi3/trunk/sw/airborne/csc/csc_telemetry.h
    paparazzi3/trunk/sw/airborne/csc/mercury_csc_main.c

Modified: paparazzi3/trunk/sw/airborne/csc/csc_telemetry.h
===================================================================
--- paparazzi3/trunk/sw/airborne/csc/csc_telemetry.h    2009-10-27 18:01:59 UTC 
(rev 4298)
+++ paparazzi3/trunk/sw/airborne/csc/csc_telemetry.h    2009-10-27 18:02:24 UTC 
(rev 4299)
@@ -130,5 +130,16 @@
   &zero, \
   &zero, &zero) }
 
+#ifdef USE_AIRSPEED
+#include "estimator.h"
+#define PERIODIC_SEND_AIRSPEED(_chan) { float empty; DOWNLINK_SEND_AIRSPEED 
(_chan, &adc_airspeed_val,&estimator_airspeed,&empty,&empty,&empty) }
+#else
+#define PERIODIC_SEND_AIRSPEED(_chan) {}
+#endif
 
+#ifdef USE_BARO_ETS
+#include "baro_ets.h"
+#define PERIODIC_SEND_ESTIMATOR(_chan) { float empty; 
DOWNLINK_SEND_ESTIMATOR(_chan, &baro_ets_altitude, &empty) }
+#endif
+
 #endif /* CSC_TELEMETRY_H */

Modified: paparazzi3/trunk/sw/airborne/csc/mercury_csc_main.c
===================================================================
--- paparazzi3/trunk/sw/airborne/csc/mercury_csc_main.c 2009-10-27 18:01:59 UTC 
(rev 4298)
+++ paparazzi3/trunk/sw/airborne/csc/mercury_csc_main.c 2009-10-27 18:02:24 UTC 
(rev 4299)
@@ -40,8 +40,10 @@
 
 #include "csc_servos.h"
 
+#include "airspeed.h"
+#include "baro_ets.h"
+#include "airspeed_ets.h"
 
-
 #include "interrupt_hw.h"
 #include "uart.h"
 #include "csc_telemetry.h"
@@ -60,6 +62,7 @@
 
 #define SERVO_TIMEOUT (SYS_TICS_OF_SEC(0.1) / PERIODIC_TASK_PERIOD)
 #define CSC_STATUS_TIMEOUT (SYS_TICS_OF_SEC(0.25) / PERIODIC_TASK_PERIOD)
+#define AIRSPEED_TIMEOUT (SYS_TICS_OF_SEC(0.05) / PERIODIC_TASK_PERIOD)
 
 static uint32_t servo_cmd_timeout = 0;
 static uint32_t can_msg_count = 0;
@@ -110,6 +113,17 @@
   motors_init();
   #endif
 
+#ifdef USE_AIRSPEED
+  airspeed_init();
+#endif
+
+#ifdef USE_AIRSPEED_ETS
+  airspeed_ets_init();
+#endif
+#ifdef USE_BARO_ETS
+  baro_ets_init();
+#endif
+
   int_enable();
 }
 
@@ -136,10 +150,30 @@
     csc_ap_link_send_status(csc_loops, can_msg_count);
   }
 #ifdef ADC
-  if ((++csc_loops % CSC_STATUS_TIMEOUT) == 0) {
+  if ((csc_loops % CSC_STATUS_TIMEOUT) == 0) {
     csc_adc_periodic();
   }
 #endif
+
+  if ((csc_loops % AIRSPEED_TIMEOUT) == 0) {
+#ifdef USE_AIRSPEED_ETS
+    airspeed_ets_periodic();
+#endif
+#ifdef USE_BARO_ETS
+    baro_ets_read();
+#endif
+  } else if ((csc_loops % AIRSPEED_TIMEOUT) == 1) {
+#ifdef USE_BARO_ETS
+    baro_ets_periodic();
+#endif
+#ifdef USE_AIRSPEED_ETS
+    airspeed_ets_read();
+#endif
+  }
+
+#ifdef USE_AIRSPEED
+  airspeed_update();
+#endif
 }
 
 static void csc_main_event( void ) {





reply via email to

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