From b1977ca43d2432adfe499663da05e4692f433e56 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 17 Apr 2020 15:41:12 +1000 Subject: [PATCH] AP_Scripting: removed old servo output binding --- libraries/AP_Scripting/README.md | 2 +- libraries/AP_Scripting/lua_bindings.cpp | 28 ------------------------- 2 files changed, 1 insertion(+), 29 deletions(-) diff --git a/libraries/AP_Scripting/README.md b/libraries/AP_Scripting/README.md index 471a4b7cfb..340bf3c246 100644 --- a/libraries/AP_Scripting/README.md +++ b/libraries/AP_Scripting/README.md @@ -39,7 +39,7 @@ function update () -- periodic function that will be called if distance > 1000 then -- if more then 1000 meters away distance = 1000; -- clamp the distance to 1000 meters end - servo.set_output_pwm(96, 1000 + distance) -- set the servo assigned function 96 (scripting3) to a proportional value + SRV_Channels:set_output_pwm(96, 1000 + distance) -- set the servo assigned function 96 (scripting3) to a proportional value end return update, 1000 -- request to be rerun again 1000 milliseconds (1 second) from now diff --git a/libraries/AP_Scripting/lua_bindings.cpp b/libraries/AP_Scripting/lua_bindings.cpp index 6927af220f..d3e38fcf58 100644 --- a/libraries/AP_Scripting/lua_bindings.cpp +++ b/libraries/AP_Scripting/lua_bindings.cpp @@ -24,24 +24,6 @@ int check_arguments(lua_State *L, int expected_arguments, const char *fn_name) { return 0; } -// servo binding - -static int lua_servo_set_output_pwm(lua_State *L) { - check_arguments(L, 2, "set_output_pwm"); - - const SRV_Channel::Aux_servo_function_t servo_function = (SRV_Channel::Aux_servo_function_t)luaL_checkinteger(L, -2); - luaL_argcheck(L, ((servo_function >= SRV_Channel::Aux_servo_function_t::k_scripting1) && - (servo_function <= SRV_Channel::Aux_servo_function_t::k_scripting16)), - 2, "function out of range"); - - const int output = luaL_checknumber(L, -1); - luaL_argcheck(L, ((output >= 0) && (output <= UINT16_MAX)), 2, "output out of range"); - - SRV_Channels::set_output_pwm((SRV_Channel::Aux_servo_function_t)servo_function, output); - - return 0; -} - // millis static int lua_millis(lua_State *L) { check_arguments(L, 0, "millis"); @@ -58,17 +40,7 @@ static const luaL_Reg global_functions[] = {NULL, NULL} }; -static const luaL_Reg servo_functions[] = -{ - {"set_output_pwm", lua_servo_set_output_pwm}, - {NULL, NULL} -}; - void load_lua_bindings(lua_State *L) { - lua_pushstring(L, "servo"); - luaL_newlib(L, servo_functions); - lua_settable(L, -3); - luaL_setfuncs(L, global_functions, 0); }