Skip to content

Commit 667132c

Browse files
committed
Use MSP_BUILD_INFO if available (WIP)
1 parent 7a845bc commit 667132c

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

src/SCRIPTS/BF/features_info.lua

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ local MSP_GPS_CONFIG = 135
22
local MSP_VTX_CONFIG = 88
33
local MSP_OSD_CONFIG = 84
44

5+
local MSP_BUILD_INFO = 5
6+
7+
local BUILD_OPTION_GPS = 16412
8+
local BUILD_OPTION_OSD_SD = 16416
9+
local BUILD_OPTION_VTX = 16421
10+
511
local isGpsRead = false
612
local isVtxRead = false
713
local isOsdSDRead = false
@@ -15,10 +21,22 @@ local returnTable = {
1521
t = "",
1622
}
1723

24+
local function processBuildInfoReply(payload)
25+
-- TODO: parse build options
26+
end
27+
1828
local function processMspReply(cmd, payload, err)
1929
isInFlight = false
2030
local isOkay = not err
21-
if cmd == MSP_GPS_CONFIG then
31+
if cmd == MSP_BUILD_INFO then
32+
if not isOkay then
33+
return
34+
end
35+
isGpsRead = true
36+
isVtxRead = true
37+
isOsdSDRead = true
38+
processBuildInfoReply(payload)
39+
elseif cmd == MSP_GPS_CONFIG then
2240
isGpsRead = true
2341
local providerSet = payload[1] ~= 0
2442
features.gps = isOkay and providerSet
@@ -37,7 +55,10 @@ local function updateFeatures()
3755
if lastRunTS + INTERVAL < getTime() then
3856
lastRunTS = getTime()
3957
local cmd
40-
if not isGpsRead then
58+
if apiVersion >= 1.47 then
59+
cmd = MSP_BUILD_INFO
60+
returnTable.t = "Checking options..."
61+
elseif not isGpsRead then
4162
cmd = MSP_GPS_CONFIG
4263
returnTable.t = "Checking GPS..."
4364
elseif not isVtxRead then

0 commit comments

Comments
 (0)