From a48ff8431b6f250886af9490bf00caf0a9ae137b Mon Sep 17 00:00:00 2001 From: Tom Pittenger Date: Wed, 27 Nov 2024 16:42:02 -0800 Subject: [PATCH] AP_ADSB: add option to force Mode3AC Only --- libraries/AP_ADSB/AP_ADSB.cpp | 2 +- libraries/AP_ADSB/AP_ADSB.h | 1 + libraries/AP_ADSB/AP_ADSB_Sagetech_MXS.cpp | 2 +- libraries/AP_ADSB/AP_ADSB_uAvionix_UCP.cpp | 4 ++-- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/libraries/AP_ADSB/AP_ADSB.cpp b/libraries/AP_ADSB/AP_ADSB.cpp index 1e773fa567..4d8974c924 100644 --- a/libraries/AP_ADSB/AP_ADSB.cpp +++ b/libraries/AP_ADSB/AP_ADSB.cpp @@ -172,7 +172,7 @@ const AP_Param::GroupInfo AP_ADSB::var_info[] = { // @Param: OPTIONS // @DisplayName: ADS-B Options // @Description: Options for emergency failsafe codes and device capabilities - // @Bitmask: 0:Ping200X Send GPS,1:Squawk 7400 on RC failsafe,2:Squawk 7400 on GCS failsafe,3:Sagetech MXS use External Config + // @Bitmask: 0:Ping200X Send GPS,1:Squawk 7400 on RC failsafe,2:Squawk 7400 on GCS failsafe,3:Sagetech MXS use External Config,4:Transmit in traditional Mode 3A/C only and inhibit Mode-S and ES (ADSB) transmissions // @User: Advanced AP_GROUPINFO("OPTIONS", 15, AP_ADSB, _options, 0), diff --git a/libraries/AP_ADSB/AP_ADSB.h b/libraries/AP_ADSB/AP_ADSB.h index 45cce0f328..a66b57202c 100644 --- a/libraries/AP_ADSB/AP_ADSB.h +++ b/libraries/AP_ADSB/AP_ADSB.h @@ -78,6 +78,7 @@ public: Squawk_7400_FS_RC = (1<<1), Squawk_7400_FS_GCS = (1<<2), SagteTech_MXS_External_Config = (1<<3), + Mode3_Only = (1<<4), }; // for holding parameters diff --git a/libraries/AP_ADSB/AP_ADSB_Sagetech_MXS.cpp b/libraries/AP_ADSB/AP_ADSB_Sagetech_MXS.cpp index 39fd88810b..ec4e49b7d4 100644 --- a/libraries/AP_ADSB/AP_ADSB_Sagetech_MXS.cpp +++ b/libraries/AP_ADSB/AP_ADSB_Sagetech_MXS.cpp @@ -150,7 +150,7 @@ void AP_ADSB_Sagetech_MXS::update() last.operating_rf_select = _frontend.out_state.cfg.rfSelect; last.modeAEnabled = _frontend.out_state.ctrl.modeAEnabled; last.modeCEnabled = _frontend.out_state.ctrl.modeCEnabled; - last.modeSEnabled = _frontend.out_state.ctrl.modeSEnabled; + last.modeSEnabled = (_frontend._options & uint32_t(AP_ADSB::AdsbOption::Mode3_Only)) ? 0 : _frontend.out_state.ctrl.modeSEnabled; last.operating_alt = _frontend._my_loc.alt; last.packet_Operating_ms = now_ms; diff --git a/libraries/AP_ADSB/AP_ADSB_uAvionix_UCP.cpp b/libraries/AP_ADSB/AP_ADSB_uAvionix_UCP.cpp index 0f92293c51..cb9f6cfc45 100644 --- a/libraries/AP_ADSB/AP_ADSB_uAvionix_UCP.cpp +++ b/libraries/AP_ADSB/AP_ADSB_uAvionix_UCP.cpp @@ -411,8 +411,8 @@ void AP_ADSB_uAvionix_UCP::send_Transponder_Control() _frontend.out_state.ctrl.identActive = false; // only send identButtonActive once per request msg.modeAEnabled = _frontend.out_state.ctrl.modeAEnabled; msg.modeCEnabled = _frontend.out_state.ctrl.modeCEnabled; - msg.modeSEnabled = _frontend.out_state.ctrl.modeSEnabled; - msg.es1090TxEnabled = _frontend.out_state.ctrl.es1090TxEnabled; + msg.modeSEnabled = (_frontend._options & uint32_t(AP_ADSB::AdsbOption::Mode3_Only)) ? 0 : _frontend.out_state.ctrl.modeSEnabled; + msg.es1090TxEnabled = (_frontend._options & uint32_t(AP_ADSB::AdsbOption::Mode3_Only)) ? 0 : _frontend.out_state.ctrl.es1090TxEnabled; // if enabled via param ADSB_OPTIONS, use squawk 7400 while in any Loss-Comms related failsafe // https://www.faa.gov/documentLibrary/media/Notice/N_JO_7110.724_5-2-9_UAS_Lost_Link_2.pdf