From 0a72520a93fbbf2673e906fb894616b8ca5f19e1 Mon Sep 17 00:00:00 2001 From: "tridge60@gmail.com" Date: Mon, 5 Sep 2011 05:12:13 +0000 Subject: [PATCH] make the Xbee anti-brick delay configurabe and change default to 2s git-svn-id: https://arducopter.googlecode.com/svn/trunk@3269 f9c3cf11-9bcb-44bc-f272-b75c42450872 --- ArduCopterMega/Mavlink_Common.h | 4 ++-- ArduCopterMega/config.h | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ArduCopterMega/Mavlink_Common.h b/ArduCopterMega/Mavlink_Common.h index 9ef47a15da..f401d048ef 100644 --- a/ArduCopterMega/Mavlink_Common.h +++ b/ArduCopterMega/Mavlink_Common.h @@ -33,7 +33,7 @@ static bool mavlink_try_send_message(mavlink_channel_t chan, uint8_t id, uint16_ #define CHECK_PAYLOAD_SIZE(id) if (payload_space < MAVLINK_MSG_ID_## id ##_LEN) return false - if (chan == MAVLINK_COMM_1 && millis() < 1000) { + if (chan == MAVLINK_COMM_1 && millis() < MAVLINK_TELEMETRY_PORT_DELAY) { // defer any messages on the telemetry port for 1 second after // bootup, to try to prevent bricking of Xbees return false; @@ -399,7 +399,7 @@ static void mavlink_send_message(mavlink_channel_t chan, uint8_t id, uint16_t pa void mavlink_send_text(mavlink_channel_t chan, uint8_t severity, const char *str) { - if (chan == MAVLINK_COMM_0 && millis() < 1000) { + if (chan == MAVLINK_COMM_1 && millis() < MAVLINK_TELEMETRY_PORT_DELAY) { // don't send status MAVLink messages for 1 second after // bootup, to try to prevent Xbee bricking return; diff --git a/ArduCopterMega/config.h b/ArduCopterMega/config.h index 9262cc7ef4..c4ab920e2f 100644 --- a/ArduCopterMega/config.h +++ b/ArduCopterMega/config.h @@ -715,3 +715,8 @@ #ifndef CLI_ENABLED # define CLI_ENABLED ENABLED #endif + +// delay to prevent Xbee bricking, in milliseconds +#ifndef MAVLINK_TELEMETRY_PORT_DELAY +# define MAVLINK_TELEMETRY_PORT_DELAY 2000 +#endif