diff --git a/ArduCopter/Copter.h b/ArduCopter/Copter.h index 448cb667e4..3aad8570d2 100644 --- a/ArduCopter/Copter.h +++ b/ArduCopter/Copter.h @@ -946,7 +946,7 @@ private: void print_flight_mode(AP_HAL::BetterStream *port, uint8_t mode); void log_init(void); void run_cli(AP_HAL::UARTDriver *port); - uint64_t get_capabilities(void); + void init_capabilities(void); public: void mavlink_delay_cb(); diff --git a/ArduCopter/GCS_Mavlink.cpp b/ArduCopter/GCS_Mavlink.cpp index f40e552a45..bfd609e91b 100644 --- a/ArduCopter/GCS_Mavlink.cpp +++ b/ArduCopter/GCS_Mavlink.cpp @@ -1416,7 +1416,7 @@ void GCS_MAVLINK::handleMessage(mavlink_message_t* msg) case MAV_CMD_REQUEST_AUTOPILOT_CAPABILITIES: { if (is_equal(packet.param1,1.0f)) { - copter.gcs[chan-MAVLINK_COMM_0].send_autopilot_version(copter.get_capabilities()); + copter.gcs[chan-MAVLINK_COMM_0].send_autopilot_version(); result = MAV_RESULT_ACCEPTED; } break; @@ -1714,7 +1714,7 @@ void GCS_MAVLINK::handleMessage(mavlink_message_t* msg) #endif // AC_RALLY == ENABLED case MAVLINK_MSG_ID_AUTOPILOT_VERSION_REQUEST: - copter.gcs[chan-MAVLINK_COMM_0].send_autopilot_version(copter.get_capabilities()); + copter.gcs[chan-MAVLINK_COMM_0].send_autopilot_version(); break; case MAVLINK_MSG_ID_LED_CONTROL: diff --git a/ArduCopter/capabilities.cpp b/ArduCopter/capabilities.cpp index 9c3ff591c4..329125c90a 100644 --- a/ArduCopter/capabilities.cpp +++ b/ArduCopter/capabilities.cpp @@ -2,16 +2,10 @@ #include "Copter.h" -uint64_t Copter::get_capabilities(void) +void Copter::init_capabilities(void) { - uint64_t capabilities = MAV_PROTOCOL_CAPABILITY_MISSION_FLOAT - | MAV_PROTOCOL_CAPABILITY_PARAM_FLOAT - | MAV_PROTOCOL_CAPABILITY_SET_POSITION_TARGET_LOCAL_NED - | MAV_PROTOCOL_CAPABILITY_SET_POSITION_TARGET_GLOBAL_INT; - - #if AP_TERRAIN_AVAILABLE - capabilities |= MAV_PROTOCOL_CAPABILITY_TERRAIN; - #endif - - return capabilities; + hal.util->set_capabilities(MAV_PROTOCOL_CAPABILITY_MISSION_FLOAT); + hal.util->set_capabilities(MAV_PROTOCOL_CAPABILITY_PARAM_FLOAT); + hal.util->set_capabilities(MAV_PROTOCOL_CAPABILITY_SET_POSITION_TARGET_LOCAL_NED); + hal.util->set_capabilities(MAV_PROTOCOL_CAPABILITY_SET_POSITION_TARGET_GLOBAL_INT); } diff --git a/ArduCopter/system.cpp b/ArduCopter/system.cpp index 490976a5ee..479af37580 100644 --- a/ArduCopter/system.cpp +++ b/ArduCopter/system.cpp @@ -266,6 +266,9 @@ void Copter::init_ardupilot() ins.set_raw_logging(should_log(MASK_LOG_IMU_RAW)); ins.set_dataflash(&DataFlash); + // init vehicle capabilties + init_capabilities(); + cliSerial->print_P(PSTR("\nReady to FLY ")); // flag that initialisation has completed