From 565f757f3590d15e73ddd0711a56f0b3e03a532c Mon Sep 17 00:00:00 2001 From: Yuri Date: Mon, 4 Jul 2022 18:20:51 -0500 Subject: [PATCH] AP_Scripting: rover-MinFixType example param caching fix --- libraries/AP_Scripting/examples/rover-MinFixType.lua | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/libraries/AP_Scripting/examples/rover-MinFixType.lua b/libraries/AP_Scripting/examples/rover-MinFixType.lua index 40c3d7fdce..aabe1f44d6 100755 --- a/libraries/AP_Scripting/examples/rover-MinFixType.lua +++ b/libraries/AP_Scripting/examples/rover-MinFixType.lua @@ -49,6 +49,15 @@ local FIX_TYPES = { local MODE_THRESHOLDS = {1231, 1361, 1491, 1621, 1750, 2050} +local USER_MODES = { + param:get('MODE1'), + param:get('MODE2'), + param:get('MODE3'), + param:get('MODE4'), + param:get('MODE5'), + param:get('MODE6') +} + 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)) @@ -77,7 +86,7 @@ local function get_user_mode() break end end - return tonumber(param:get('MODE' .. mode_num)) + return USER_MODES[mode_num] end local function get_pause_mode()