chores: update to LUA 5.3
Preview of what is coming for 3.0...
Current issues:
- [x] On T15 the radio goes into EM on shutdown
Will it increase memory demand? Something is ringing in my head that 5.3 has 32bit numbers so it takes more mem.
Will it increase memory demand? Something is ringing in my head that 5.3 has 32bit numbers so it takes more mem.
The current LUA version we are using only supports 64Bit floating point. So I expect the memory usage to be reduced.
Hi, what is the status of this?
This will come with EdgeTX 3.0. we want to have one release where we combine multiple incompatible changes, to make life easier for the lua Devs.
@raphaelcoeffic when you rebase pls ping me so I can make some tests.
Rebased to current main; but having issues with crashes to EM and stack overflow in widgets.
I've rebases this to current main and it seems to be working ok on the radios I've tested (B&W and Color).
@raphaelcoeffic - I made one small change to ldump.c and lundump.c so that the .luac files generated by the simulator will work on the radio (tested on MacOS). This involves forcing the size_t size value in the header to 32 bits (commit 22219748).
With this change the .luac files generated in the simulator and on the radio are identical.
Compiled .luac files are smaller with 5.3. E.G. ELRS Lua script:
- 5.2 = 17758 bytes
- 5.3 = 15590 bytes
How to fix it?
What was changed? Bitmap.* global table became bitmap.*?
Changing Bitmap.open to bitmap.open in lua code doesn't work
How to fix it? What was changed? Bitmap.* global table became bitmap.*? Changing Bitmap.open to bitmap.open in lua code doesn't work
Odd. Changing it worked for me on the scripts I tested.
Found it.
It is io.open('file', 'r') that shuts down Simulator (Companion) abrubtly.
Here is test scipt "test_53ioopen.lua"
local fh
return {
run = function(e)
return 0
end,
init = function()
fh = io.open('/SCRIPTS/TOOLS/test_53ioopen.lua')
end
}
But you can also put in LUA
local fh = io.open('whatever')
to get same result
io.* library works now.
I've made some inital tests comparing 2.10 LUA 5.2 and 2.11 LUA 5.3 using TX16S simulator.
-
compiled *.luac files with LUA 5.3 are indeed smaller in size than those compiled with LUA 5.2 Difference is 10-25% depending on file.
-
Run-time memory requrement increased about 8-9% :(
Toolbox compiled with 5.2
Toolbox compiled with 5.3
Need to do same test with B&W target but that's not good sign as bigger apps like BF Config script already works woth memory limit.
Even more increase for run-time memory with BW target, ca 11%
Toolbox compiled with 5.2
Toolbox compiled with 5.3
I'm seeing reduced memory usage for running scripts. E.G. ELRS v3 script on T20V2:
- 5.2 = 44967 bytes
- 5.3 = 41796 bytes
I can't do any detailed analysis of the memory usage on your toolbox scripts as I can't see the source code anywhere.
@philmoz we decided we will go with LUA 5.3 in EdgeTX 2.11
There is one change in API that affects text LUA text files: Bitmap.* functions are now bitmap.* To make trasistion easer would be good to have both bitmap.* and Bitmap.* (as alias) working in 2.11
'Bitmap' table restored for 2.11.
LGTM on TX12, T20v2 and TX16S
Hey! Lovely to see this change happening!
Is there a reason why EdgeTX is going to Lua 5.3 instead of 5.4? It seems to be quite a bit faster. Not sure there is any backwards-incompatible changes in that release compared to 5.3 either.
The main reason was the availability of code for some specific changes that allow for read-only tables coming from the NodeMCU project. This is essential for us to reduce RAM usage of builtin libs and relocate them completely to FLASH memory.
