From b486c1cb4606b7b60648e702f6c47b6c0165677b Mon Sep 17 00:00:00 2001 From: Clyde McQueen Date: Wed, 21 Feb 2024 12:11:46 -0800 Subject: [PATCH] AP_Scripting: expose sub rangefinder methods --- libraries/AP_Scripting/docs/docs.lua | 13 +++++++++++++ .../generator/description/bindings.desc | 3 +++ 2 files changed, 16 insertions(+) diff --git a/libraries/AP_Scripting/docs/docs.lua b/libraries/AP_Scripting/docs/docs.lua index 8a8db7001b49b..f3481947289f9 100644 --- a/libraries/AP_Scripting/docs/docs.lua +++ b/libraries/AP_Scripting/docs/docs.lua @@ -1691,6 +1691,19 @@ function sub:is_button_pressed(index) end ---@return integer function sub:get_and_clear_button_count(index) end +-- Return true if rangefinder is healthy, includes a check for good signal quality +---@return boolean +function sub:rangefinder_alt_ok() end + +-- SURFTRAK mode: return the rangefinder target in cm +---@return float +function sub:get_rangefinder_target_cm() end + +-- SURFTRAK mode: set the rangefinder target in cm, return true if successful +---@param new_target_cm float +---@return boolean +function sub:set_rangefinder_target_cm(new_target_cm) end + -- desc ---@class quadplane diff --git a/libraries/AP_Scripting/generator/description/bindings.desc b/libraries/AP_Scripting/generator/description/bindings.desc index 5f4458985fca4..a5d1729c47378 100644 --- a/libraries/AP_Scripting/generator/description/bindings.desc +++ b/libraries/AP_Scripting/generator/description/bindings.desc @@ -539,6 +539,9 @@ singleton Sub rename sub singleton Sub depends APM_BUILD_TYPE(APM_BUILD_ArduSub) singleton Sub method get_and_clear_button_count uint8_t uint8_t 1 4 singleton Sub method is_button_pressed boolean uint8_t 1 4 +singleton Sub method rangefinder_alt_ok boolean +singleton Sub method get_rangefinder_target_cm float +singleton Sub method set_rangefinder_target_cm boolean float'skip_check include AP_Motors/AP_MotorsMatrix.h depends APM_BUILD_TYPE(APM_BUILD_ArduPlane)||APM_BUILD_COPTER_OR_HELI singleton AP_MotorsMatrix depends APM_BUILD_TYPE(APM_BUILD_ArduPlane)||APM_BUILD_COPTER_OR_HELI