Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions docs/Configuration-Settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@

![sample](https://raw.githubusercontent.com/iNavFlight/LuaTelemetry/master/assets/iNavConfigHorus.png "Horus config menu")

### EdgeTX 3.0 and above
_Entering the setup menu_
To enter the configuration settings for a Lua script on newer version of EdgeTX:
* Ensure the script is set to run in "app mode"
* Long press the scroll wheel until the blue "EdgeTX" icon in the upper left disappears
* Press the Sys button

_Exiting the setup mode_
* Press RTN to exit Lua configuration menu
* Long press the TN button until the blue EdgeTX icon appears at top left
* You can then use the Page buttons to swap between screens

### Other radios

The following applies generically to all non-Colour (B&W) / small screen radios:
Expand Down
13 changes: 11 additions & 2 deletions docs/Getting-Started.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,23 @@ Don't be too concerned about the length of these instructions. The first two sec
1. In model setup, page to `DISPLAY`
1. Set desired screen to `Script`
1. Select `iNav`
* Horus/Jumper T16:
* Horus/Jumper T16 (EdgeTX before v2.11):
1. Long-press `TELE` to access the user interface/views layout
1. Select the desired view (or create a new one)
1. Make `Layout` full screen, turn off `Top bar` and `Sliders+Trims`
1. Select `Setup widgets`
1. Press `Enter` till a menu appears and select `Select widget`
1. Scroll to the `iNav` widget and press `Enter`
1. Optionally (while still selecting the `iNAV` script), long-press `Enter`, select `Widget settings` where you can enable `Restore` (to restore your theme's colors) and set your theme's `Text` color and `Warning` color
1. Optionally (while still selecting the `iNAV` script), long-press `Enter`, select `Widget settings` where you can set your theme's `Text` color and `Warning` color
* RadioMaster TX16S and other color touchscreen radios (EdgeTX v2.11+):
1. Long-press `TELE` to access the user interface/views layout
1. Select the desired view (or create a new one)
1. Choose the `App Mode` layout (not `Full screen`) — this allows the widget to receive key and touch events and automatically hides the top bar and sliders/trims
1. Long-press `Enter` (jog wheel) — it may take more than one long-press for the widget selection menu to appear
1. Select `Select widget`, scroll to `iNav` and press `Enter`
1. Optionally, long-press `Enter`, select `Widget settings` to set your theme's `Text` color and `Warning` color
1. Press `RTN` to exit setup
1. After a reboot, you may need to long-press the jog wheel or long-touch the screen to re-enter app mode (events are not passed to the widget until app mode is active)
* Nirvana NV14:
1. Press the Widgets icon
1. Select the desired view
Expand Down
55 changes: 53 additions & 2 deletions src/SCRIPTS/TELEMETRY/iNav.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ local FILE_PATH = "/SCRIPTS/TELEMETRY/iNav/"
local SMLCD = LCD_W < 212
local HORUS = LCD_W >= 480 or LCD_H >= 480
local TX15 = LCD_W == 480 and LCD_H == 320
local TX16S = LCD_W >= 800 and LCD_H >= 480
local tmp, view, lang, playLog
local env = "bt" -- compile on platform
local inav = {}
Expand Down Expand Up @@ -454,7 +455,7 @@ function inav.background()
data.bkgd = true
end

function inav.run(event)
function inav.run(event, touchState)
--[[ Show FPS
data.start = getTime()
]]
Expand Down Expand Up @@ -494,6 +495,56 @@ function inav.run(event)
end
]]

-- Touch event handling (TX16S and other touchscreen radios)
-- Must run before config menu check so touch works in both menu and views
if TX16S and touchState and event ~= nil and event ~= 0 then
if event == EVT_TOUCH_TAP then
if data.configStatus > 0 then
-- In config menu: tap to select row or toggle edit
local tapped = data.configTop + math.floor((touchState.y - 37) / 22)
if tapped >= 1 and tapped <= #config and tapped ~= data.configStatus then
data.configStatus = tapped
data.configSelect = 0
event = 0
else
event = EVT_ENTER_BREAK
end
elseif touchState.y < 277 then
-- Tap on upper area: toggle max/min values
if not data.armed then
data.showMax = not data.showMax
end
data.showDir = not data.showDir
event = 0
else
-- Tap on data area: enter config menu
event = MENU
end
elseif event == EVT_TOUCH_SLIDE then
if touchState.swipeUp then
event = EVT_VIRTUAL_NEXT
elseif touchState.swipeDown then
event = EVT_VIRTUAL_PREV
elseif touchState.slideY then
-- Accumulate drag distance for continuous scroll
data.touchAccumY = (data.touchAccumY or 0) + touchState.slideY
if data.touchAccumY > 30 then
event = EVT_VIRTUAL_NEXT
data.touchAccumY = 0
elseif data.touchAccumY < -30 then
event = EVT_VIRTUAL_PREV
data.touchAccumY = 0
else
event = 0
end
else
event = 0
end
else
event = 0
end
end

-- Config menu or views
if data.configStatus > 0 then
if data.v ~= 9 then
Expand Down Expand Up @@ -538,7 +589,7 @@ function inav.run(event)
if data.v ~= config[25].v then
view = nil
collectgarbage()
view = loadScript(FILE_PATH .. (HORUS and (TX15 and "tx15" or (data.nv and "nirvana" or "horus")) or (config[25].v == 0 and "view" or (config[25].v == 1 and "pilot" or (config[25].v == 2 and "radar" or "alt")))) .. ext, env)()
view = loadScript(FILE_PATH .. (HORUS and (TX16S and "tx16s" or (TX15 and "tx15" or (data.nv and "nirvana" or "horus"))) or (config[25].v == 0 and "view" or (config[25].v == 1 and "pilot" or (config[25].v == 2 and "radar" or "alt")))) .. ext, env)()
data.v = config[25].v
end
view(data, config, modes, dir, units, labels, gpsDegMin, hdopGraph, icons, calcBearing, calcDir, VERSION, SMLCD, FILE_PATH, text, line, rect, fill, frmt)
Expand Down
Loading