-
-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reads craft name from MSP and uses that name to store the vtx tables. If the craft name is empty it falls backs on using the model name as before.
- Loading branch information
1 parent
f58c429
commit 4b87e63
Showing
6 changed files
with
61 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
local MSP_UID = 160 | ||
|
||
local craftNameReceived = false | ||
|
||
local lastRunTS = 0 | ||
local INTERVAL = 100 | ||
|
||
local function processMspReply(cmd, payload) | ||
if cmd == MSP_UID then | ||
local i = 1 | ||
local name = "" | ||
while payload[i] do | ||
name = name..string.format("%02X",payload[i]) | ||
i = i+1 | ||
end | ||
if name == "" then | ||
craftName = model.getInfo().name | ||
else | ||
craftName = name | ||
end | ||
craftNameReceived = true | ||
end | ||
end | ||
|
||
local function getCraftName() | ||
if lastRunTS + INTERVAL < getTime() then | ||
lastRunTS = getTime() | ||
if not craftNameReceived then | ||
protocol.mspRead(MSP_UID) | ||
end | ||
end | ||
mspProcessTxQ() | ||
processMspReply(mspPollReply()) | ||
return craftNameReceived | ||
end | ||
|
||
return getCraftName |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters