AP_Scripting: tricks-on-a-switch activation cleanup

This commit is contained in:
Mark Whitehorn 2023-05-29 13:42:08 -06:00 committed by Andrew Tridgell
parent 84104331ec
commit 154ccf4e63
2 changed files with 8 additions and 4 deletions

View File

@ -764,7 +764,7 @@ function check_auto_mission()
end
end
local last_trick_action_state = 0
local last_trick_action_state = rc:get_aux_cached(TRIK_ACT_FN:get())
local trick_sel_chan = nil
local last_trick_selection = 0
@ -877,6 +877,10 @@ function do_trick(cmd,arg1,arg2)
end
function update()
if ahrs:get_velocity_NED() == nil or ahrs:get_EAS2TAS() == nil or ahrs:get_relative_position_NED_origin() == nil then
-- don't start till we have valid ahrs estimates
return update, 10
end
if vehicle:get_mode() == MODE_AUTO then
check_auto_mission() --run a trick mission item
elseif tricks_exist() then

View File

@ -3110,7 +3110,7 @@ function check_auto_mission()
end
end
local last_trick_action_state = 0
local last_trick_action_state = rc:get_aux_cached(TRIK_ACT_FN:get())
local trick_sel_chan = nil
local last_trick_selection = nil
@ -3213,8 +3213,8 @@ function check_trick()
end
function update()
if ahrs:get_velocity_NED() == nil or ahrs:get_EAS2TAS() == nil then
-- don't start till we have a valid ahrs estimates
if ahrs:get_velocity_NED() == nil or ahrs:get_EAS2TAS() == nil or ahrs:get_relative_position_NED_origin() == nil then
-- don't start till we have valid ahrs estimates
return update, 1000.0/LOOP_RATE
end
if vehicle:get_mode() == MODE_AUTO then