ExpressLRS icon indicating copy to clipboard operation
ExpressLRS copied to clipboard

`elrsv3.lua` should query only visible parameters in a folder.

Open wimalopaan opened this issue 11 months ago • 4 comments

The elrsv3.lua could be much more efficient in querying parameters if it would only query parameters that are currently visible. If a device has many parameters querying all parameters may take a long time. This could be done more efficient (like TBS Agent lite).

For this to happen also #3121 must also be fixed.

See also: https://github.com/crsf-wg/crsf/issues/26

wimalopaan avatar Jan 29 '25 09:01 wimalopaan

Whilst this would be nice to do, I think the increase in size of the Lua script would be an issue. Unless someone can take the time to split the script into loadable chunks similar to the Agent Lite script then we can't do this.

pkendall64 avatar Jan 29 '25 23:01 pkendall64

I have tried several ways of writing this over the years but all of the implementations end up being more code due to the weak way we currently store the items in RAM and it becoming a sparse list that would need to be filled on demand. This caused it to crash more frequently on launching the script so I abandoned all of them and I put it in my "when I rewrite this entirely" todo list.

CapnBry avatar Jan 30 '25 17:01 CapnBry

I'm actually working on this and have it working with lazy loading the parameters. I think it would be safest to make any changes part of 4.0 for the Lua script as it will rely on the code changes from #3123 and will therefore not be backward compatible.

pkendall64 avatar Jan 31 '25 01:01 pkendall64

Most probably with so many ELRS params you are now on the verge of memory limit of BW targets. EdgeTX 2.11 will use LUA 5.3 that creates slighly smaller *.luac But that's temporary solution if you want to add more params.

That's why In CRSF protocol any param has parent information and folder param has children information. So displayed list keeps only current folder items lowering memory needed. Once you load folder content all data of parent folder is wiped out. Of course you can chache them to speed up but again on BW targets it can cause out of memory problem.

JimB40 avatar Jan 31 '25 07:01 JimB40