Skip to content

Commit

Permalink
Use MSP_BUILD_INFO if available (WIP)
Browse files Browse the repository at this point in the history
  • Loading branch information
atomgomba committed Feb 2, 2024
1 parent 7a845bc commit 5b8891e
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions src/SCRIPTS/BF/features_info.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
local MSP_GPS_CONFIG = 135
local MSP_VTX_CONFIG = 88
local MSP_OSD_CONFIG = 84
local MSP_BUILD_INFO = 5

local BUILD_OPTION_GPS = 16412
local BUILD_OPTION_OSD_SD = 16416
local BUILD_OPTION_VTX = 16421

local isGpsRead = false
local isVtxRead = false
Expand All @@ -15,10 +20,22 @@ local returnTable = {
t = "",
}

local function processBuildInfoReply(payload)
-- TODO: parse build options
end

local function processMspReply(cmd, payload, err)
isInFlight = false
local isOkay = not err
if cmd == MSP_GPS_CONFIG then
if cmd == MSP_BUILD_INFO then
if not isOkay then
return
end
isGpsRead = true
isVtxRead = true
isOsdSDRead = true
processBuildInfoReply(payload)
elseif cmd == MSP_GPS_CONFIG then
isGpsRead = true
local providerSet = payload[1] ~= 0
features.gps = isOkay and providerSet
Expand All @@ -37,7 +54,10 @@ local function updateFeatures()
if lastRunTS + INTERVAL < getTime() then
lastRunTS = getTime()
local cmd
if not isGpsRead then
if apiVersion >= 1.47 then
cmd = MSP_BUILD_INFO
returnTable.t = "Checking options..."
elseif not isGpsRead then
cmd = MSP_GPS_CONFIG
returnTable.t = "Checking GPS..."
elseif not isVtxRead then
Expand Down

0 comments on commit 5b8891e

Please sign in to comment.