Skip to content

Commit 5b8891e

Browse files
committed
Use MSP_BUILD_INFO if available (WIP)
1 parent 7a845bc commit 5b8891e

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

src/SCRIPTS/BF/features_info.lua

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
local MSP_GPS_CONFIG = 135
22
local MSP_VTX_CONFIG = 88
33
local MSP_OSD_CONFIG = 84
4+
local MSP_BUILD_INFO = 5
5+
6+
local BUILD_OPTION_GPS = 16412
7+
local BUILD_OPTION_OSD_SD = 16416
8+
local BUILD_OPTION_VTX = 16421
49

510
local isGpsRead = false
611
local isVtxRead = false
@@ -15,10 +20,22 @@ local returnTable = {
1520
t = "",
1621
}
1722

23+
local function processBuildInfoReply(payload)
24+
-- TODO: parse build options
25+
end
26+
1827
local function processMspReply(cmd, payload, err)
1928
isInFlight = false
2029
local isOkay = not err
21-
if cmd == MSP_GPS_CONFIG then
30+
if cmd == MSP_BUILD_INFO then
31+
if not isOkay then
32+
return
33+
end
34+
isGpsRead = true
35+
isVtxRead = true
36+
isOsdSDRead = true
37+
processBuildInfoReply(payload)
38+
elseif cmd == MSP_GPS_CONFIG then
2239
isGpsRead = true
2340
local providerSet = payload[1] ~= 0
2441
features.gps = isOkay and providerSet
@@ -37,7 +54,10 @@ local function updateFeatures()
3754
if lastRunTS + INTERVAL < getTime() then
3855
lastRunTS = getTime()
3956
local cmd
40-
if not isGpsRead then
57+
if apiVersion >= 1.47 then
58+
cmd = MSP_BUILD_INFO
59+
returnTable.t = "Checking options..."
60+
elseif not isGpsRead then
4161
cmd = MSP_GPS_CONFIG
4262
returnTable.t = "Checking GPS..."
4363
elseif not isVtxRead then

0 commit comments

Comments
 (0)