warning: wavecard code inserted

This commit is contained in:
Pascal Brisset
2005-11-08 16:34:35 +00:00
parent 784aa3f015
commit 47565e2b72
8 changed files with 33 additions and 18 deletions
+8
View File
@@ -191,6 +191,14 @@
<field name="yaw" type="int16"/>
</message>
<message name="ACINFO" ID="27" period="1">
<field name="utm_east" type="float" unit="m"></field>
<field name="utm_north" type="float" unit="m"></field>
<field name="course" type="float" unit="rad"></field>
<field name="alt" type="float" unit="m"></field>
<field name="speed" type="float" unit="m/s"></field>
</message>
</class>
<class name="telemetry_fbw" ID="0X41">
+1 -1
View File
@@ -24,7 +24,7 @@
FBW=../fly_by_wire
LOCAL_CFLAGS= $(CTL_BRD_FLAGS) $(GPS_FLAGS) $(SIMUL_FLAGS) -DWAVECARD_ON_GPS
LOCAL_CFLAGS= $(CTL_BRD_FLAGS) $(GPS_FLAGS) $(SIMUL_FLAGS) -DWAVECARD_ON_UART0
VARINCLUDE=$(PAPARAZZI_HOME)/var/include
ACINCLUDE = $(PAPARAZZI_HOME)/var/$(AIRCRAFT)
+3 -8
View File
@@ -35,6 +35,9 @@
#include "flight_plan.h"
#include "autopilot.h"
/***/
#include "uart.h"
#define MOfCm(_x) (((float)_x)/100.)
@@ -63,11 +66,3 @@ void dl_parse_msg(void) {
}
}
}
/* #include "uart.h" */
/* void dl_parse_msg(void) { */
/* dl_buffer[6] = '\0'; */
/* uart0_print_string(dl_buffer); */
/* uart0_transmit('\n'); */
/* } */
+4 -1
View File
@@ -1,7 +1,7 @@
/*
* $Id$
*
* Copyright (C) 2003 Pascal Brisset, Antoine Drouin
* Copyright (C) 2003-2005 Pascal Brisset, Antoine Drouin
*
* This file is part of paparazzi.
*
@@ -42,6 +42,7 @@
#include "estimator.h"
#include "if_calib.h"
#include "cam.h"
#include "traffic_info.h"
#ifdef SECTION_IMU_ANALOG
#include "ahrs.h"
@@ -242,6 +243,8 @@ uint8_t ac_ident = AC_ID;
#define PERIODIC_SEND_NAVIGATION_REF() DOWNLINK_SEND_NAVIGATION_REF(&nav_utm_east0, &nav_utm_north0, &nav_utm_zone0);
#define PERIODIC_SEND_ACINFO() { struct ac_info_ *s=get_ac_info(1); DOWNLINK_SEND_ACINFO(&s->east, &s->north, &s->course, &s->alt, &s->gspeed); }
#ifdef RADIO_CALIB
#define PERIODIC_SEND_SETTINGS() if (inflight_calib_mode != IF_CALIB_MODE_NONE) DOWNLINK_SEND_SETTINGS(&slider_1_val, &slider_2_val);
#else
+1 -1
View File
@@ -72,7 +72,7 @@ int main( void ) {
nav_init();
ir_init();
estimator_init();
#if defined SECTION_IMU_3DMG || defined SECTION_IMU_ANALOG
#if defined SECTION_IMU_3DMG || defined SECTION_IMU_ANALOG || WAVECARD_ON_UART0
uart0_init();
#endif //SECTION_IMU
/** - start interrupt task */
+7 -2
View File
@@ -121,8 +121,11 @@ SIGNAL(SIG_UART1_TRANS) {
void uart0_init( void ) {
/* Baudrate is 38.4k */
UBRR0H = 0;
// UBRR0L = 103; //9600
#ifdef WAVECARD_ON_UART0
UBRR0L = 103; //9600
#else
UBRR0L = 25; // 38.4
#endif
/* single speed */
UCSR0A = 0;
@@ -130,8 +133,10 @@ void uart0_init( void ) {
UCSR0B = _BV(RXEN) | _BV(TXEN);
/* Set frame format: 8data, 1stop bit */
UCSR0C = _BV(UCSZ1) | _BV(UCSZ0);
#ifdef WAVECARD_ON_UART0
/* Enable uart receive interrupt */
// sbi(UCSR0B, RXCIE );
sbi(UCSR0B, RXCIE );
#endif
}
void uart1_init( void ) {
+1 -1
View File
@@ -44,7 +44,7 @@
extern uint8_t wc_msg_received;
extern uint8_t wc_length;
void parse_payload(void);
void wc_parse_payload(void);
+8 -4
View File
@@ -34,16 +34,18 @@ type aircraft = { fd : Unix.file_descr; id : int; addr : W.addr }
let send_ack = fun delay fd () ->
ignore (GMain.Timeout.add delay (fun _ -> W.send fd (W.ACK, ""); false))
let send = fun ac a ->
let send = fun ac s ->
Wavecard.send_addressed ac.fd (W.REQ_SEND_MESSAGE,ac.addr,s)
let send_dl_msg = fun ac a ->
let (id, values) = Dl_Pprz.values_of_string a in
let s = Dl_Pprz.payload_of_values id values in
Wavecard.send_addressed ac.fd (W.REQ_SEND_MESSAGE,ac.addr,s)
send ac s
let broadcast_msg = fun (com, data) ->
prerr_endline "bc";
match com with
W.RECEIVED_FRAME ->
Ivy.send (sprintf "FROM_WAVECARD %s" data)
@@ -77,6 +79,7 @@ let get_fp = fun ac _sender vs ->
(** Got a MOVE_WAYPOINT and send a MOVE_WP *)
let move_wp = fun ac _sender vs ->
prerr_endline "move";
let ac_id = int_of_string (Pprz.string_assoc "ac_id" vs) in
if ac_id = ac.id then
let f = fun a -> Pprz.float_assoc a vs in
@@ -88,6 +91,7 @@ let move_wp = fun ac _sender vs ->
"utm_east", cm_of_m ux;
"utm_north", cm_of_m uy;
"alt", cm_of_m alt] in
prerr_endline "move";
let msg_id, _ = Dl_Pprz.message_of_name "MOVE_WP" in
let s = Dl_Pprz.payload_of_values msg_id vs in
send ac s
@@ -127,7 +131,7 @@ let _ =
(* Sending request from Ivy *)
(* For debug *)
ignore (Ivy.bind (fun _ a -> send ac a.(0)) "TO_WAVECARD +(.*)");
ignore (Ivy.bind (fun _ a -> send_dl_msg ac a.(0)) "TO_WAVECARD +(.*)");
ignore (Ground_Pprz.message_bind "FLIGHT_PARAM" (get_fp ac));
ignore (Ground_Pprz.message_bind "MOVE_WAYPOINT" (move_wp ac));