mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-26 16:30:07 +08:00
*** empty log message ***
This commit is contained in:
@@ -14,11 +14,11 @@
|
||||
<define name="ADC_ROLL_DOT_SCALE" value="(real_t) (0.9444 * 3.14159 / 180.0)"/>
|
||||
<define name="ADC_PITCH_DOT_SCALE" value="(real_t) (0.9444 * 3.14159 / 180.0)"/>
|
||||
<define name="ADC_YAW_DOT_SCALE" value="(real_t) (0.9444 * 3.14159 / 180.0)"/>
|
||||
<define name="ADC_ACCELX" value="3"/>
|
||||
<define name="ADC_ACCELY" value="4"/>
|
||||
<define name="ADC_ACCELZ" value="5"/>
|
||||
<define name="ADC_ACCELX" value="4"/>
|
||||
<define name="ADC_ACCELY" value="3"/>
|
||||
<define name="ADC_ACCELZ" value="2"/>
|
||||
<define name="ADC_ACCELX_SIGN" value="-"/>
|
||||
<define name="ADC_ACCELY_SIGN" value="+"/>
|
||||
<define name="ADC_ACCELY_SIGN" value="-"/>
|
||||
<define name="ADC_ACCELZ_SIGN" value="-"/>
|
||||
<define name="ADC_ACCELX_ZERO" value="0x24A"/>
|
||||
<define name="ADC_ACCELY_ZERO" value="0x280"/>
|
||||
|
||||
@@ -141,11 +141,14 @@ let ground_id = 0
|
||||
|
||||
let use_tele_message = fun payload ->
|
||||
let buf = Serial.string_of_payload payload in
|
||||
Debug.call 'l' (fun f -> fprintf f "mm receiving: %s\n" (Debug.xprint buf));
|
||||
let (msg_id, ac_id, values) = Tm_Pprz.values_of_payload payload in
|
||||
let msg = Tm_Pprz.message_of_id msg_id in
|
||||
Tm_Pprz.message_send (string_of_int ac_id) msg.Pprz.name values;
|
||||
update_status ac_id buf
|
||||
Debug.call 'l' (fun f -> fprintf f "pprz receiving: %s\n" (Debug.xprint buf));
|
||||
try
|
||||
let (msg_id, ac_id, values) = Tm_Pprz.values_of_payload payload in
|
||||
let msg = Tm_Pprz.message_of_id msg_id in
|
||||
Tm_Pprz.message_send (string_of_int ac_id) msg.Pprz.name values;
|
||||
update_status ac_id buf
|
||||
with
|
||||
_ -> ()
|
||||
|
||||
|
||||
type priority = Null | Low | Normal | High
|
||||
@@ -276,6 +279,7 @@ module XB = struct (** XBee module *)
|
||||
let switch_to_api = fun device ->
|
||||
let o = Unix.out_channel_of_descr device.fd in
|
||||
(*** fprintf o "%s%!" (Xbee.at_set_my 255); ***)
|
||||
Debug.trace 'x' "config xbee";
|
||||
fprintf o "%s%!" Xbee.at_api_enable;
|
||||
fprintf o "%s%!" Xbee.at_exit;
|
||||
Debug.trace 'x' "end init xbee"
|
||||
|
||||
@@ -35,7 +35,7 @@ module Protocol = struct
|
||||
if String.length s < i+offset_length+2 then
|
||||
raise Serial.Not_enough
|
||||
else
|
||||
(Char.code s.[i+offset_length] lsl 8) lor (Char.code s.[i+offset_length+1])
|
||||
(Char.code s.[i+offset_length] lsl 8) lor (Char.code s.[i+offset_length+1]) + size_packet
|
||||
|
||||
let compute_checksum = fun s ->
|
||||
let cs = ref 0 in
|
||||
@@ -45,7 +45,9 @@ module Protocol = struct
|
||||
0xff - !cs
|
||||
|
||||
let checksum = fun s ->
|
||||
compute_checksum s + Char.code s.[String.length s-1] = 0xff
|
||||
let c = compute_checksum s in
|
||||
Debug.call 'x' (fun f -> Printf.fprintf f "BX.cs=%x\n" c);
|
||||
c = Char.code s.[String.length s-1]
|
||||
|
||||
let payload = fun s ->
|
||||
Serial.payload_of_string (String.sub s offset_payload (String.length s - size_packet))
|
||||
@@ -57,8 +59,8 @@ module Protocol = struct
|
||||
let m = String.create msg_length in
|
||||
String.blit payload 0 m offset_payload n;
|
||||
m.[0] <- start_delimiter;
|
||||
m.[offset_length] <- Char.chr (msg_length lsr 8);
|
||||
m.[offset_length+1] <- Char.chr (msg_length land 0xff);
|
||||
m.[offset_length] <- Char.chr (n lsr 8);
|
||||
m.[offset_length+1] <- Char.chr (n land 0xff);
|
||||
let cs = compute_checksum m in
|
||||
m.[msg_length-1] <- Char.chr cs;
|
||||
m
|
||||
@@ -138,9 +140,9 @@ let api_tx16 = fun ?(frame_id = 0) dest data ->
|
||||
let at_command_sequence = "+++"
|
||||
let at_set_my = fun addr ->
|
||||
assert (addr >= 0 && addr < 0x10000);
|
||||
Printf.sprintf "ATMY%04x\n" addr
|
||||
let at_exit = "ATCN\n"
|
||||
let at_api_enable = "ATAP1\n"
|
||||
Printf.sprintf "ATMY%04x\r" addr
|
||||
let at_exit = "ATCN\r"
|
||||
let at_api_enable = "ATAP1\r"
|
||||
|
||||
let api_parse_frame = fun s ->
|
||||
let n = String.length s in
|
||||
|
||||
Reference in New Issue
Block a user