Skip to content

Commit 7c93e45

Browse files
authored
Merge pull request #310 from iNavFlight/development
v1.7.1
2 parents 03fce67 + b35f777 commit 7c93e45

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+645
-514
lines changed

Diff for: .gitattributes

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*.luac -diff
2+
*.png -diff
3+
*.wav -diff
4+
dist/SCRIPTS/TELEMETRY/iNav.lua -diff

Diff for: .gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ dist/SCRIPTS/TELEMETRY/iNav/*.lua
33
*.dat
44
*.zip
55
desktop.ini
6-
dist/THEMES/
6+
dist/THEMES/
7+
obj/

Diff for: README.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## INAV Lua Telemetry Flight Status for Taranis/Horus/Jumper T16 - v1.7.0
1+
## INAV Lua Telemetry Flight Status for Taranis/Horus/Jumper T16 - v1.7.1
22

33
### FrSky SmartPort(S.Port), D-series, F.Port & TBS Crossfire telemetry on Taranis, Horus & Jumper T16 transmitters
44

@@ -35,13 +35,13 @@
3535
## Features
3636

3737
* Works with all FrSky telemetry receivers (X, R9 and D series), all TBS Crossfire receivers, all FrSky Taranis and Horus transmitters, and the Jumper T16 transmitter
38-
* Compatible with Betaflight using FrSky X or R9 series receivers (with reduced functionality) and TBS Crossfire support with Betaflight >3.5.5
38+
* Compatible with Betaflight using FrSky X or R9 series receivers (with reduced functionality) and TBS Crossfire support with Betaflight 4.0.0+
3939
* Launch/pilot-based model orientation and location indicators (great for lost orientation/losing sight of your model)
4040
* Compass-based direction indicator (with magnetometer sensor on multirotor or fixed-wing with GPS)
4141
* Pilot (glass cockpit) view which includes attitude indicator as well as pilot-familiar layout of additional data
4242
* Radar (map) view shows model in relationship to home position, can be displayed either as launch/pilot-based or compass-based orientation
4343
* Altitude graph view shows altitude for the last 1-6 minutes
44-
* Horus and Jumper T16 transmitters show all views at the same time, and include additional features like roll indicator and uncaged pitch ladder
44+
* Horus and Jumper T16 transmitters show all views at the same time, and include additional features like roll scale
4545
* Bar gauges for Fuel (% battery mAh capacity remaining), Battery voltage, RSSI strength, Transmitter battery, GPS accuracy (HDOP), Variometer (and Altitude for X9D, X9D+ and X9E transmitters)
4646
* Display and voice alerts for flight modes and flight mode modifiers (altitude hold, heading hold, home reset, etc.)
4747
* Voice notifications for % battery remaining (based on current), voltage low/critical, high altitude, lost GPS, ready to arm, armed, disarmed, etc.
@@ -55,7 +55,7 @@
5555

5656
## Requirements
5757

58-
* [OpenTX v2.2.2+](http://www.open-tx.org/) running on Taranis Q X7/Q X7S, X9D/X9D+, X9E, X-Lite, Horus X10/X10S or X12S (OpenTX v2.2.3+ is suggested)
58+
* [OpenTX v2.2.2+](http://www.open-tx.org/) running on Taranis Q X7/Q X7S, X9D/X9D+, X9E, X9 Lite, X-Lite/X-Lite Pro, Horus X10/X10S or X12S (OpenTX v2.2.3+ is suggested)
5959
* Jumper T16 requires [JumperTX 2.2.3+](https://www.jumper.xyz/jumpertx-t16) (May 23, 2019 or after release)
6060
* FrSky X, R9 or D series telemetry receiver: X4RSB, X8R, XSR, R-XSR, XSR-M, XSR-E, RX4R, RX6R, XM, XM+, R9, R9 Slim, R9 Slim+, R9 Mini, R9 MM, D8R-II plus, D8R-XP, D4R-II, etc. or any TBS Crossfire receiver: Micro, Nano, Diversity, etc.
6161
* [INAV v1.7.3+](https://github.com/iNavFlight/inav/releases) running on your flight controller (INAV v2.1.0+ is suggested for full functionality) - Also compatible with Betaflight (with reduced functionality)
@@ -90,6 +90,7 @@
9090
* [Download latest release](https://github.com/iNavFlight/LuaTelemetry/releases/latest)
9191
* [Installation Instructions](https://github.com/iNavFlight/LuaTelemetry/wiki/Installation)
9292
* [Upgrade Instructions](https://github.com/iNavFlight/LuaTelemetry/wiki/Upgrade)
93+
* [Download Options](https://github.com/iNavFlight/LuaTelemetry/wiki/Download-Options)
9394

9495
## Information & Settings
9596

Diff for: assets/iNavConfigHorus.png

12.5 KB
Loading

Diff for: assets/iNavX9Dalt.png

104 Bytes
Loading

Diff for: build

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/bash
2+
3+
echo
4+
echo Compiling INAV Lua Telemetry...
5+
echo
6+
7+
mkdir obj
8+
9+
luac52 -s -o obj/main.luac dist/WIDGETS/iNav/main.lua
10+
luac52 -s -o obj/iNav.luac src/iNav.lua
11+
luac52 -s -o obj/alt.luac src/iNav/alt.lua
12+
luac52 -s -o obj/config.luac src/iNav/config.lua
13+
luac52 -s -o obj/crsf.luac src/iNav/crsf.lua
14+
luac52 -s -o obj/data.luac src/iNav/data.lua
15+
luac52 -s -o obj/func_h.luac src/iNav/func_h.lua
16+
luac52 -s -o obj/func_t.luac src/iNav/func_t.lua
17+
luac52 -s -o obj/horus.luac src/iNav/horus.lua
18+
luac52 -s -o obj/lang.luac src/iNav/lang.lua
19+
luac52 -s -o obj/lang_de.luac src/iNav/lang_de.lua
20+
luac52 -s -o obj/lang_es.luac src/iNav/lang_es.lua
21+
luac52 -s -o obj/lang_fr.luac src/iNav/lang_fr.lua
22+
luac52 -s -o obj/load.luac src/iNav/load.lua
23+
luac52 -s -o obj/menu.luac src/iNav/menu.lua
24+
luac52 -s -o obj/modes.luac src/iNav/modes.lua
25+
luac52 -s -o obj/other.luac src/iNav/other.lua
26+
luac52 -s -o obj/pilot.luac src/iNav/pilot.lua
27+
luac52 -s -o obj/radar.luac src/iNav/radar.lua
28+
luac52 -s -o obj/reset.luac src/iNav/reset.lua
29+
luac52 -s -o obj/view.luac src/iNav/view.lua
30+
31+
rm -fR obj/
32+
33+
echo
34+
echo Complete

Diff for: dist/SCRIPTS/TELEMETRY/iNav.lua

-363 Bytes
Binary file not shown.

Diff for: dist/SCRIPTS/TELEMETRY/iNav.luac

-363 Bytes
Binary file not shown.

Diff for: dist/SCRIPTS/TELEMETRY/iNav/alt.luac

121 Bytes
Binary file not shown.

Diff for: dist/SCRIPTS/TELEMETRY/iNav/config.luac

-4 Bytes
Binary file not shown.

Diff for: dist/SCRIPTS/TELEMETRY/iNav/crsf.luac

74 Bytes
Binary file not shown.

Diff for: dist/SCRIPTS/TELEMETRY/iNav/data.luac

-72 Bytes
Binary file not shown.

Diff for: dist/SCRIPTS/TELEMETRY/iNav/func_h.luac

835 Bytes
Binary file not shown.

Diff for: dist/SCRIPTS/TELEMETRY/iNav/horus.luac

-99 Bytes
Binary file not shown.

Diff for: dist/SCRIPTS/TELEMETRY/iNav/lang.luac

6 Bytes
Binary file not shown.

Diff for: dist/SCRIPTS/TELEMETRY/iNav/lang_de.luac

191 Bytes
Binary file not shown.

Diff for: dist/SCRIPTS/TELEMETRY/iNav/lang_es.luac

170 Bytes
Binary file not shown.

Diff for: dist/SCRIPTS/TELEMETRY/iNav/lang_fr.luac

152 Bytes
Binary file not shown.

Diff for: dist/SCRIPTS/TELEMETRY/iNav/menu.luac

393 Bytes
Binary file not shown.

Diff for: dist/SCRIPTS/TELEMETRY/iNav/other.luac

558 Bytes
Binary file not shown.

Diff for: dist/SCRIPTS/TELEMETRY/iNav/pics/fpv.png

171 Bytes
Loading

Diff for: dist/SCRIPTS/TELEMETRY/iNav/pilot.luac

129 Bytes
Binary file not shown.

Diff for: dist/SCRIPTS/TELEMETRY/iNav/radar.luac

81 Bytes
Binary file not shown.

Diff for: dist/SCRIPTS/TELEMETRY/iNav/reset.luac

9 Bytes
Binary file not shown.

Diff for: dist/SCRIPTS/TELEMETRY/iNav/view.luac

-4 Bytes
Binary file not shown.

Diff for: dist/WIDGETS/iNav/main.lua

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ end
2424
-- This function allow updates when you change widgets settings
2525
local function update(iNavZone, options)
2626
iNavZone.options = options
27+
return
2728
end
2829

2930
-- Called periodically when custom telemetry screen containing widget is visible.

Diff for: dist/WIDGETS/iNav/main.luac

4 Bytes
Binary file not shown.

Diff for: release

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/bin/bash
22

3+
echo
34
echo -n Packaging release files
45

56
rm LuaTelemetry-Taranis-en.zip > /dev/null 2>&1
@@ -10,13 +11,13 @@ echo -n .
1011

1112
cd dist
1213

13-
zip -9 -q -r ../LuaTelemetry-Taranis-en.zip SCRIPTS/* -x *.lua -x *.dat -x */pics/* -x */de/* -x */es/* -x */fr/*
14+
zip -9 -q -r ../LuaTelemetry-Taranis-en.zip SCRIPTS/* -x *.lua -x *.dat -x */pics/* -x */horus.luac -x */func_h.luac -x */de/* -x */es/* -x */fr/* -x */lang*.luac
1415
echo -n .
15-
zip -9 -q -r ../LuaTelemetry-Taranis.zip SCRIPTS/* -x *.lua -x *.dat -x */pics/*
16+
zip -9 -q -r ../LuaTelemetry-Taranis.zip SCRIPTS/* -x *.lua -x *.dat -x */pics/* -x */horus.luac -x */func_h.luac
1617
echo -n .
17-
zip -9 -q -r ../LuaTelemetry-Horus-en.zip SCRIPTS/* WIDGETS/* -x *.lua -x *.dat -x */de/* -x */es/* -x */fr/*
18+
zip -9 -q -r ../LuaTelemetry-Horus-en.zip SCRIPTS/* WIDGETS/* -x *.lua -x *.dat -x */de/* -x */es/* -x */fr/* -x */lang*.luac -x */alt.luac -x */func_t.luac -x */pilot.luac -x */radar.luac -x */view.luac
1819
echo -n .
19-
zip -9 -q -r ../LuaTelemetry-Horus.zip SCRIPTS/* WIDGETS/* -x *.lua -x *.dat
20+
zip -9 -q -r ../LuaTelemetry-Horus.zip SCRIPTS/* WIDGETS/* -x *.lua -x *.dat -x */alt.luac -x */func_t.luac -x */pilot.luac -x */radar.luac -x */view.luac
2021
echo -n .
2122
zip -9 -q -r ../LuaTelemetry.zip SCRIPTS/* WIDGETS/* -x *.lua -x *.dat
2223
echo -n .

Diff for: src/iNav.lua

+48-53
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,33 @@
33
-- Docs: https://github.com/iNavFlight/LuaTelemetry
44

55
local buildMode = ...
6-
local VERSION = "1.7.0"
6+
local VERSION = "1.7.1"
77
local FILE_PATH = "/SCRIPTS/TELEMETRY/iNav/"
88
local SMLCD = LCD_W < 212
99
local HORUS = LCD_W >= 480
1010
local FLASH = HORUS and WARNING_COLOR or 3
1111
local tmp, view, lang
12+
local env = "bx"
1213

13-
-- Build with Companion
14+
-- Build with Companion and allow debugging
1415
local v, r, m, i, e = getVersion()
15-
if string.sub(r, -4) == "simu" and buildMode ~= false then
16-
loadScript(FILE_PATH .. "build", "tx")(buildMode)
16+
if string.sub(r, -4) == "simu" then
17+
env = "tx"
18+
if buildMode ~= false then
19+
loadScript(FILE_PATH .. "build", "tx")(buildMode)
20+
end
1721
end
1822

19-
local config = loadfile(FILE_PATH .. "config.luac")(SMLCD)
23+
local config = loadScript(FILE_PATH .. "config", env)(SMLCD)
2024
collectgarbage()
2125

22-
local modes, units, labels = loadfile(FILE_PATH .. "modes.luac")()
26+
local modes, units, labels = loadScript(FILE_PATH .. "modes", env)()
2327
collectgarbage()
2428

25-
local data, getTelemetryId, getTelemetryUnit, PREV, INCR, NEXT, DECR, MENU = loadfile(FILE_PATH .. "data.luac")(r, m, i, HORUS)
29+
local data, getTelemetryId, getTelemetryUnit, PREV, INCR, NEXT, DECR, MENU = loadScript(FILE_PATH .. "data", env)(r, m, i, HORUS)
2630
collectgarbage()
2731

28-
loadfile(FILE_PATH .. "load.luac")(config, data, FILE_PATH)
32+
loadScript(FILE_PATH .. "load", env)(config, data, FILE_PATH)
2933
collectgarbage()
3034

3135
--[[ Simulator language testing
@@ -34,15 +38,17 @@ data.voice = "es"
3438
]]
3539

3640
if data.lang ~= "en" or data.voice ~= "en" then
37-
lang = loadfile(FILE_PATH .. "lang.luac")(modes, labels, data, FILE_PATH)
41+
lang = loadScript(FILE_PATH .. "lang", env)(modes, labels, data, FILE_PATH, env)
3842
collectgarbage()
3943
end
4044

41-
loadfile(FILE_PATH .. "reset.luac")(data)
42-
local crsf = loadfile(FILE_PATH .. "other.luac")(config, data, units, getTelemetryId, getTelemetryUnit, FILE_PATH)
45+
loadScript(FILE_PATH .. "reset", env)(data)
46+
collectgarbage()
47+
48+
local crsf, distCalc = loadScript(FILE_PATH .. "other", env)(config, data, units, getTelemetryId, getTelemetryUnit, FILE_PATH, env)
4349
collectgarbage()
4450

45-
local title, gpsDegMin, hdopGraph, icons, widgetEvt = loadfile(FILE_PATH .. (HORUS and "func_h.luac" or "func_t.luac"))(config, data, FILE_PATH)
51+
local title, gpsDegMin, hdopGraph, icons, widgetEvt = loadScript(FILE_PATH .. (HORUS and "func_h" or "func_t"), env)(config, data, FILE_PATH)
4652
collectgarbage()
4753

4854
local function playAudio(f, a)
@@ -51,24 +57,15 @@ local function playAudio(f, a)
5157
end
5258
end
5359

54-
local function calcTrig(gps1, gps2, deg)
55-
local o1 = math.rad(gps1.lat)
56-
local a1 = math.rad(gps1.lon)
57-
local o2 = math.rad(gps2.lat)
58-
local a2 = math.rad(gps2.lon)
59-
if deg then
60-
local x = (math.cos(o1) * math.sin(o2)) - (math.sin(o1) * math.cos(o2) * math.cos(a2 - a1))
61-
local y = math.sin(a2 - a1) * math.cos(o2)
62-
return math.deg(math.atan2(y, x))
63-
else
64-
--[[ Spherical-Earth math: More accurate but only at extreme distances
65-
return math.acos(math.sin(o1) * math.sin(o2) + math.cos(o1) * math.cos(o2) * math.cos(a2 - a1)) * 6371009;
66-
]]
67-
-- Flat-Earth math
68-
local x = (a2 - a1) * math.cos((o1 + o2) / 2)
69-
local y = o2 - o1
70-
return math.sqrt(x * x + y * y) * 6371009
71-
end
60+
local function calcBearing(gps1, gps2)
61+
--[[ Spherical-Earth math: More accurate if the Earth was a sphere, but obviously it's not
62+
local x = (math.cos(o1) * math.sin(o2)) - (math.sin(o1) * math.cos(o2) * math.cos(a2 - a1))
63+
local y = math.sin(a2 - a1) * math.cos(o2)
64+
return math.deg(math.atan2(y, x))
65+
]]
66+
-- Flat-Earth math
67+
local x = (gps2.lon - gps1.lon) * math.cos(math.rad(gps1.lat))
68+
return math.deg(1.5708 - math.atan2(gps2.lat - gps1.lat, x))
7269
end
7370

7471
local function calcDir(r1, r2, r3, x, y, r)
@@ -82,11 +79,11 @@ local function calcDir(r1, r2, r3, x, y, r)
8279
end
8380

8481
local function background()
85-
data.rssi = getValue(data.rssi_id)
82+
data.rssi, data.rssiLow, data.rssiCrit = getRSSI()
8683
if data.rssi > 0 then
8784
data.telem = true
8885
data.telemFlags = 0
89-
data.rssiMin = getValue(data.rssiMin_id) > 0 and getValue(data.rssiMin_id) or data.rssiMin
86+
data.rssiMin = math.min(data.rssiMin, data.rssi)
9087
data.satellites = getValue(data.sat_id)
9188
if data.showFuel then
9289
data.fuel = getValue(data.fuel_id)
@@ -146,16 +143,8 @@ local function background()
146143
if data.satellites > 1000 and gpsTemp.lat ~= 0 and gpsTemp.lon ~= 0 then
147144
data.gpsFix = true
148145
data.lastLock = gpsTemp
149-
-- Calculate distance to home if sensor is missing or in simlulator
150-
if data.gpsHome ~= false and (data.dist_id == -1 or data.simu) then
151-
data.distance = calcTrig(data.gpsHome, data.gpsLatLon, false)
152-
data.distanceMax = math.max(data.distMaxCalc, data.distance)
153-
data.distMaxCalc = data.distanceMax
154-
-- If distance is in feet, convert
155-
if data.dist_unit == 10 then
156-
data.distance = math.floor(data.distance * 3.28084 + 0.5)
157-
data.distanceMax = data.distanceMax * 3.28084
158-
end
146+
if data.gpsHome ~= false and distCalc ~= nil then
147+
distCalc(data)
159148
end
160149
end
161150
end
@@ -230,6 +219,7 @@ local function background()
230219
data.showMax = false
231220
data.showDir = config[32].v == 1 and true or false
232221
data.configStatus = 0
222+
data.configSelect = 0
233223
if not data.gpsAltBase and data.gpsFix then
234224
data.gpsAltBase = data.gpsAlt
235225
end
@@ -381,7 +371,7 @@ local function background()
381371
-- Initalize variables on flight reset (uses timer3)
382372
tmp = model.getTimer(2)
383373
if tmp.value == 0 then
384-
loadfile(FILE_PATH .. "reset.luac")(data)
374+
loadScript(FILE_PATH .. "reset", env)(data)
385375
tmp.value = 3600
386376
model.setTimer(2, tmp)
387377
end
@@ -431,19 +421,20 @@ local function run(event)
431421
end
432422

433423
-- Display error if Horus widget isn't full screen
434-
if data.widget then
435-
if (iNavZone.zone.w < 450 or iNavZone.zone.h < 250) and data.msg ~= false then
436-
lcd.drawText(iNavZone.zone.x + 14, iNavZone.zone.y + 16, data.msg, SMLSIZE + WARNING_COLOR)
437-
data.startupTime = math.huge -- Never timeout
438-
return 0
439-
end
440-
event = data.armed and 0 or widgetEvt(data)
424+
if data.widget and data.msg ~= false and (iNavZone.zone.w < 450 or iNavZone.zone.h < 250) then
425+
lcd.drawText(iNavZone.zone.x + 14, iNavZone.zone.y + 16, data.msg, SMLSIZE + WARNING_COLOR)
426+
data.startupTime = math.huge -- Never timeout
427+
return 0
441428
end
442429

443430
-- Clear screen
444431
if HORUS then
445432
lcd.setColor(CUSTOM_COLOR, 264) --lcd.RGB(0, 32, 65)
446433
lcd.clear(CUSTOM_COLOR)
434+
-- On Horus use sticks to control the menu
435+
if event == 0 or event == nil then
436+
event = widgetEvt(data)
437+
end
447438
else
448439
lcd.clear()
449440
end
@@ -459,7 +450,7 @@ local function run(event)
459450
if data.v ~= 9 then
460451
view = nil
461452
collectgarbage()
462-
view = loadfile(FILE_PATH .. "menu.luac")()
453+
view = loadScript(FILE_PATH .. "menu", env)()
463454
data.v = 9
464455
end
465456
tmp = config[30].v
@@ -472,6 +463,10 @@ local function run(event)
472463
if data.configStatus == 27 and data.configSelect ~= 0 then
473464
icons.sym(icons.fg)
474465
end
466+
-- Return throttle stick to bottom center
467+
if data.stickMsg ~= nil and not data.armed then
468+
icons.alert()
469+
end
475470
end
476471
else
477472
-- User input
@@ -494,10 +489,10 @@ local function run(event)
494489
if data.v ~= config[25].v then
495490
view = nil
496491
collectgarbage()
497-
view = loadfile(FILE_PATH .. (HORUS and "horus.luac" or (config[25].v == 0 and "view.luac" or (config[25].v == 1 and "pilot.luac" or (config[25].v == 2 and "radar.luac" or "alt.luac")))))()
492+
view = loadScript(FILE_PATH .. (HORUS and "horus" or (config[25].v == 0 and "view" or (config[25].v == 1 and "pilot" or (config[25].v == 2 and "radar" or "alt")))), env)()
498493
data.v = config[25].v
499494
end
500-
view(data, config, modes, units, labels, gpsDegMin, hdopGraph, icons, calcTrig, calcDir, VERSION, SMLCD, FLASH, FILE_PATH)
495+
view(data, config, modes, units, labels, gpsDegMin, hdopGraph, icons, calcBearing, calcDir, VERSION, SMLCD, FLASH, FILE_PATH)
501496
end
502497
collectgarbage()
503498

Diff for: src/iNav/alt.lua

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
local function view(data, config, modes, units, labels, gpsDegMin, hdopGraph, icons, calcTrig, calcDir, VERSION, SMLCD, FLASH, FILE_PATH)
1+
local function view(data, config, modes, units, labels, gpsDegMin, hdopGraph, icons, calcBearing, calcDir, VERSION, SMLCD, FLASH, FILE_PATH)
22

33
local LEFT_DIV = 36
44
local LEFT_POS = SMLCD and LEFT_DIV or 73
@@ -61,15 +61,15 @@ local function view(data, config, modes, units, labels, gpsDegMin, hdopGraph, ic
6161
-- Altitude graph
6262
local BOTTOM = SMLCD and 47 or 63
6363
tmp = (SMLCD and 30 or 40) / (data.altMax - data.altMin)
64-
lcd.drawLine(RIGHT_POS - 60, BOTTOM, RIGHT_POS - 1, BOTTOM, SOLID, FORCE)
64+
lcd.drawLine(RIGHT_POS - 60, BOTTOM, RIGHT_POS - 1, BOTTOM, SOLID, SMLCD and FORCE or GREY_DEFAULT + FORCE)
6565
for i = 1, 60 do
6666
local cx = RIGHT_POS - 61 + i
6767
local cy = math.floor(BOTTOM - (data.alt[((data.altCur - 2 + i) % 60) + 1] - data.altMin) * tmp)
6868
if cy < BOTTOM then
69-
lcd.drawLine(cx, cy, cx, BOTTOM - 1, SOLID, FORCE)
69+
lcd.drawLine(cx, cy, cx, BOTTOM - 1, SOLID, SMLCD and FORCE or GREY_DEFAULT + FORCE)
7070
end
7171
if (i ~= 1 or not SMLCD) and (i - 1) % (60 / config[28].v) == 0 then
72-
lcd.drawLine(cx, BOTTOM - (SMLCD and 30 or 40), cx, BOTTOM, DOTTED, SMLCD and 0 or GREY_DEFAULT)
72+
lcd.drawLine(cx, BOTTOM - (SMLCD and 30 or 40), cx, BOTTOM, DOTTED, 0)
7373
end
7474
end
7575
if data.altMin < -1 then
@@ -82,7 +82,7 @@ local function view(data, config, modes, units, labels, gpsDegMin, hdopGraph, ic
8282

8383
-- Orientation
8484
if not SMLCD and data.telem then
85-
if data.showDir or data.headingRef < 0 then
85+
if data.showDir or data.headingRef == -1 then
8686
lcd.drawText(LEFT_POS + 12, 29, "N", SMLSIZE)
8787
lcd.drawText(LEFT_POS + 25 - (data.heading < 100 and 3 or 0) - (data.heading < 10 and 3 or 0), 57, math.floor(data.heading + 0.5) % 360 .. "\64", SMLSIZE + RIGHT + data.telemFlags)
8888
tmp = data.heading
@@ -150,14 +150,14 @@ local function view(data, config, modes, units, labels, gpsDegMin, hdopGraph, ic
150150
lcd.drawLine(LEFT_DIV, 8, LEFT_DIV, 63, SOLID, FORCE)
151151
tmp = (not data.telem or data.cell < config[3].v or (data.showFuel and config[23].v == 0 and data.fuel <= config[17].v)) and FLASH or 0
152152
if data.showFuel then
153-
if config[23].v == 0 then
153+
if config[23].v > 0 or (data.crsf and data.showMax) then
154+
lcd.drawText(LEFT_DIV, data.showCurr and 8 or 10, (data.crsf and data.fuelRaw or data.fuel), MIDSIZE + RIGHT + tmp)
155+
lcd.drawText(LEFT_DIV, data.showCurr and 20 or 23, data.fUnit[data.crsf and 1 or config[23].v], SMLSIZE + RIGHT + tmp)
156+
else
154157
lcd.drawText(LEFT_DIV - 5, data.showCurr and 8 or 12, data.fuel, DBLSIZE + RIGHT + tmp)
155158
lcd.drawText(LEFT_DIV, data.showCurr and 17 or 21, "%", SMLSIZE + RIGHT + tmp)
156-
else
157-
lcd.drawText(LEFT_DIV, data.showCurr and 8 or 10, data.fuel, MIDSIZE + RIGHT + tmp)
158-
lcd.drawText(LEFT_DIV, data.showCurr and 20 or 23, data.fUnit[config[23].v], SMLSIZE + RIGHT + tmp)
159159
end
160-
end
160+
end
161161
lcd.drawText(LEFT_DIV - 5, data.showCurr and 25 or 32, string.format(config[1].v == 0 and "%.2f" or "%.1f", config[1].v == 0 and (data.showMax and data.cellMin or data.cell) or (data.showMax and data.battMin or data.batt)), DBLSIZE + RIGHT + tmp)
162162
lcd.drawText(LEFT_DIV, data.showCurr and 34 or 41, "V", SMLSIZE + RIGHT + tmp)
163163
if data.showCurr then

0 commit comments

Comments
 (0)