From 281e9b64ef5f94964eba995c9bf7eafcafbe6579 Mon Sep 17 00:00:00 2001 From: Jonathan Hudson Date: Mon, 5 Aug 2024 12:25:54 +0100 Subject: [PATCH] fix JumperT15 --- src/SCRIPTS/TELEMETRY/iNav.lua | 2 +- src/SCRIPTS/TELEMETRY/iNav/func_h.lua | 24 +++++++++++++----------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/SCRIPTS/TELEMETRY/iNav.lua b/src/SCRIPTS/TELEMETRY/iNav.lua index 9c82cf0..5fd1b89 100644 --- a/src/SCRIPTS/TELEMETRY/iNav.lua +++ b/src/SCRIPTS/TELEMETRY/iNav.lua @@ -2,7 +2,7 @@ -- Docs: https://github.com/iNavFlight/OpenTX-Telemetry-Widget local zone, options = ... -local VERSION = "2.2.4" +local VERSION = "2.2.5" local FILE_PATH = "/SCRIPTS/TELEMETRY/iNav/" local SMLCD = LCD_W < 212 local HORUS = LCD_W >= 480 or LCD_H >= 480 diff --git a/src/SCRIPTS/TELEMETRY/iNav/func_h.lua b/src/SCRIPTS/TELEMETRY/iNav/func_h.lua index f267f2d..350e34d 100644 --- a/src/SCRIPTS/TELEMETRY/iNav/func_h.lua +++ b/src/SCRIPTS/TELEMETRY/iNav/func_h.lua @@ -196,19 +196,21 @@ function data.clear(event) data.lastevt = event end end - if event == 0 and data.lastt6 ~= nil then - if getValue(data.t6_id) > data.lastt6 then - event = data.nv and EVT_VIRTUAL_PREV or EVT_ROT_LEFT -- Up - elseif getValue(data.t6_id) < data.lastt6 then - event = data.nv and EVT_VIRTUAL_NEXT or EVT_ROT_RIGHT -- Down - end + if data.t6_id ~= nil then + if event == 0 and data.lastt6 ~= nil then + if getValue(data.t6_id) > data.lastt6 then + event = data.nv and EVT_VIRTUAL_PREV or EVT_ROT_LEFT -- Up + elseif getValue(data.t6_id) < data.lastt6 then + event = data.nv and EVT_VIRTUAL_NEXT or EVT_ROT_RIGHT -- Down + end + end + data.lastt6 = not data.nv and getValue(data.t6_id) or nil + if data.lastt6 == 0 then + data.lastt6 = nil + end end if event == 0 and data.doLogs and getValue(data.hcurx_id) < -940 then - event = EVT_EXIT_BREAK -- Left (exit) - end - data.lastt6 = not data.nv and getValue(data.t6_id) or nil - if data.lastt6 == 0 then - data.lastt6 = nil + event = EVT_EXIT_BREAK -- Left (exit) end end return event