File tree Expand file tree Collapse file tree 10 files changed +27
-24
lines changed Expand file tree Collapse file tree 10 files changed +27
-24
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ local MSP_STARTFLAG = bit32.lshift(1,4)
6
6
local mspSeq = 0
7
7
local mspRemoteSeq = 0
8
8
local mspRxBuf = {}
9
+ local mspRxError = false
9
10
local mspRxSize = 0
10
11
local mspRxCRC = 0
11
12
local mspRxReq = 0
65
66
function mspReceivedReply (payload )
66
67
local idx = 1
67
68
local status = payload [idx ]
68
- local err = bit32.btest (status , 0x80 )
69
69
local version = bit32.rshift (bit32.band (status , 0x60 ), 5 )
70
70
local start = bit32.btest (status , 0x10 )
71
71
local seq = bit32.band (status , 0x0F )
72
72
idx = idx + 1
73
- if err then
74
- mspStarted = false
75
- return nil
76
- end
77
73
if start then
78
74
mspRxBuf = {}
75
+ mspRxError = bit32.btest (status , 0x80 )
79
76
mspRxSize = payload [idx ]
80
77
mspRxReq = mspLastReq
81
78
idx = idx + 1
@@ -117,7 +114,7 @@ function mspPollReply()
117
114
return nil
118
115
elseif mspReceivedReply (mspData ) then
119
116
mspLastReq = 0
120
- return mspRxReq , mspRxBuf
117
+ return mspRxReq , mspRxBuf , mspRxError
121
118
end
122
119
end
123
120
end
Original file line number Diff line number Diff line change @@ -12,8 +12,9 @@ local labels = {}
12
12
local fields = {}
13
13
14
14
local vtx_tables
15
- if apiVersion >= 1.42 then
16
- vtx_tables = assert (loadScript (" VTX_TABLES/" .. mcuId .. " .lua" ))()
15
+ local f = loadScript (" VTX_TABLES/" .. mcuId .. " .lua" )
16
+ if apiVersion >= 1.42 and f then
17
+ vtx_tables = f ()
17
18
else
18
19
vtx_tables = assert (loadScript (" VTX_TABLES/vtx_defaults.lua" ))()
19
20
end
Original file line number Diff line number Diff line change @@ -3,8 +3,8 @@ local accCalibrated = false
3
3
local lastRunTS = 0
4
4
local INTERVAL = 500
5
5
6
- local function processMspReply (cmd ,rx_buf )
7
- if cmd == MSP_ACC_CALIBRATION then
6
+ local function processMspReply (cmd ,rx_buf , err )
7
+ if cmd == MSP_ACC_CALIBRATION and not err then
8
8
accCalibrated = true
9
9
end
10
10
end
Original file line number Diff line number Diff line change @@ -4,8 +4,8 @@ local apiVersionReceived = false
4
4
local lastRunTS = 0
5
5
local INTERVAL = 50
6
6
7
- local function processMspReply (cmd ,rx_buf )
8
- if cmd == MSP_API_VERSION and # rx_buf >= 3 then
7
+ local function processMspReply (cmd ,rx_buf , err )
8
+ if cmd == MSP_API_VERSION and # rx_buf >= 3 and not err then
9
9
apiVersion = rx_buf [2 ] + rx_buf [3 ] / 100
10
10
apiVersionReceived = true
11
11
end
Original file line number Diff line number Diff line change @@ -20,8 +20,8 @@ local i2cRegisteredDeviceCount = 0
20
20
local lastRunTS = 0
21
21
local INTERVAL = 100
22
22
23
- local function processMspReply (cmd , payload )
24
- if cmd == MSP_BOARD_INFO then
23
+ local function processMspReply (cmd , payload , err )
24
+ if cmd == MSP_BOARD_INFO and not err then
25
25
local length
26
26
local i = 1
27
27
length = 4
Original file line number Diff line number Diff line change @@ -5,8 +5,8 @@ local MCUIdReceived = false
5
5
local lastRunTS = 0
6
6
local INTERVAL = 100
7
7
8
- local function processMspReply (cmd , payload )
9
- if cmd == MSP_UID then
8
+ local function processMspReply (cmd , payload , err )
9
+ if cmd == MSP_UID and not err then
10
10
local i = 1
11
11
local id = " "
12
12
for j = 1 , 3 do
Original file line number Diff line number Diff line change @@ -9,8 +9,8 @@ local rssiSource = RSSI_SOURCE_NONE
9
9
local lastRunTS = 0
10
10
local INTERVAL = 50
11
11
12
- local function processMspReply (cmd ,rx_buf )
13
- if cmd == MSP_TX_INFO and # rx_buf >= 1 then
12
+ local function processMspReply (cmd ,rx_buf , err )
13
+ if cmd == MSP_TX_INFO and # rx_buf >= 1 and not err then
14
14
rssiSource = rx_buf [1 ]
15
15
rssiSourceReceived = true
16
16
end
Original file line number Diff line number Diff line change @@ -4,8 +4,8 @@ local timeIsSet = false
4
4
local lastRunTS = 0
5
5
local INTERVAL = 50
6
6
7
- local function processMspReply (cmd ,rx_buf )
8
- if cmd == MSP_SET_RTC then
7
+ local function processMspReply (cmd ,rx_buf , err )
8
+ if cmd == MSP_SET_RTC and not err then
9
9
timeIsSet = true
10
10
end
11
11
end
Original file line number Diff line number Diff line change @@ -96,8 +96,8 @@ local function createPopupMenu()
96
96
end
97
97
end
98
98
99
- local function processMspReply (cmd ,rx_buf )
100
- if not Page or not rx_buf then
99
+ local function processMspReply (cmd ,rx_buf , err )
100
+ if not Page or not rx_buf or err then
101
101
elseif cmd == Page .write then
102
102
if Page .eepromWrite then
103
103
eepromWrite ()
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ local MSP_VTX_CONFIG = 88
2
2
local MSP_VTXTABLE_BAND = 137
3
3
local MSP_VTXTABLE_POWERLEVEL = 138
4
4
5
+ local vtxAvailable = true
5
6
local vtxTableAvailable = false
6
7
local vtxConfigReceived = false
7
8
local vtxFrequencyTableReceived = false
@@ -18,8 +19,12 @@ local powerTable = {}
18
19
local lastRunTS = 0
19
20
local INTERVAL = 100
20
21
21
- local function processMspReply (cmd , payload )
22
+ local function processMspReply (cmd , payload , err )
22
23
if cmd == MSP_VTX_CONFIG then
24
+ if err then
25
+ vtxAvailable = false
26
+ return
27
+ end
23
28
vtxConfigReceived = true
24
29
vtxTableAvailable = payload [12 ] ~= 0
25
30
vtxTableConfig .bands = payload [13 ]
@@ -113,7 +118,7 @@ local function getVtxTables()
113
118
end
114
119
mspProcessTxQ ()
115
120
processMspReply (mspPollReply ())
116
- return vtxTablesReceived
121
+ return vtxTablesReceived or not vtxAvailable
117
122
end
118
123
119
124
return { f = getVtxTables , t = " Downloading VTX tables" }
You can’t perform that action at this time.
0 commit comments