/
Sangak
/
betaflight-tx-lua-scripts
Обзор
Документация
Войти
/
Sangak
/
betaflight-tx-lua-scripts
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/SCRIPTS/BF/api_version.lua
26 строк
635 B
Hans Christian Olaussen
Skip vtx tables download if not available
12 мар 2023, 22:29
12 мар 2023, 22:29
e2597af
Код
Авторство
О чём код?
local MSP_API_VERSION = 1 local apiVersionReceived = false local lastRunTS = 0 local INTERVAL = 50 local function processMspReply(cmd,rx_buf,err) if cmd == MSP_API_VERSION and #rx_buf >= 3 and not err then apiVersion = rx_buf[2] + rx_buf[3] / 100 apiVersionReceived = true end end local function getApiVersion() if lastRunTS == 0 or lastRunTS + INTERVAL < getTime() then protocol.mspRead(MSP_API_VERSION) lastRunTS = getTime() end mspProcessTxQ() processMspReply(mspPollReply()) return apiVersionReceived end return { f = getApiVersion, t = "Waiting for API version" }