mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-10 18:08:30 -04:00
ACM: added TELEM_DELAY to ArduCopter
This commit is contained in:
parent
332ad921cc
commit
0b2cbbb677
@ -464,15 +464,38 @@ static void NOINLINE send_statustext(mavlink_channel_t chan)
|
||||
pending_status.text);
|
||||
}
|
||||
|
||||
// are we still delaying telemetry to try to avoid Xbee bricking?
|
||||
static bool telemetry_delayed(mavlink_channel_t chan)
|
||||
{
|
||||
uint32_t tnow = millis() >> 10;
|
||||
if (tnow > g.telem_delay) {
|
||||
return false;
|
||||
}
|
||||
#if USB_MUX_PIN > 0
|
||||
if (chan == MAVLINK_COMM_0 && usb_connected) {
|
||||
// this is an APM2 with USB telemetry
|
||||
return false;
|
||||
}
|
||||
// we're either on the 2nd UART, or no USB cable is connected
|
||||
// we need to delay telemetry
|
||||
return true;
|
||||
#else
|
||||
if (chan == MAVLINK_COMM_0) {
|
||||
// we're on the USB port
|
||||
return false;
|
||||
}
|
||||
// don't send telemetry yet
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
// try to send a message, return false if it won't fit in the serial tx buffer
|
||||
static bool mavlink_try_send_message(mavlink_channel_t chan, enum ap_message id, uint16_t packet_drops)
|
||||
{
|
||||
int16_t payload_space = comm_get_txspace(chan) - MAVLINK_NUM_NON_PAYLOAD_BYTES;
|
||||
|
||||
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
|
||||
if (telemetry_delayed(chan)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -676,9 +699,7 @@ static void mavlink_send_message(mavlink_channel_t chan, enum ap_message id, uin
|
||||
|
||||
void mavlink_send_text(mavlink_channel_t chan, gcs_severity severity, const char *str)
|
||||
{
|
||||
if (chan == MAVLINK_COMM_1 && millis() < MAVLINK_TELEMETRY_PORT_DELAY) {
|
||||
// don't send status MAVLink messages for 2 seconds after
|
||||
// bootup, to try to prevent Xbee bricking
|
||||
if (telemetry_delayed(chan)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -94,6 +94,7 @@ public:
|
||||
k_param_sysid_this_mav,
|
||||
k_param_sysid_my_gcs,
|
||||
k_param_serial3_baud,
|
||||
k_param_telem_delay,
|
||||
|
||||
//
|
||||
// 140: Sensor parameters
|
||||
@ -218,7 +219,7 @@ public:
|
||||
AP_Int16 sysid_this_mav;
|
||||
AP_Int16 sysid_my_gcs;
|
||||
AP_Int8 serial3_baud;
|
||||
|
||||
AP_Int8 telem_delay;
|
||||
|
||||
AP_Int16 RTL_altitude;
|
||||
AP_Int8 sonar_enabled;
|
||||
|
@ -27,6 +27,15 @@ const AP_Param::Info var_info[] PROGMEM = {
|
||||
// @User: Standard
|
||||
GSCALAR(serial3_baud, "SERIAL3_BAUD", SERIAL3_BAUD/1000),
|
||||
|
||||
// @Param: TELEM_DELAY
|
||||
// @DisplayName: Telemetry startup delay
|
||||
// @Description: The amount of time (in seconds) to delay radio telemetry to prevent an Xbee bricking on power up
|
||||
// @User: Standard
|
||||
// @Units: seconds
|
||||
// @Range: 0 10
|
||||
// @Increment: 1
|
||||
GSCALAR(telem_delay, "TELEM_DELAY", 0),
|
||||
|
||||
// @Param: ALT_HOLD_RTL
|
||||
// @DisplayName: RTL Altitude
|
||||
// @Description: This is the altitude the model will move to before Returning to Launch. Set to zero to return at current altitude.
|
||||
|
@ -1056,12 +1056,6 @@
|
||||
# define CLI_SLIDER_ENABLED DISABLED
|
||||
#endif
|
||||
|
||||
// delay to prevent Xbee bricking, in milliseconds
|
||||
#ifndef MAVLINK_TELEMETRY_PORT_DELAY
|
||||
# define MAVLINK_TELEMETRY_PORT_DELAY 6000
|
||||
#endif
|
||||
|
||||
|
||||
// experimental mpu6000 DMP code
|
||||
#ifndef DMP_ENABLED
|
||||
# define DMP_ENABLED DISABLED
|
||||
|
Loading…
Reference in New Issue
Block a user