From 82382a7e9c790432015f6b3bad80a5993fa5213b Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 3 Aug 2016 17:17:38 +1000 Subject: [PATCH] Plane: changed startup order this allows BoardConfig to report errors in a way that allows for BRD_TYPE to be changed by the user --- ArduPlane/system.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/ArduPlane/system.cpp b/ArduPlane/system.cpp index 51a9917abe..bd336ae3ed 100644 --- a/ArduPlane/system.cpp +++ b/ArduPlane/system.cpp @@ -113,12 +113,18 @@ void Plane::init_ardupilot() } #endif - BoardConfig.init(); + GCS_MAVLINK::set_dataflash(&DataFlash); // initialise serial ports serial_manager.init(); + gcs[0].setup_uart(serial_manager, AP_SerialManager::SerialProtocol_MAVLink, 0); - GCS_MAVLINK::set_dataflash(&DataFlash); + // Register mavlink_delay_cb, which will run anytime you have + // more than 5ms remaining in your call to hal.scheduler->delay + hal.scheduler->register_delay_callback(mavlink_delay_cb_static, 5); + + // setup any board specific drivers + BoardConfig.init(); // allow servo set on all channels except first 4 ServoRelayEvents.set_channel_mask(0xFFF0); @@ -144,7 +150,7 @@ void Plane::init_ardupilot() check_usb_mux(); // setup telem slots with serial ports - for (uint8_t i = 0; i < MAVLINK_COMM_NUM_BUFFERS; i++) { + for (uint8_t i = 1; i < MAVLINK_COMM_NUM_BUFFERS; i++) { gcs[i].setup_uart(serial_manager, AP_SerialManager::SerialProtocol_MAVLink, i); } @@ -184,10 +190,6 @@ void Plane::init_ardupilot() } #endif - // Register mavlink_delay_cb, which will run anytime you have - // more than 5ms remaining in your call to hal.scheduler->delay - hal.scheduler->register_delay_callback(mavlink_delay_cb_static, 5); - // give AHRS the airspeed sensor ahrs.set_airspeed(&airspeed);