From 3512ea792ffa81c219221ffddac30df3fc979e31 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 1 Sep 2022 18:02:33 +1000 Subject: [PATCH] AP_ESC_Telem: support set_rpm_scale() call for scripting --- libraries/AP_ESC_Telem/AP_ESC_Telem.cpp | 20 ++++++++++++++++++++ libraries/AP_ESC_Telem/AP_ESC_Telem.h | 14 ++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/libraries/AP_ESC_Telem/AP_ESC_Telem.cpp b/libraries/AP_ESC_Telem/AP_ESC_Telem.cpp index cb85e15332..b0ee54c5d9 100644 --- a/libraries/AP_ESC_Telem/AP_ESC_Telem.cpp +++ b/libraries/AP_ESC_Telem/AP_ESC_Telem.cpp @@ -171,6 +171,13 @@ bool AP_ESC_Telem::get_rpm(uint8_t esc_index, float& rpm) const && (now - rpmdata.last_update_us < ESC_RPM_DATA_TIMEOUT_US)) { const float slew = MIN(1.0f, (now - rpmdata.last_update_us) * rpmdata.update_rate_hz * (1.0f / 1e6f)); rpm = (rpmdata.prev_rpm + (rpmdata.rpm - rpmdata.prev_rpm) * slew); + +#if AP_SCRIPTING_ENABLED + if ((1U<