File tree Expand file tree Collapse file tree 2 files changed +23
-8
lines changed Expand file tree Collapse file tree 2 files changed +23
-8
lines changed Original file line number Diff line number Diff line change 11local features = {
2- vtx = true ,
3- gps = true ,
4- osdSD = true ,
2+ vtx = true ,
3+ gps = true ,
4+ osdSD = true ,
5+ blackbox = true ,
56}
67
78return features
Original file line number Diff line number Diff line change 11local MSP_GPS_CONFIG = 135
22local MSP_VTX_CONFIG = 88
33local MSP_OSD_CONFIG = 84
4+
45local MSP_BUILD_INFO = 5
56
67local BUILD_OPTION_GPS = 16412
@@ -21,20 +22,33 @@ local returnTable = {
2122}
2223
2324local function processBuildInfoReply (payload )
24- -- TODO: parse build options
25+ features .gps = false
26+ features .vtx = false
27+ features .osdSD = false
28+ for i = 1 ,# payload ,2 do
29+ local byte1 = payload [i ]
30+ local byte2 = payload [i + 1 ]
31+ local word = bit32.bor (bit32.arshift (byte1 , - 8 ), byte2 )
32+ if word == BUILD_OPTION_GPS then
33+ features .gps = true
34+ elseif word == BUILD_OPTION_OSD_SD then
35+ features .osdSD = true
36+ elseif word == BUILD_OPTION_VTX then
37+ features .vtx = true
38+ end
39+ end
2540end
2641
2742local function processMspReply (cmd , payload , err )
2843 isInFlight = false
2944 local isOkay = not err
3045 if cmd == MSP_BUILD_INFO then
31- if not isOkay then
32- return
33- end
3446 isGpsRead = true
3547 isVtxRead = true
3648 isOsdSDRead = true
37- processBuildInfoReply (payload )
49+ if isOkay then
50+ processBuildInfoReply (payload )
51+ end
3852 elseif cmd == MSP_GPS_CONFIG then
3953 isGpsRead = true
4054 local providerSet = payload [1 ] ~= 0
You can’t perform that action at this time.
0 commit comments