betaflight-tx-lua-scripts
betaflight-tx-lua-scripts copied to clipboard
Read lua buffer until empty
Reads everything from the lua input buffer in one lua cycle.
The current behaviour is to read one frame from the buffer each lua cycle which is approximately every 50ms.
With this change the script will read frames from the buffer until it's empty. This can speed up the page loading significantly depending on the protocol used. For smartport/fport/crossfire it will likely not have a big effect. For smartport we get a lot of small frames at a slow interval and for crossfire the frames are large so the whole payload fits in one or two frames. For ghost(#419) on the other hand we get small frames at a fast rate so it's possible that the buffer fills up quickly and there are actually multiple frames in the buffer so it makes sense to read them all instead of one small frame every 50ms.
I also added requestTimeout
per protocol. For faster protocols like crossfire and ghost it's set to 200ms because I think we can assume that if we don't receive a valid payload within that time it was corrupted or it's not arriving at all. Tested with tracer and it works nicely.
This is built on top of #419 so that should be merged first.
For testing: betaflight-tx-lua-scripts_1.5.0.zip