Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/SCRIPTS/CRSFSimulator/csrfsimulator.lua
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ local shim = loadScript("/SCRIPTS/CRSFSimulator/shim.lua")()
-- in minimized widgets, full-screen subtitle updates).
-- "no_module" No CRSF module found at all. Triggers the "No Module
-- Found" error dialog immediately.
-- "old_firmware" TX reports ExpressLRS 3.4.2, below the tool's 3.5.4
-- minimum. Triggers the unsupported-firmware screen
-- instead of the parameter list.
-- "critical_error" TX + RX connected but the module reports a critical
-- error (baud rate too low). Exercises the warning screen
-- and the suppress-critical-errors write (field id 0x2E),
Expand Down Expand Up @@ -498,7 +501,7 @@ local txDevice = {
name = "TX16S MK3",
serialNo = CRSF.ELRS_SERIAL_ID,
hwVer = 0,
swVer = 0x00030500, -- 3.5.0
swVer = config.scenario == "old_firmware" and 0x00030402 or 0x00040100, -- 3.4.2 / 4.1.0
fieldCount = 25, -- total parameter count
params = {
{
Expand Down Expand Up @@ -722,7 +725,7 @@ local rxDevice = {
name = "Bob 2400RX",
serialNo = CRSF.ELRS_SERIAL_ID,
hwVer = 0,
swVer = 0x00030500, -- 3.5.0
swVer = 0x00040100, -- 4.1.0
fieldCount = 25, -- total parameter count
params = {
{
Expand Down
20 changes: 20 additions & 0 deletions src/SCRIPTS/ELRS/crsf_session.lua
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ function CRSFSession.new(opts)
-- Read-and-clear flags for the app
fieldHiddenChanged = nil,
v1Detected = nil,
unsupportedElrs = nil, -- version string of an ELRS TX too old to browse
-- Reassembly state (crsf_params.lua manages it; rx.chunk is readable)
rx = { chunk = 0, expect = -1 },

Expand Down Expand Up @@ -185,6 +186,22 @@ function CRSFSession:_onFrame(command, data)
end
end

-- The one home of the minimum ExpressLRS firmware: 3.5.4. Older modules
-- predate the spec-compliant folders of ExpressLRS #3123 and cannot be
-- browsed, so the session latches .unsupportedElrs instead of loading
-- garbage (Lua-Scripts #11).
local function elrsVersionOk(info)
if info.vMaj >= 4 then
return true
elseif info.vMaj == 3 and info.vMin > 5 then
return true
elseif info.vMaj == 3 and info.vMin == 5 and info.vRev >= 4 then
return true
end

return false
end

function CRSFSession:_onDeviceInfo(data)
local info = crsf:decodeDeviceInfo(data)
if not info then
Expand All @@ -199,6 +216,9 @@ function CRSFSession:_onDeviceInfo(data)
device.name = info.name
device.fieldCount = info.fieldCount
device.isElrs = info.isElrs
if device.isElrs and device.id == crsf.CONST.ADDRESS_TX and not elrsVersionOk(info) then
self.unsupportedElrs = info.vMaj .. "." .. info.vMin .. "." .. info.vRev
end
if self._onDeviceUpdate then
self._onDeviceUpdate(device, isNew)
end
Expand Down
4 changes: 2 additions & 2 deletions src/SCRIPTS/TOOLS/ExpressLRS/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ local function run(event, touchState)
session:drain()
session:tick()

if session.v1Detected then
UI.handleUnsupported()
if session.v1Detected or session.unsupportedElrs then
UI.handleUnsupported(session.unsupportedElrs)
return 0
end

Expand Down
7 changes: 4 additions & 3 deletions src/SCRIPTS/TOOLS/ExpressLRS/ui/lcd.lua
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,11 @@ end
-- Interface: handleUnsupported
-- ============================================================================

function UI.handleUnsupported()
-- oldVersion set means an ELRS module below the minimum; nil means 1.x.
function UI.handleUnsupported(oldVersion)
drawAlert("Unsupported Firmware", {
"ELRS 1.x firmware detected.",
"Please update to 3.x.",
oldVersion and ("ELRS " .. oldVersion .. " detected.") or "ELRS 1.x firmware detected.",
oldVersion and "Requires 3.5.4 or later." or "Please update to 3.x.",
})
end

Expand Down
6 changes: 4 additions & 2 deletions src/SCRIPTS/TOOLS/ExpressLRS/ui/lvgl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -367,11 +367,13 @@ end
-- Interface: handleUnsupported
-- ============================================================================

function UI.handleUnsupported()
-- oldVersion set means an ELRS module below the minimum; nil means 1.x.
function UI.handleUnsupported(oldVersion)
if not UI.uiBuilt then
Dialogs.showMessage({
title = "Unsupported Firmware",
message = "ELRS 1.x firmware detected. Please update to 3.x.",
message = oldVersion and ("ELRS " .. oldVersion .. " detected. Requires 3.5.4 or later.")
or "ELRS 1.x firmware detected. Please update to 3.x.",
})
UI.uiBuilt = true
end
Expand Down