Skip to content

Commit 448ff48

Browse files
committed
replace legacy escaped characters for EdgeTX (and OpenTX)
1 parent f8d010b commit 448ff48

File tree

5 files changed

+33
-16
lines changed

5 files changed

+33
-16
lines changed

src/SCRIPTS/TELEMETRY/iNav/alt.lua

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ local function view(data, config, modes, dir, units, labels, gpsDegMin, hdopGrap
66
local FLASH = 3 -- legacy value
77
local gpsFlags = SMLSIZE + RIGHT + ((not data.telem or not data.gpsFix) and FLASH or 0)
88
local tmp, pitch
9+
local SHOWMAX = data.etx and CHAR_UP or "\192"
10+
local DEGSYM = data.etx and "°" or "@"
911

1012
-- Startup message
1113
if data.startup == 2 then
@@ -55,7 +57,7 @@ local function view(data, config, modes, dir, units, labels, gpsDegMin, hdopGrap
5557
end
5658
-- Min/Max
5759
if not data.showDir and data.showMax then
58-
text(RIGHT_POS, 9, "\192", SMLSIZE + RIGHT)
60+
text(RIGHT_POS, 9, SHOWMAX, SMLSIZE + RIGHT)
5961
end
6062

6163
if data.startup == 0 then
@@ -85,7 +87,7 @@ local function view(data, config, modes, dir, units, labels, gpsDegMin, hdopGrap
8587
if not SMLCD and data.telem then
8688
if data.showDir or data.headingRef == -1 then
8789
text(LEFT_POS + 12, 29, dir[0], SMLSIZE)
88-
text(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 + telemFlag)
90+
text(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 .. DEGSYM, SMLSIZE + RIGHT + telemFlag)
8991
tmp = data.heading
9092
else
9193
tmp = data.heading - data.headingRef
@@ -191,7 +193,7 @@ end
191193
--Pitch
192194
line(LEFT_DIV, 50, LEFT_POS, 50, SOLID, FORCE)
193195
text(LEFT_DIV + 5, 54, pitch > 0 and "\194" or (pitch == 0 and "->" or "\195"), SMLSIZE)
194-
text(LEFT_POS, 53, "\64", SMLSIZE + RIGHT + telemFlag)
196+
text(LEFT_POS, 53, DEGSYM, SMLSIZE + RIGHT + telemFlag)
195197
text(LEFT_POS - 4, 52, pitch, MIDSIZE + RIGHT + telemFlag)
196198
end
197199
end

src/SCRIPTS/TELEMETRY/iNav/func_t.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,9 @@ local function title()
5656
end
5757

5858
local function gpsDegMin(c, lat)
59-
local gpsD = math.floor(math.abs(c))
60-
return gpsD .. frmt("\64%05.2f", (math.abs(c) - gpsD) * 60) .. (lat and (c >= 0 and dir[0] or dir[4]) or (c >= 0 and dir[2] or dir[6]))
59+
local DEGSYM = data.etx and "°" or "@"
60+
local gpsD = math.floor(math.abs(c))
61+
return gpsD .. frmt(DEGSYM .. "%05.2f", (math.abs(c) - gpsD) * 60) .. (lat and (c >= 0 and dir[0] or dir[4]) or (c >= 0 and dir[2] or dir[6]))
6162
end
6263

6364
local function hdopGraph(x, y, s, SMLCD)

src/SCRIPTS/TELEMETRY/iNav/pilot.lua

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ local function view(data, config, modes, dir, units, labels, gpsDegMin, hdopGrap
88
local FLASH = 3 -- legacy value
99
local gpsFlags = SMLSIZE + RIGHT + ((not data.telem or not data.gpsFix) and FLASH or 0)
1010
local tmp, pitch, roll, roll1, upsideDown
11+
local DEGSYM = data.etx and "°" or "@"
12+
local SHOWMAX = data.etx and CHAR_UP or "\192"
13+
local SHOWMIN = data.etx and CHAR_DOWN or "\193"
1114

1215
local function pitchLadder(r, adj)
1316
--[[ Caged mode
@@ -109,7 +112,7 @@ local function view(data, config, modes, dir, units, labels, gpsDegMin, hdopGrap
109112
end
110113
if not data.showMax then
111114
tmp2 = tmp >= 0 and (tmp < 1 and 0 or math.floor(tmp + 0.5)) or (tmp > -1 and 0 or math.ceil(tmp - 0.5))
112-
text(X_CNTR - (SMLCD and 14 or 24), 33, math.abs(tmp2) .. (SMLCD and "" or "\64"), SMLSIZE + RIGHT)
115+
text(X_CNTR - (SMLCD and 14 or 24), 33, math.abs(tmp2) .. (SMLCD and "" or DEGSYM), SMLSIZE + RIGHT)
113116
end
114117
end
115118

@@ -129,8 +132,8 @@ local function view(data, config, modes, dir, units, labels, gpsDegMin, hdopGrap
129132
icons.home(home, tmp)
130133
end
131134
elseif data.showMax then
132-
text(LEFT_POS + 21, 33, "\192", SMLSIZE)
133-
text(RIGHT_POS - 22, 33, "\192", SMLSIZE + RIGHT)
135+
text(LEFT_POS + 21, 33, SHOWMAX, SMLSIZE)
136+
text(RIGHT_POS - 22, 33, SHOWMAX, SMLSIZE + RIGHT)
134137
end
135138

136139
-- Heading part 1
@@ -262,7 +265,7 @@ local function view(data, config, modes, dir, units, labels, gpsDegMin, hdopGrap
262265
line(X_CNTR - 9, 56, X_CNTR + 10, 56, SOLID, ERASE)
263266
line(X_CNTR - 10, 56, X_CNTR - 10, 63, SOLID, ERASE)
264267
text(X_CNTR - 9, 57, " ", SMLSIZE + telemFlag)
265-
text(X_CNTR + 11, 57, math.floor(data.heading + 0.5) % 360 .. "\64", SMLSIZE + RIGHT + telemFlag)
268+
text(X_CNTR + 11, 57, math.floor(data.heading + 0.5) % 360 .. DEGSYM, SMLSIZE + RIGHT + telemFlag)
266269
if not SMLCD then
267270
lcd.drawRectangle(X_CNTR - 11, 55, 23, 10, FORCE)
268271
end

src/SCRIPTS/TELEMETRY/iNav/radar.lua

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ local function view(data, config, modes, dir, units, labels, gpsDegMin, hdopGrap
77
local X_CNTR = (RIGHT_POS + LEFT_POS) * 0.5 - 1
88
local gpsFlags = SMLSIZE + RIGHT + ((not data.telem or not data.gpsFix) and FLASH or 0)
99
local tmp, pitch
10+
local DEGSYM = data.etx and "°" or "@"
11+
local SHOWMAX = data.etx and CHAR_UP or "\192"
12+
local SHOWMIN = data.etx and CHAR_DOWN or "\193"
13+
14+
-- May not be right ....
15+
local SHOWLEFT = data.etx and CHAR_LEFT or "\194"
16+
local SHOWRIGHT = data.etx and CHAR_RIGHT or "\195"
1017

1118
-- Startup message
1219
if data.startup == 2 then
@@ -51,18 +58,18 @@ local function view(data, config, modes, dir, units, labels, gpsDegMin, hdopGrap
5158
end
5259
-- Pitch
5360
if data.startup == 0 then
54-
text(LEFT_POS + 15, 17, pitch .. (math.abs(pitch) < 10 and "\64" or ""), SMLSIZE + RIGHT + telemFlag)
61+
text(LEFT_POS + 15, 17, pitch .. (math.abs(pitch) < 10 and DEGSYM or ""), SMLSIZE + RIGHT + telemFlag)
5562
line(LEFT_POS + 1, 17, LEFT_POS + 1, 24, SOLID, ERASE)
5663
else
5764
text(LEFT_POS + 2, 17, "Ptch", SMLSIZE)
5865
end
5966
elseif data.showDir or data.headingRef == -1 then
6067
-- Heading
61-
text(X_CNTR + 14 - (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 + telemFlag)
68+
text(X_CNTR + 14 - (data.heading < 100 and 3 or 0) - (data.heading < 10 and 3 or 0), 57, math.floor(data.heading + 0.5) % 360 .. DEGSYM, SMLSIZE + RIGHT + telemFlag)
6269
end
6370
-- Min/Max
6471
if not data.showDir and data.showMax then
65-
text(RIGHT_POS, 9, "\192", SMLSIZE + RIGHT)
72+
text(RIGHT_POS, 9, SHOWMAX, SMLSIZE + RIGHT)
6673
end
6774

6875
-- Radar
@@ -204,8 +211,8 @@ local function view(data, config, modes, dir, units, labels, gpsDegMin, hdopGrap
204211
text(LEFT_POS - tmp2, 37, tmp < 1000 and math.floor(tmp + 0.5) or frmt("%.1f", tmp / (data.dist_unit == 9 and 1000 or 5280)), MIDSIZE + RIGHT + telemFlag)
205212
--Pitch
206213
line(LEFT_DIV, 50, LEFT_POS, 50, SOLID, FORCE)
207-
text(LEFT_DIV + 5, 54, pitch > 0 and "\194" or (pitch == 0 and "->" or "\195"), SMLSIZE)
208-
text(LEFT_POS, 53, "\64", SMLSIZE + RIGHT + telemFlag)
214+
text(LEFT_DIV + 5, 54, pitch > 0 and SHOWLEFT or (pitch == 0 and "->" or SHOWRIGHT), SMLSIZE)
215+
text(LEFT_POS, 53, DEGSYM, SMLSIZE + RIGHT + telemFlag)
209216
text(LEFT_POS - 4, 52, pitch, MIDSIZE + RIGHT + telemFlag)
210217
end
211218
end

src/SCRIPTS/TELEMETRY/iNav/view.lua

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ local function view(data, config, modes, dir, units, labels, gpsDegMin, hdopGrap
66
local X_CNTR_2 = SMLCD and 63 or 104
77
local tmp
88
local FLASH = 3 -- legacy constant (wtf??)
9+
local SHOWMAX = data.etx and CHAR_UP or "\192"
10+
local SHOWMIN = data.etx and CHAR_DOWN or "\193"
11+
local DEGSYM = data.etx and "°" or "@"
12+
913
local function drawDirection(h, w, r, x, y)
1014
local r1 = math.rad(h)
1115
local r2 = math.rad(h + w)
@@ -24,7 +28,7 @@ local function view(data, config, modes, dir, units, labels, gpsDegMin, hdopGrap
2428
if data.showMax and d > 0 then
2529
vc = vm
2630
text(0, y, string.sub(txt, 1, 3), SMLSIZE)
27-
text(15, y, d == 1 and "\192" or "\193", SMLSIZE)
31+
text(15, y, d == 1 and SHOWMAX or SHOWMIN, SMLSIZE)
2832
else
2933
text(0, y, txt, SMLSIZE)
3034
end
@@ -64,7 +68,7 @@ local function view(data, config, modes, dir, units, labels, gpsDegMin, hdopGrap
6468
if data.telem then
6569
local indicatorDisplayed = false
6670
if data.showDir or data.headingRef == -1 or not SMLCD then
67-
text(X_CNTR_1 - 2, 9, dir[0] .. " " .. math.floor(data.heading + 0.5) % 360 .. "\64", SMLSIZE)
71+
text(X_CNTR_1 - 2, 9, dir[0] .. " " .. math.floor(data.heading + 0.5) % 360 .. DEGSYM, SMLSIZE)
6872
text(X_CNTR_1 + 10, 21, dir[2], SMLSIZE)
6973
text(X_CNTR_1 - 14, 21, dir[6], SMLSIZE)
7074
if not SMLCD then

0 commit comments

Comments
 (0)