/
Sangak
/
ardupilot
Обзор
Документация
Войти
/
Sangak
/
ardupilot
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
libraries/AP_Scripting/examples/arming-check-batt-temp.lua
20 строк
731 B
Peter Hall
AP_Scripting: example: arming auth: removed unused millis call
11 ноя 2020, 10:24
11 ноя 2020, 10:24
d6a1af4
Код
Авторство
О чём код?
-- This script runs a custom arming check of the battery temperature auth_id = arming:get_aux_auth_id() batt_temp_max = 35 function update() -- this is the loop which periodically runs if auth_id then batt_temp = battery:get_temperature(0) if not batt_temp then arming:set_aux_auth_failed(auth_id, "Could not retrieve battery temperature") elseif (batt_temp >= batt_temp_max) then arming:set_aux_auth_failed(auth_id, "Batt temp too high (" .. tostring(batt_temp) .. "C > " .. tostring(batt_temp_max) .. "C)") else arming:set_aux_auth_passed(auth_id) end end return update, 5000 -- reschedules the loop in 5 seconds end return update() -- run immediately before starting to reschedule