AP_Scripting: examples: plane-wind-fs: fixup for luacheck

This commit is contained in:
Iampete1 2023-06-17 18:57:30 +01:00 committed by Andrew Tridgell
parent 6faa77993a
commit 2eaad47bf8
1 changed files with 7 additions and 9 deletions

View File

@ -2,7 +2,6 @@
-- the average battery consumption, and the wind to decide when to failsafe
--
-- CAUTION: This script only works for Plane
-- luacheck: only 0
-- store the batt info as { instance, filtered, capacity, margin_mah }
-- instance: the battery monitor instance (zero indexed)
@ -37,19 +36,19 @@ if value then
else
error('LUA: get TRIM_ARSPD_CM failed')
end
local value = param:get('ARSPD_FBW_MIN')
value = param:get('ARSPD_FBW_MIN')
if value then
min_air_speed = value
else
error('LUA: get ARSPD_FBW_MIN failed')
end
local value = param:get('MIN_GNDSPD_CM')
value = param:get('MIN_GNDSPD_CM')
if value then
min_ground_speed = value / 100
else
error('LUA: get MIN_GNDSPD_CM failed')
end
local value = param:get('LIM_ROLL_CD')
value = param:get('LIM_ROLL_CD')
if value then
max_bank_angle = value / 100
else
@ -62,7 +61,7 @@ local turn_rad = (air_speed^2) / (9.81 * math.tan(math.rad(max_bank_angle)))
-- Read the radius we expect to circle at when we get home
local home_reached_rad
local value = param:get('RTL_RADIUS')
value = param:get('RTL_RADIUS')
if value then
value = math.abs(value)
if value > 0 then
@ -81,11 +80,10 @@ end
-- internal global variables
local return_start
local return_distance
local return_amps
local trigger_instance = batt_info[1][1]
local last_print = 0
local timer_start_time = 0
local last_print = uint32_t()
local timer_start_time = uint32_t()
local timer_active = true
-- calculates the amount of time it will take for the vehicle to return home
@ -419,7 +417,7 @@ for i = 1, #batt_info do
param_string = 'BATT_CRT_MAH'
end
local value = param:get(param_string)
value = param:get(param_string)
if not value then
error('LUA: get '.. param_string .. ' failed')
end