Skip to content

Commit a028b19

Browse files
committed
fix telemetry widget for elrs v4
1 parent 8b0eb7d commit a028b19

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

src/SCRIPTS/ELRS/crsf.lua

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -392,9 +392,6 @@ local function onDeviceInfo(data)
392392
0,
393393
-101,
394394
}
395-
else
396-
info.RFMOD = { "", "25Hz", "50Hz", "100Hz", "150Hz", "200Hz", "250Hz", "500Hz" }
397-
info.RFRSSI = { 0, -123, -115, -117, -112, -112, -108, -105 }
398395
end
399396
end
400397

src/WIDGETS/ELRSTelemetry/loadable.lua

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ function Telemetry.getRangePct(tlm)
110110
if rssi == nil then
111111
return 0
112112
end
113-
local minrssi = (mod.RFRSSI and mod.RFRSSI[(tlm.rfmd or 0) + 1]) or -128
113+
local minrssi = (mod.RFRSSI and tlm.rfmd and mod.RFRSSI[tlm.rfmd + 1]) or -128
114114
if rssi > -50 then
115115
rssi = -50
116116
end
@@ -127,8 +127,11 @@ end
127127

128128
--- Get RF mode string from device info.
129129
function Telemetry.getRfModeStr(rfmd)
130+
if not crsf.rxConnected or rfmd == nil then
131+
return ""
132+
end
130133
local mod = crsf.deviceInfo
131-
return (mod.RFMOD and mod.RFMOD[(rfmd or 0) + 1]) or table.concat({ "RFMD", tostring(rfmd or 0) })
134+
return (mod.RFMOD and mod.RFMOD[rfmd + 1]) or table.concat({ "RFMD", tostring(rfmd) })
132135
end
133136

134137
--- Update GPS cache from telemetry.

0 commit comments

Comments
 (0)