From 8913dc32b09c4c249eba80a5900a552a304fc67d Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 16 May 2016 13:33:43 +1000 Subject: [PATCH] Copter: simplify UART setup --- ArduCopter/system.cpp | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/ArduCopter/system.cpp b/ArduCopter/system.cpp index a234e5dabe..260dc01a58 100644 --- a/ArduCopter/system.cpp +++ b/ArduCopter/system.cpp @@ -142,17 +142,10 @@ void Copter::init_ardupilot() ap.usb_connected = true; check_usb_mux(); - // init the GCS connected to the console - gcs[0].setup_uart(serial_manager, AP_SerialManager::SerialProtocol_Console, 0); - - // init telemetry port - gcs[1].setup_uart(serial_manager, AP_SerialManager::SerialProtocol_MAVLink, 0); - - // setup serial port for telem2 - gcs[2].setup_uart(serial_manager, AP_SerialManager::SerialProtocol_MAVLink, 1); - - // setup serial port for fourth telemetry port (not used by default) - gcs[3].setup_uart(serial_manager, AP_SerialManager::SerialProtocol_MAVLink, 2); + // setup telem slots with serial ports + for (uint8_t i = 0; i < MAVLINK_COMM_NUM_BUFFERS; i++) { + gcs[i].setup_uart(serial_manager, AP_SerialManager::SerialProtocol_MAVLink, i); + } #if FRSKY_TELEM_ENABLED == ENABLED // setup frsky