diff --git a/libraries/AP_Scripting/docs/docs.lua b/libraries/AP_Scripting/docs/docs.lua index 77b5e2c78c..6bbe08c9fe 100644 --- a/libraries/AP_Scripting/docs/docs.lua +++ b/libraries/AP_Scripting/docs/docs.lua @@ -679,6 +679,10 @@ local RC_Channel_ud = {} ---@return number function RC_Channel_ud:norm_input_ignore_trim() end +-- desc +---@param PWM integer +function RC_Channel_ud:set_override(PWM) end + -- desc ---@return integer function RC_Channel_ud:get_aux_switch_pos() end diff --git a/libraries/AP_Scripting/examples/RC_override.lua b/libraries/AP_Scripting/examples/RC_override.lua new file mode 100644 index 0000000000..52b19f2945 --- /dev/null +++ b/libraries/AP_Scripting/examples/RC_override.lua @@ -0,0 +1,14 @@ +-- example of overriding RC inputs + +local RC4 = rc:get_channel(4) + +function update() + -- mirror RC1 onto RC4 + rc1_input = rc:get_pwm(1) + RC4:set_override(rc1_input) + return update, 10 +end + +gcs:send_text(0, "RC_override example") + +return update() diff --git a/libraries/AP_Scripting/generator/description/bindings.desc b/libraries/AP_Scripting/generator/description/bindings.desc index 240b3e6cd0..bf2816c272 100644 --- a/libraries/AP_Scripting/generator/description/bindings.desc +++ b/libraries/AP_Scripting/generator/description/bindings.desc @@ -258,6 +258,7 @@ singleton SRV_Channels method set_range void SRV_Channel::Aux_servo_function_t'e ap_object RC_Channel method norm_input float ap_object RC_Channel method get_aux_switch_pos uint8_t ap_object RC_Channel method norm_input_ignore_trim float +ap_object RC_Channel method set_override void uint16_t 0 2200 0'literal include RC_Channel/RC_Channel.h singleton RC_Channels alias rc