Skip to content

Commit

Permalink
Hide OSD (SD) settings
Browse files Browse the repository at this point in the history
  • Loading branch information
atomgomba committed Jan 24, 2024
1 parent 571dfd5 commit 7b5f4b4
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
6 changes: 2 additions & 4 deletions src/SCRIPTS/BF/PAGES/pos_osd.lua
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
local template = assert(loadScript(radio.template))()
local margin = template.margin
local indent = template.indent
local lineSpacing = template.lineSpacing
local tableSpacing = template.tableSpacing
local sp = template.listSpacing.field
local yMinLim = radio.yMinLimit
local x = margin
local y = yMinLim - lineSpacing
Expand Down Expand Up @@ -133,12 +131,12 @@ return {
self.values[3] = bit32.rshift(combineValue, 8)
return self.values
end,
checkProfile = function(self, value, profileFirst, profileSecond, profileThird)
checkProfile = function(_, value, profileFirst, profileSecond, profileThird)
local profiles = profileFirst + bit32.lshift(profileSecond, 1) + bit32.lshift(profileThird, 2)
local output = bit32.replace(value, profiles, 11, 3)
return output
end,
splitVal = function(self, inputFirstVal, inputSecondVal)
splitVal = function(_, inputFirstVal, inputSecondVal)
local inputVal = inputFirstVal + bit32.lshift(inputSecondVal, 8)
local profiles = bit32.extract(inputVal, 11, 3)
local fieldPos = bit32.extract(inputVal, 0, 11)
Expand Down
5 changes: 3 additions & 2 deletions src/SCRIPTS/BF/features.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
local features = {
vtx = true,
gps = true,
vtx = true,
gps = true,
osdSD = true,
}

return features
13 changes: 10 additions & 3 deletions src/SCRIPTS/BF/features_info.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
local MSP_GPS_CONFIG = 135
local MSP_VTX_CONFIG = 88
local MSP_OSD_CONFIG = 84

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

local lastRunTS = 0
local INTERVAL = 100
Expand All @@ -22,6 +24,10 @@ local function processMspReply(cmd, payload, err)
isVtxRead = true
local vtxTableAvailable = payload[12] ~= 0
features.vtx = isOkay and vtxTableAvailable
elseif cmd == MSP_OSD_CONFIG then
isOsdSDRead = true
local osdSDAvailable = payload[1] ~= 0
features.osdSD = isOkay and osdSDAvailable
end
end

Expand All @@ -35,16 +41,17 @@ local function updateFeatures()
elseif not isVtxRead then
cmd = MSP_VTX_CONFIG
returnTable.t = "Checking VTX..."
elseif not isOsdSDRead then
cmd = MSP_OSD_CONFIG
returnTable.t = "Checking OSD (SD)..."
end
if cmd then
protocol.mspRead(cmd)
else
return true
end
end
mspProcessTxQ()
processMspReply(mspPollReply())
return false
return isGpsRead and isVtxRead and isOsdSDRead
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 then
if apiVersion >= 1.45 and features.osdSD then
PageFiles[#PageFiles + 1] = { title = "OSD Elements", script = "pos_osd.lua" }
end

Expand Down

0 comments on commit 7b5f4b4

Please sign in to comment.