1
1
local apiVersionReceived = false
2
2
local vtxTablesReceived = false
3
- local data_init , getVtxTables
4
- local vtxTables = loadScript (" /BF/VTX/" .. model .getInfo ().name .. " .lua" )
5
-
6
- if vtxTables and vtxTables () then
7
- vtxTablesReceived = true
8
- vtxTables = nil
9
- collectgarbage ()
10
- end
3
+ local data_init , getVtxTables , getCraftName
11
4
12
5
local function init ()
13
6
if apiVersion == 0 then
@@ -18,6 +11,23 @@ local function init()
18
11
data_init = nil
19
12
apiVersionReceived = true
20
13
collectgarbage ()
14
+ elseif not craftName then
15
+ if apiVersion >= 1.042 then
16
+ lcd .drawText (6 , radio .yMinLimit , " Waiting for craft name" )
17
+ getCraftName = getCraftName or assert (loadScript (" craft_name.lua" ))()
18
+ local craftNameReceived = getCraftName ()
19
+ if craftNameReceived then
20
+ getCraftName = nil
21
+ local vtxTables = loadScript (" /BF/VTX/" .. craftName .. " .lua" )
22
+ if vtxTables and vtxTables () then
23
+ vtxTablesReceived = true
24
+ vtxTables = nil
25
+ end
26
+ collectgarbage ()
27
+ end
28
+ else
29
+ craftName = model .getInfo ().name
30
+ end
21
31
elseif apiVersion >= 1.042 and not vtxTablesReceived then
22
32
lcd .drawText (6 , radio .yMinLimit , " Downloading VTX Tables" )
23
33
getVtxTables = getVtxTables or assert (loadScript (" vtx_tables.lua" ))()
@@ -29,7 +39,7 @@ local function init()
29
39
else
30
40
return true
31
41
end
32
- return apiVersionReceived and vtxTablesReceived
42
+ return apiVersionReceived and vtxTablesReceived and craftName
33
43
end
34
44
35
45
return init
0 commit comments