From b62c2d9518737f4ac4ed6eaf344493a5624fe54c Mon Sep 17 00:00:00 2001 From: yaapu Date: Sat, 13 Mar 2021 09:52:50 +0100 Subject: [PATCH] AP_Frsky_Telem: added new capabilities param to frame 0x5007 --- .../AP_Frsky_Telem/AP_Frsky_SPort_Passthrough.cpp | 11 ++++++++++- libraries/AP_Frsky_Telem/AP_Frsky_SPort_Passthrough.h | 6 ++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/libraries/AP_Frsky_Telem/AP_Frsky_SPort_Passthrough.cpp b/libraries/AP_Frsky_Telem/AP_Frsky_SPort_Passthrough.cpp index a78bc87463e56..23dffa7cef76b 100644 --- a/libraries/AP_Frsky_Telem/AP_Frsky_SPort_Passthrough.cpp +++ b/libraries/AP_Frsky_Telem/AP_Frsky_SPort_Passthrough.cpp @@ -418,10 +418,19 @@ uint32_t AP_Frsky_SPort_Passthrough::calc_param(void) break; case BATT_CAPACITY_1: param_value = (uint32_t)roundf(AP::battery().pack_capacity_mah(0)); // battery pack capacity in mAh - _paramID = AP::battery().num_instances() > 1 ? BATT_CAPACITY_2 : FRAME_TYPE; + _paramID = AP::battery().num_instances() > 1 ? BATT_CAPACITY_2 : TELEMETRY_FEATURES; break; case BATT_CAPACITY_2: param_value = (uint32_t)roundf(AP::battery().pack_capacity_mah(1)); // battery pack capacity in mAh + _paramID = TELEMETRY_FEATURES; + break; + case TELEMETRY_FEATURES: +#if HAL_WITH_FRSKY_TELEM_BIDIRECTIONAL + BIT_SET(param_value,PassthroughFeatures::BIDIR); +#endif +#ifdef ENABLE_SCRIPTING + BIT_SET(param_value,PassthroughFeatures::SCRIPTING); +#endif _paramID = FRAME_TYPE; break; } diff --git a/libraries/AP_Frsky_Telem/AP_Frsky_SPort_Passthrough.h b/libraries/AP_Frsky_Telem/AP_Frsky_SPort_Passthrough.h index a1ce63c65bf3a..2b7cd35c47863 100644 --- a/libraries/AP_Frsky_Telem/AP_Frsky_SPort_Passthrough.h +++ b/libraries/AP_Frsky_Telem/AP_Frsky_SPort_Passthrough.h @@ -91,6 +91,12 @@ class AP_Frsky_SPort_Passthrough : public AP_Frsky_SPort, public AP_RCTelemetry BATT_FS_CAPACITY = 3, BATT_CAPACITY_1 = 4, BATT_CAPACITY_2 = 5, + TELEMETRY_FEATURES = 6 + }; + + enum PassthroughFeatures : uint8_t { + BIDIR = 0, + SCRIPTING = 1, }; // methods to convert flight controller data to FrSky SPort Passthrough (OpenTX) format