Skip to content
This repository was archived by the owner on Oct 26, 2025. It is now read-only.

Commit b7fd1a5

Browse files
committed
tracker only functions and settings
1 parent 7a8ecf3 commit b7fd1a5

3 files changed

Lines changed: 62 additions & 25 deletions

File tree

LTM/crsf.lua

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
--[[
2+
-- inav FrSky / CRSF Telemetry to LTM
3+
-- Designed for the Radiomaster TX16S UART set to 'LUA' and invoked via
4+
-- either a Global or Special Function
5+
--
6+
-- LTM can be used in INAV compatible ground stations such as mwp, ezgui or
7+
-- mission planner for inav, as well as antenna trackers e.g u360gts
8+
--
9+
-- Licence : GPL 3 or later
10+
--
11+
-- (c) Jonathan Hudson 2020
12+
-- https://github.com/stronnag/LTM-lua/
13+
--
14+
]]--
15+
116
local D,getTelemetryId = ...
217
local C={}
318

README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,31 @@ Typical use case:
1414
## Installation and Usage
1515

1616
* Copy the script `ltm.lua` to the `SCRIPTS/FUNCTIONS' directory
17-
* Create a directory, `SCRIPTS/FUNCTIONS/LTM`; copy the file LTM/crsf.lua to that directory, such that the following directory structure is maintained; in particular `crsf.lua` is the `LTM` sub-directory:
17+
* Create a directory, `SCRIPTS/FUNCTIONS/LTM`; copy the files `LTM/crsf.lua` and `LTM/config.lua` to that directory, such that the following directory structure is maintained.
1818
```
1919
├── SCRIPTS
2020
│   ├── FUNCTIONS
2121
│   │   ├── ltm.lua
2222
│   │   ├── LTM
2323
│   │   │   ├── crsf.lua
24+
│   │   │   ├── config.lua
2425
```
2526
* Enable the script as a Global Function or model specific Special Function.
2627

27-
Note that any Zip files in the release area will maintain this structure.
28+
Note that any Zip files in the release area will profile this directory structure.
2829

2930
The script may be invoked either on an external stimulus e.g. `Telemetry` or on a switch. See the OpenTX / TX vendor documentation for details on configuring your radio.
3031

3132
Note that the UARTs on the TX16S default to 115200 bps, so set BT devices accordingly.
3233

3334
Note also that in OTX 2.3.9, a bug causes no power to be supplied to the TX16S UARTS; this is fixed in the 2.3.10 nightlies.
3435

36+
## Configuration
37+
38+
There are a few user editable settings in the file `LTM/config.lua`; currently the user must edit this file directly as no radio UI is provdied.
39+
40+
In particular, the `onlyTracker` setting may be used to provide only GPS data for antenna trackers. See the comments in `LTM/config.lua` for details.
41+
3542
## Audio
3643

3744
The `audio` directory contains two synthesised voice files, `ltmon.wav` and `ltmoff.wav` that may be placed in `SOUNDS/en` and used to provide audible indications (via Special Functions) that LTM forwarding is enabled / disabled.

ltm.lua

Lines changed: 38 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,23 @@
44
-- either a Global or Special Function
55
--
66
-- LTM can be used in INAV compatible ground stations such as mwp, ezgui or
7-
-- mission planner for inav
7+
-- mission planner for inav, as well as antenna trackers e.g u360gts
88
--
99
-- Licence : GPL 3 or later
1010
--
1111
-- (c) Jonathan Hudson 2020
12+
-- https://github.com/stronnag/LTM-lua/
13+
--
1214
]]--
1315

16+
-- User editable settings -- see LTM/config.lua
17+
local S = {}
18+
-- Common data
1419
local D = {}
20+
-- CRSF specific data and functions
1521
local C = {}
16-
local lastt = 0
1722

18-
-- Debugging
19-
local LOGGER = false
23+
local lastt = 0
2024

2125
local function openlog()
2226
local dt = getDateTime()
@@ -41,7 +45,7 @@ local function dolog(str)
4145
end
4246

4347
local function mlog(ltm)
44-
if LOGGER then
48+
if S.LOGGER then
4549
D.fh = D.fh or openlog()
4650
io.write(D.fh, ltm)
4751
end
@@ -189,7 +193,7 @@ local function send_gframe()
189193
end
190194
end
191195
end
192-
dolog(string.format("GFrame: Lat %.6f Lon %.6f Alt %.2f Spd %.1f fix %d sats %d hdop %d", D.lat, D.lon, D.alt, D.gspd, D.nfix, D.nsats, D.hdop))
196+
dolog(string.format("\nGFrame: Lat %.6f Lon %.6f Alt %.2f Spd %.1f fix %d sats %d hdop %d", D.lat, D.lon, D.alt, D.gspd, D.nfix, D.nsats, D.hdop))
193197
ltm_gframe()
194198
end
195199

@@ -280,7 +284,7 @@ local function send_aframe()
280284
D.roll = (270 - data.roll * 0.1) % 180
281285
end
282286
end
283-
dolog(string.format("AFrame: pitch %d roll %d heading %d", D.pitch, D.roll, D.hdg))
287+
dolog(string.format("\nAFrame: pitch %d roll %d heading %d", D.pitch, D.roll, D.hdg))
284288
ltm_aframe()
285289
end
286290

@@ -341,6 +345,9 @@ local function init()
341345
if string.sub(r, -4) == "simu" then
342346
D.sim = true
343347
end
348+
349+
S = loadScript("/SCRIPTS/FUNCTIONS/LTM/config.lua")()
350+
dolog("Tracker only " .. string.format("%s",S.onlyTracker))
344351
-- Testing Crossfire
345352
-- if D.sim then D.fm_id = 1 end
346353

@@ -363,13 +370,13 @@ local function init()
363370
end
364371
dolog("Using Smartport")
365372
end
366-
dolog("vid".." "..D.volt_id)
367-
dolog("sat".." "..D.sat_id)
368-
dolog("mode".." "..D.mode_id)
369-
dolog("alt".." "..D.alt_id)
370-
dolog("gps".." "..D.gps_id)
371-
dolog("hdr".." "..D.hdg_id)
372-
dolog("curr".." "..D.curr_id)
373+
dolog("vid "..D.volt_id)
374+
dolog("sat "..D.sat_id)
375+
dolog("mode "..D.mode_id)
376+
dolog("alt "..D.alt_id)
377+
dolog("gps "..D.gps_id)
378+
dolog("hdr "..D.hdg_id)
379+
dolog("curr "..D.curr_id)
373380
end
374381

375382
-- Main
@@ -383,17 +390,25 @@ local function run(event)
383390
rssi, r0, r1 = getRSSI()
384391
if rssi ~= nil then
385392
D.rssi = rssi
386-
send_aframe()
387-
if (D.mcount % 2) == 0 then
388-
send_gframe()
393+
if S.onlyTracker then
394+
if (D.mcount % 2) == 0 then
395+
send_gframe()
396+
else
397+
send_aframe()
398+
end
389399
else
390-
send_sframe()
391-
if D.mcount == 1 then
392-
send_oframe()
393-
elseif D.mcount == 5 then
394-
send_xframe()
400+
send_aframe()
401+
if (D.mcount % 2) == 0 then
402+
send_gframe()
395403
else
396-
send_nframe()
404+
send_sframe()
405+
if D.mcount == 1 then
406+
send_oframe()
407+
elseif D.mcount == 5 then
408+
send_xframe()
409+
else
410+
send_nframe() -- noop for now
411+
end
397412
end
398413
end
399414
D.mcount = (D.mcount + 1) % 10

0 commit comments

Comments
 (0)