I want to practice Lua writing EdgeTX scripts for FPV drone telemetry. I have found a pretty decent documentation for edge tx and Lua . In order to accomplish my task I need to establish a communication of my radio (transmitter) with flight controller on my drone wich has betaflight firmware (see MSP communication) . There is a nice lua script for communication with betaflight (see here) but for me it is hard to understand how it communicates with betaflight on byte level. Do you have any small easy to understand examples to dive into it ? Thank you
So far, I have found that crossfireTelemetryPush
function sends a request via telemetry to receiver. This is the starting point.
An example of using this function you can see here:
local function crsfDisplayPortCmd(cmd, data)
local payloadOut = { CONST.address.betaflight, CONST.address.transmitter, cmd }
if data ~= nil then
for i = 1, #(data) do
payloadOut[3 + i] = data[i]
end
end
return crossfireTelemetryPush(CONST.frameType.displayPort, payloadOut)
end
Another one example might be found in ELRS lua script:
crossfireTelemetryPush(0x2D, { deviceId, handsetId, fieldPopup.id, 5 })
Here you can find a documentation to this function but as you might have noticed it is poorly explained what is going on there.
To summarize
I’d like to understand more hot to make a payload and send it from radio with help of Lua script to flight controller.