Skip to content

Commit

Permalink
AP_Scripting: examples: use binding for in_trim_dz
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbarker committed Mar 18, 2024
1 parent 82ca2bd commit 9c53428
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions libraries/AP_Scripting/examples/rover-MinFixType.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ local USER_MODES = {
}

local MODE_CH = param:get('MODE_CH')
local THR_CH = param:get('RCMAP_THROTTLE')
local THR_TRIM = param:get(string.format('RC%d_TRIM', THR_CH))
local THR_DZ = param:get(string.format('RC%d_DZ', THR_CH))
local THR_CH = rc:find_channel_for_option(203) -- see RC_Channel.h

-- wrapper for gcs:send_text()
local function gcs_msg(msg_type, severity, txt)
Expand Down Expand Up @@ -90,7 +88,7 @@ local function get_user_mode()
end

local function get_pause_mode()
if math.abs(rc:get_pwm(THR_CH) - THR_TRIM) > THR_DZ then
if not THR_CH:in_trim_dz() then
return THR_SAFEGUARD_MODE
end
return MSN_PAUSE_MODE
Expand Down

0 comments on commit 9c53428

Please sign in to comment.