Skip to content

Commit 8040967

Browse files
committed
Added RSSI/LQ
1 parent 116b163 commit 8040967

2 files changed

Lines changed: 9 additions & 8 deletions

File tree

644 Bytes
Binary file not shown.

src/iNav/nirvana.lua

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ local function view(data, config, modes, units, labels, gpsDegMin, hdopGraph, ic
351351
end
352352
end
353353

354-
--[[ Variometer - Test with multi-protocol TX module and SBUS RX
354+
--[[ Variometer
355355
if config[7].v % 2 == 1 then
356356
color(CUSTOM_COLOR, DKGREY)
357357
fill(RIGHT_POS, TOP, 10, BOTTOM - 20, CUSTOM_COLOR)
@@ -373,20 +373,21 @@ local function view(data, config, modes, units, labels, gpsDegMin, hdopGraph, ic
373373
end
374374
]]
375375

376-
--[[ RSSI
376+
-- RSSI/LQ
377377
tmp = (not data.telem or data.rssi < data.rssiLow) and FLASH or 0
378-
val = data.showMax and data.rssiMin or data.rssiLast
379-
text(X1 - 3, TOP + 84, val .. (data.crsf and "%" or "dB"), MIDSIZE + RIGHT + tmp)
380-
text(0, TOP + 93, data.crsf and "LQ" or "RSSI", SMLSIZE)
378+
local val = data.showMax and data.rssiMin or data.rssiLast
379+
text(LCD_W + 1, BOTTOM - 19, val .. (data.crsf and "%" or "dB"), RIGHT + tmp)
380+
text(LCD_W - 43, TOP, data.crsf and " LQ" or "RSSI", SMLSIZE)
381381
if data.rl ~= val then
382382
local red = val >= data.rssiLow and max(floor((100 - val) / (100 - data.rssiLow) * 255), 0) or 255
383383
local green = val < data.rssiLow and max(floor((val - data.rssiCrit) / (data.rssiLow - data.rssiCrit) * 255), 0) or 255
384384
data.rc = rgb(red, green, 60)
385385
data.rl = val
386386
end
387387
color(CUSTOM_COLOR, data.rc)
388-
lcd.drawGauge(0, TOP + 110, X1 - 3, 15, min(val, 99), 100, CUSTOM_COLOR)
389-
]]
388+
rect(LCD_W - 32, TOP + 20, 15, 88, CUSTOM_COLOR)
389+
local h = math.floor(max(1, (min(val, 100) * 0.01) * 86))
390+
fill(LCD_W - 31, TOP + 107 - h, 13, h, CUSTOM_COLOR)
390391

391392
-- Calc orientation
392393
tmp = data.headingRef
@@ -521,7 +522,7 @@ local function view(data, config, modes, units, labels, gpsDegMin, hdopGraph, ic
521522

522523
bleft = 170
523524
bright = LCD_W - 1
524-
local val = math.floor((data.showMax and data.cellMin or data.cell) * 100 + 0.5) * 0.01
525+
val = math.floor((data.showMax and data.cellMin or data.cell) * 100 + 0.5) * 0.01
525526
text(bright, btop, frmt(config[1].v == 0 and "%.2fV" or "%.1fV", config[1].v == 0 and val or (data.showMax and data.battMin or data.batt)), MIDSIZE + RIGHT + tmp)
526527
text(bleft, btop + 9, labels[2], SMLSIZE)
527528
if data.bl ~= val then

0 commit comments

Comments
 (0)