Skip to content

Commit 84763a2

Browse files
committed
Hide OSD (SD) settings
1 parent 569e409 commit 84763a2

File tree

4 files changed

+16
-10
lines changed

4 files changed

+16
-10
lines changed

src/SCRIPTS/BF/PAGES/pos_osd.lua

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
local template = assert(loadScript(radio.template))()
22
local margin = template.margin
3-
local indent = template.indent
43
local lineSpacing = template.lineSpacing
54
local tableSpacing = template.tableSpacing
6-
local sp = template.listSpacing.field
75
local yMinLim = radio.yMinLimit
86
local x = margin
97
local y = yMinLim - lineSpacing
@@ -133,12 +131,12 @@ return {
133131
self.values[3] = bit32.rshift(combineValue, 8)
134132
return self.values
135133
end,
136-
checkProfile = function(self, value, profileFirst, profileSecond, profileThird)
134+
checkProfile = function(_, value, profileFirst, profileSecond, profileThird)
137135
local profiles = profileFirst + bit32.lshift(profileSecond, 1) + bit32.lshift(profileThird, 2)
138136
local output = bit32.replace(value, profiles, 11, 3)
139137
return output
140138
end,
141-
splitVal = function(self, inputFirstVal, inputSecondVal)
139+
splitVal = function(_, inputFirstVal, inputSecondVal)
142140
local inputVal = inputFirstVal + bit32.lshift(inputSecondVal, 8)
143141
local profiles = bit32.extract(inputVal, 11, 3)
144142
local fieldPos = bit32.extract(inputVal, 0, 11)

src/SCRIPTS/BF/features.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
local features = {
2-
vtx = true,
3-
gps = true,
2+
vtx = true,
3+
gps = true,
4+
osdSD = true,
45
}
56

67
return features

src/SCRIPTS/BF/features_info.lua

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
local MSP_GPS_CONFIG = 135
22
local MSP_VTX_CONFIG = 88
3+
local MSP_OSD_CONFIG = 84
34

45
local isGpsRead = false
56
local isVtxRead = false
7+
local isOsdSDRead = false
68

79
local lastRunTS = 0
810
local INTERVAL = 100
@@ -22,6 +24,10 @@ local function processMspReply(cmd, payload, err)
2224
isVtxRead = true
2325
local vtxTableAvailable = payload[12] ~= 0
2426
features.vtx = isOkay and vtxTableAvailable
27+
elseif cmd == MSP_OSD_CONFIG then
28+
isOsdSDRead = true
29+
local osdSDAvailable = payload[1] ~= 0
30+
features.osdSD = isOkay and osdSDAvailable
2531
end
2632
end
2733

@@ -35,16 +41,17 @@ local function updateFeatures()
3541
elseif not isVtxRead then
3642
cmd = MSP_VTX_CONFIG
3743
returnTable.t = "Checking VTX..."
44+
elseif not isOsdSDRead then
45+
cmd = MSP_OSD_CONFIG
46+
returnTable.t = "Checking OSD (SD)..."
3847
end
3948
if cmd then
4049
protocol.mspRead(cmd)
41-
else
42-
return true
4350
end
4451
end
4552
mspProcessTxQ()
4653
processMspReply(mspPollReply())
47-
return false
54+
return isGpsRead and isVtxRead and isOsdSDRead
4855
end
4956

5057
returnTable.f = updateFeatures

src/SCRIPTS/BF/pages.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ if apiVersion >= 1.16 then
6060
PageFiles[#PageFiles + 1] = { title = "Trim Accelerometer", script = "acc_trim.lua" }
6161
end
6262

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

0 commit comments

Comments
 (0)