From d0dd10aeea184cc68a72ed19f56b4c7bccfe8c18 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 12 Sep 2016 16:23:53 +1000 Subject: [PATCH] Copter: added DEV_OPTIONS parameter this is for little used options to allow standard firmware builds to enable those options for development purposes First option is for MAVLink based ADSB avoidance --- ArduCopter/GCS_Mavlink.cpp | 5 ++++- ArduCopter/Parameters.cpp | 7 +++++++ ArduCopter/Parameters.h | 3 +++ ArduCopter/defines.h | 5 +++++ 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/ArduCopter/GCS_Mavlink.cpp b/ArduCopter/GCS_Mavlink.cpp index f60b03b78c..f1d412634e 100644 --- a/ArduCopter/GCS_Mavlink.cpp +++ b/ArduCopter/GCS_Mavlink.cpp @@ -960,7 +960,10 @@ void GCS_MAVLINK_Copter::handle_change_alt_request(AP_Mission::Mission_Command & void GCS_MAVLINK_Copter::packetReceived(const mavlink_status_t &status, mavlink_message_t &msg) { - copter.avoidance_adsb.handle_msg(msg); + if (copter.g2.dev_options.get() & DevOptionADSBMAVLink) { + // optional handling of GLOBAL_POSITION_INT as a MAVLink based avoidance source + copter.avoidance_adsb.handle_msg(msg); + } GCS_MAVLINK::packetReceived(status, msg); } diff --git a/ArduCopter/Parameters.cpp b/ArduCopter/Parameters.cpp index e6043608a4..d48af24311 100644 --- a/ArduCopter/Parameters.cpp +++ b/ArduCopter/Parameters.cpp @@ -1000,6 +1000,13 @@ const AP_Param::GroupInfo ParametersG2::var_info[] = { // @Path: ../libraries/AP_AdvancedFailsafe/AP_AdvancedFailsafe.cpp AP_SUBGROUPINFO(afs, "AFS_", 6, ParametersG2, AP_AdvancedFailsafe), #endif + + // @Param: DEV_OPTIONS + // @DisplayName: Development options + // @Description: Bitmask of developer options. The meanings of the bit fields in this parameter may vary at any time. Developers should check the source code for current meaning + // @Bitmask: 0:ADSBMavlinkProcessing + // @User: Advanced + AP_GROUPINFO("DEV_OPTIONS", 7, ParametersG2, dev_options, 0), AP_GROUPEND }; diff --git a/ArduCopter/Parameters.h b/ArduCopter/Parameters.h index ddc1121a53..bf92b10938 100644 --- a/ArduCopter/Parameters.h +++ b/ArduCopter/Parameters.h @@ -562,6 +562,9 @@ public: // advanced failsafe library AP_AdvancedFailsafe_Copter afs; #endif + + // developer options + AP_Int32 dev_options; }; extern const AP_Param::Info var_info[]; diff --git a/ArduCopter/defines.h b/ArduCopter/defines.h index fbcfc66243..1a3050d8ff 100644 --- a/ArduCopter/defines.h +++ b/ArduCopter/defines.h @@ -276,6 +276,11 @@ enum LandStateType { LandStateType_Descending = 1 }; +// bit options for DEV_OPTIONS parameter +enum DevOptions { + DevOptionADSBMAVLink = 1, +}; + // Logging parameters #define TYPE_AIRSTART_MSG 0x00 #define TYPE_GROUNDSTART_MSG 0x01