AP_Scripting: examples: plane-wind-fs: read in CRT_MAH

This commit is contained in:
Peter Hall 2020-04-01 14:51:01 +01:00 committed by WickedShell
parent 520782d7f2
commit aa657626f2

View File

@ -408,7 +408,18 @@ for i = 1, #batt_info do
-- subtract the capacity we want remaining when we get home
local rated_cap = battery:pack_capacity_mah(instance)
if rated_cap then
batt_info[i][3] = rated_cap - batt_info[i][4]
-- read in the critical MAH
local param_string = 'BATT' .. tostring(instance + 1) .. '_CRT_MAH'
if instance == 0 then
param_string = 'BATT_CRT_MAH'
end
local value = param:get(param_string)
if not value then
error('LUA: get '.. param_string .. ' failed')
end
batt_info[i][3] = rated_cap - (batt_info[i][4] + value)
else
error("Battery " .. instance .. " does not support current monitoring")
end