Skip to content

Commit

Permalink
AP_Scripting: Lua bindings for ESC and EFI squashed
Browse files Browse the repository at this point in the history
7ae28b6	AP_Scripting: Lua bindings for safety checks ESC, MotorsMatrix, EFI
 - This commit introduces Lua bindings for the following methods:
	- ESC- `get_last_telem_data_ms`
	- MotorMatrix `get_lost_motor`
	- MotorMatrix `get_thrust_boost`
	- EFI `get_last_update_ms`
 - Note:
	- For get_last_telem_data_ms - CPN reset is reported. But ESC disconnected with CPN is not reported. This needs to be looked into

6aad622	LUA :  added bindings for extended ESC telem
  • Loading branch information
Pradeep-Carbonix committed Aug 15, 2024
1 parent 6f959ca commit f426cd7
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
23 changes: 23 additions & 0 deletions libraries/AP_Scripting/docs/docs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1936,6 +1936,29 @@ 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 instance integer (0 is first motor)
---@return uint32_t_ud
function esc_telem:get_last_telem_data_ms(instance) end

-- get the input_duty of last telemetry data for an ESC
---@param instance integer (0 is first motor)
---@param input_duty integer
---@return boolean
function esc_telem:get_input_duty(instance, input_duty) end

-- get the output_duty of last telemetry data for an ESC
---@param instance integer (0 is first motor)
---@param output_duty integer
---@return boolean
function esc_telem:get_output_duty(instance, output_duty) end

-- get the status flags of the last telemetry data for an ESC
---@param instance integer (0 is first motor)
---@param flags integer
---@return boolean
function esc_telem:get_flags(instance, flags) end

-- desc
---@class optical_flow
optical_flow = {}
Expand Down
5 changes: 5 additions & 0 deletions libraries/AP_Scripting/generator/description/bindings.desc
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,10 @@ 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 NUM_SERVO_CHANNELS
singleton AP_ESC_Telem method get_input_duty boolean uint8_t 0 NUM_SERVO_CHANNELS uint8_t'Null
singleton AP_ESC_Telem method get_output_duty boolean uint8_t 0 NUM_SERVO_CHANNELS uint8_t'Null
singleton AP_ESC_Telem method get_flags boolean uint8_t 0 NUM_SERVO_CHANNELS uint32_t'Null

include AP_Param/AP_Param.h
singleton AP_Param rename param
Expand Down Expand Up @@ -824,6 +828,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----

Expand Down

0 comments on commit f426cd7

Please sign in to comment.