diff --git a/src/SCRIPTS/BF/PAGES/pos_osd.lua b/src/SCRIPTS/BF/PAGES/pos_osd.lua index 3417ac2..2e5c262 100644 --- a/src/SCRIPTS/BF/PAGES/pos_osd.lua +++ b/src/SCRIPTS/BF/PAGES/pos_osd.lua @@ -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 @@ -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) diff --git a/src/SCRIPTS/BF/features.lua b/src/SCRIPTS/BF/features.lua index 383252a..a92f1fd 100644 --- a/src/SCRIPTS/BF/features.lua +++ b/src/SCRIPTS/BF/features.lua @@ -1,6 +1,7 @@ local features = { - vtx = true, - gps = true, + vtx = true, + gps = true, + osdSD = true, } return features diff --git a/src/SCRIPTS/BF/features_info.lua b/src/SCRIPTS/BF/features_info.lua index d37e21d..9a23a29 100644 --- a/src/SCRIPTS/BF/features_info.lua +++ b/src/SCRIPTS/BF/features_info.lua @@ -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 @@ -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 @@ -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 diff --git a/src/SCRIPTS/BF/pages.lua b/src/SCRIPTS/BF/pages.lua index 63c4b23..41b16a8 100644 --- a/src/SCRIPTS/BF/pages.lua +++ b/src/SCRIPTS/BF/pages.lua @@ -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