From 5b8891e5c4f1e40a1b51c4f8a0997021685b31e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kiripolszky=20K=C3=A1roly?= Date: Fri, 2 Feb 2024 16:40:35 +0100 Subject: [PATCH] Use MSP_BUILD_INFO if available (WIP) --- src/SCRIPTS/BF/features_info.lua | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/SCRIPTS/BF/features_info.lua b/src/SCRIPTS/BF/features_info.lua index 2cc632f..b807777 100644 --- a/src/SCRIPTS/BF/features_info.lua +++ b/src/SCRIPTS/BF/features_info.lua @@ -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 @@ -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 @@ -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