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)
66local mspSeq = 0
77local mspRemoteSeq = 0
88local mspRxBuf = {}
9+ local mspRxError = false
910local mspRxSize = 0
1011local mspRxCRC = 0
1112local mspRxReq = 0
6566function mspReceivedReply (payload )
6667 local idx = 1
6768 local status = payload [idx ]
68- local err = bit32.btest (status , 0x80 )
6969 local version = bit32.rshift (bit32.band (status , 0x60 ), 5 )
7070 local start = bit32.btest (status , 0x10 )
7171 local seq = bit32.band (status , 0x0F )
7272 idx = idx + 1
73- if err then
74- mspStarted = false
75- return nil
76- end
7773 if start then
7874 mspRxBuf = {}
75+ mspRxError = bit32.btest (status , 0x80 )
7976 mspRxSize = payload [idx ]
8077 mspRxReq = mspLastReq
8178 idx = idx + 1
@@ -117,7 +114,7 @@ function mspPollReply()
117114 return nil
118115 elseif mspReceivedReply (mspData ) then
119116 mspLastReq = 0
120- return mspRxReq , mspRxBuf
117+ return mspRxReq , mspRxBuf , mspRxError
121118 end
122119 end
123120end
Original file line number Diff line number Diff line change @@ -12,8 +12,9 @@ local labels = {}
1212local fields = {}
1313
1414local 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 ()
1718else
1819 vtx_tables = assert (loadScript (" VTX_TABLES/vtx_defaults.lua" ))()
1920end
Original file line number Diff line number Diff line change @@ -3,8 +3,8 @@ local accCalibrated = false
33local lastRunTS = 0
44local INTERVAL = 500
55
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
88 accCalibrated = true
99 end
1010end
Original file line number Diff line number Diff line change @@ -4,8 +4,8 @@ local apiVersionReceived = false
44local lastRunTS = 0
55local INTERVAL = 50
66
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
99 apiVersion = rx_buf [2 ] + rx_buf [3 ] / 100
1010 apiVersionReceived = true
1111 end
Original file line number Diff line number Diff line change @@ -20,8 +20,8 @@ local i2cRegisteredDeviceCount = 0
2020local lastRunTS = 0
2121local INTERVAL = 100
2222
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
2525 local length
2626 local i = 1
2727 length = 4
Original file line number Diff line number Diff line change @@ -5,8 +5,8 @@ local MCUIdReceived = false
55local lastRunTS = 0
66local INTERVAL = 100
77
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
1010 local i = 1
1111 local id = " "
1212 for j = 1 , 3 do
Original file line number Diff line number Diff line change @@ -9,8 +9,8 @@ local rssiSource = RSSI_SOURCE_NONE
99local lastRunTS = 0
1010local INTERVAL = 50
1111
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
1414 rssiSource = rx_buf [1 ]
1515 rssiSourceReceived = true
1616 end
Original file line number Diff line number Diff line change @@ -4,8 +4,8 @@ local timeIsSet = false
44local lastRunTS = 0
55local INTERVAL = 50
66
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
99 timeIsSet = true
1010 end
1111end
Original file line number Diff line number Diff line change @@ -96,8 +96,8 @@ local function createPopupMenu()
9696 end
9797end
9898
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
101101 elseif cmd == Page .write then
102102 if Page .eepromWrite then
103103 eepromWrite ()
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ local MSP_VTX_CONFIG = 88
22local MSP_VTXTABLE_BAND = 137
33local MSP_VTXTABLE_POWERLEVEL = 138
44
5+ local vtxAvailable = true
56local vtxTableAvailable = false
67local vtxConfigReceived = false
78local vtxFrequencyTableReceived = false
@@ -18,8 +19,12 @@ local powerTable = {}
1819local lastRunTS = 0
1920local INTERVAL = 100
2021
21- local function processMspReply (cmd , payload )
22+ local function processMspReply (cmd , payload , err )
2223 if cmd == MSP_VTX_CONFIG then
24+ if err then
25+ vtxAvailable = false
26+ return
27+ end
2328 vtxConfigReceived = true
2429 vtxTableAvailable = payload [12 ] ~= 0
2530 vtxTableConfig .bands = payload [13 ]
@@ -113,7 +118,7 @@ local function getVtxTables()
113118 end
114119 mspProcessTxQ ()
115120 processMspReply (mspPollReply ())
116- return vtxTablesReceived
121+ return vtxTablesReceived or not vtxAvailable
117122end
118123
119124return { f = getVtxTables , t = " Downloading VTX tables" }
You can’t perform that action at this time.
0 commit comments