From aefc2a84927f1aeafa5fe94ffcc652e586b465a2 Mon Sep 17 00:00:00 2001 From: Tom Pittenger Date: Wed, 2 Aug 2023 14:58:57 -0700 Subject: [PATCH] AP_RPM: enable AP_RPM to set ESC Telemetry --- libraries/AP_RPM/AP_RPM.cpp | 14 ++++++++++++++ libraries/AP_RPM/AP_RPM_Params.cpp | 4 ++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/libraries/AP_RPM/AP_RPM.cpp b/libraries/AP_RPM/AP_RPM.cpp index 11c1bd89e8..a0d9105458 100644 --- a/libraries/AP_RPM/AP_RPM.cpp +++ b/libraries/AP_RPM/AP_RPM.cpp @@ -23,6 +23,7 @@ #include "RPM_Generator.h" #include "RPM_HarmonicNotch.h" #include "RPM_ESC_Telem.h" +#include "AP_ESC_Telem/AP_ESC_Telem.h" #include @@ -199,6 +200,19 @@ void AP_RPM::update(void) } drivers[i]->update(); + +#if HAL_WITH_ESC_TELEM + // Check if we need to write to esc_telem(). Note: + // RPM_TYPE_ESC_TELEM = read ESC_TELEM and store it in AP_RPM + // RPM_TYPE_EverythingElse = write to ESC_TELEM with data generated from AP_RPM + if (_params[i].type != RPM_TYPE_ESC_TELEM && _params[i].esc_mask > 0 && healthy(i)) { + for (uint32_t esc=0; esc