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 1
1
local features = {
2
- vtx = true ,
3
- gps = true ,
4
- osdSD = true ,
2
+ vtx = true ,
3
+ gps = true ,
4
+ osdSD = true ,
5
+ blackbox = true ,
5
6
}
6
7
7
8
return features
Original file line number Diff line number Diff line change 1
1
local MSP_GPS_CONFIG = 135
2
2
local MSP_VTX_CONFIG = 88
3
3
local MSP_OSD_CONFIG = 84
4
+
4
5
local MSP_BUILD_INFO = 5
5
6
6
7
local BUILD_OPTION_GPS = 16412
@@ -21,20 +22,33 @@ local returnTable = {
21
22
}
22
23
23
24
local 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
25
40
end
26
41
27
42
local function processMspReply (cmd , payload , err )
28
43
isInFlight = false
29
44
local isOkay = not err
30
45
if cmd == MSP_BUILD_INFO then
31
- if not isOkay then
32
- return
33
- end
34
46
isGpsRead = true
35
47
isVtxRead = true
36
48
isOsdSDRead = true
37
- processBuildInfoReply (payload )
49
+ if isOkay then
50
+ processBuildInfoReply (payload )
51
+ end
38
52
elseif cmd == MSP_GPS_CONFIG then
39
53
isGpsRead = true
40
54
local providerSet = payload [1 ] ~= 0
You can’t perform that action at this time.
0 commit comments