Skip to content

Commit

Permalink
Test only USE_OSD
Browse files Browse the repository at this point in the history
  • Loading branch information
atomgomba committed Feb 10, 2024
1 parent 3e35b9d commit a97034e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions src/SCRIPTS/BF/features.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
local features = {
vtx = true,
gps = true,
osdSD = true,
vtx = true,
gps = true,
osd = true,
}

return features
24 changes: 12 additions & 12 deletions src/SCRIPTS/BF/features_info.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ local MSP_OSD_CONFIG = 84

local MSP_RADIO_SETUP = 69

local BUILD_OPTION_VTX = bit32.lshift(1, 0)
local BUILD_OPTION_GPS = bit32.lshift(1, 1)
local BUILD_OPTION_OSD_SD = bit32.lshift(1, 2)
local BUILD_OPTION_VTX = bit32.lshift(1, 0)
local BUILD_OPTION_GPS = bit32.lshift(1, 1)
local BUILD_OPTION_OSD = bit32.lshift(1, 2)

local isVtxRead = false
local isGpsRead = false
local isOsdSDRead = false
local isOsdRead = false

local lastRunTS = 0
local INTERVAL = 100
Expand All @@ -24,11 +24,11 @@ local returnTable = {
local function processRadioSetupReply(payload)
isVtxRead = true
isGpsRead = true
isOsdSDRead = true
isOsdRead = true

features.vtx = bit32.band(payload[1], BUILD_OPTION_VTX) ~= 0
features.gps = bit32.band(payload[1], BUILD_OPTION_GPS) ~= 0
features.osdSD = bit32.band(payload[1], BUILD_OPTION_OSD_SD) ~= 0
features.osd = bit32.band(payload[1], BUILD_OPTION_OSD) ~= 0
end

local function processMspReply(cmd, payload, err)
Expand All @@ -47,9 +47,9 @@ local function processMspReply(cmd, payload, err)
local providerSet = payload[1] ~= 0
features.gps = isOkay and providerSet
elseif cmd == MSP_OSD_CONFIG then
isOsdSDRead = true
local osdSDAvailable = payload[1] ~= 0
features.osdSD = isOkay and osdSDAvailable
isOsdRead = true
local osdAvailable = payload[1] ~= 0
features.osd = isOkay and osdAvailable
end
end

Expand All @@ -66,9 +66,9 @@ local function updateFeatures()
elseif not isGpsRead then
cmd = MSP_GPS_CONFIG
returnTable.t = "Checking GPS..."
elseif not isOsdSDRead then
elseif not isOsdRead then
cmd = MSP_OSD_CONFIG
returnTable.t = "Checking OSD (SD)..."
returnTable.t = "Checking OSD..."
end
if cmd and not isInFlight then
protocol.mspRead(cmd)
Expand All @@ -77,7 +77,7 @@ local function updateFeatures()
end
mspProcessTxQ()
processMspReply(mspPollReply())
return isVtxRead and isGpsRead and isOsdSDRead
return isVtxRead and isGpsRead and isOsdRead
end

returnTable.f = updateFeatures
Expand Down
2 changes: 1 addition & 1 deletion src/SCRIPTS/BF/pages.lua
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ if apiVersion >= 1.16 then
PageFiles[#PageFiles + 1] = { title = "Trim Accelerometer", script = "acc_trim.lua" }
end

if apiVersion >= 1.45 and features.osdSD then
if apiVersion >= 1.45 and features.osd then
PageFiles[#PageFiles + 1] = { title = "OSD Elements", script = "pos_osd.lua" }
end

Expand Down

0 comments on commit a97034e

Please sign in to comment.