From 46c98d6c95b04c8382c358b0c0991e946cb857b8 Mon Sep 17 00:00:00 2001 From: Loki077 Date: Thu, 15 Aug 2024 15:34:09 +1000 Subject: [PATCH] AP_Scripting: added lua binding get_last_update for efi and esc --- libraries/AP_Scripting/docs/docs.lua | 9 +++++++++ .../AP_Scripting/generator/description/bindings.desc | 2 ++ 2 files changed, 11 insertions(+) diff --git a/libraries/AP_Scripting/docs/docs.lua b/libraries/AP_Scripting/docs/docs.lua index 0663624310..8f8a5e8860 100644 --- a/libraries/AP_Scripting/docs/docs.lua +++ b/libraries/AP_Scripting/docs/docs.lua @@ -392,6 +392,10 @@ efi = {} ---@return EFI_State_ud function efi:get_state() end +-- get last update time in milliseconds +---@return uint32_t_ud +function efi:get_last_update_ms() end + -- desc ---@param instance integer ---@return AP_EFI_Backend_ud|nil @@ -2073,6 +2077,11 @@ function esc_telem:update_rpm(esc_index, rpm, error_rate) end ---@param scale_factor number -- factor function esc_telem:set_rpm_scale(esc_index, scale_factor) end +-- get the timestamp of last telemetry data for an ESC +---@param esc_index integer +---@return uint32_t_ud +function esc_telem:get_last_telem_data_ms(esc_index) end + -- desc optical_flow = {} diff --git a/libraries/AP_Scripting/generator/description/bindings.desc b/libraries/AP_Scripting/generator/description/bindings.desc index 4da6fca9d8..4d9a81f2fd 100644 --- a/libraries/AP_Scripting/generator/description/bindings.desc +++ b/libraries/AP_Scripting/generator/description/bindings.desc @@ -450,6 +450,7 @@ singleton AP_ESC_Telem method get_usage_seconds boolean uint8_t 0 NUM_SERVO_CHAN singleton AP_ESC_Telem method update_rpm void uint8_t 0 NUM_SERVO_CHANNELS uint16_t'skip_check float'skip_check singleton AP_ESC_Telem method update_telem_data void uint8_t 0 NUM_SERVO_CHANNELS AP_ESC_Telem_Backend::TelemetryData uint16_t'skip_check singleton AP_ESC_Telem method set_rpm_scale void uint8_t 0 NUM_SERVO_CHANNELS float'skip_check +singleton AP_ESC_Telem method get_last_telem_data_ms uint32_t uint8_t 0 ESC_TELEM_MAX_ESCS include AP_Param/AP_Param.h singleton AP_Param rename param @@ -851,6 +852,7 @@ singleton AP_EFI depends (AP_EFI_SCRIPTING_ENABLED == 1) singleton AP_EFI rename efi singleton AP_EFI method get_backend AP_EFI_Backend uint8_t'skip_check singleton AP_EFI method get_state void EFI_State'Ref +singleton AP_EFI method get_last_update_ms uint32_t -- ----END EFI Library----