Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds a script that compiles all Betaflight lua files the first time bf.lua is executed.
build.sh has been repurposed to create a file containing a table with the files to be compiled. The .lua files are tested for errors using luac -p. No .luac files are created.
As discussed in #281 the main memory issue we have now is running out of memory when compiling the betaflight lua scripts on the TX. OpenTX uses a modified version of LUA 5.2.2 with lua tiny RAM applied. This means that precompiled scripts will not work unless they are created with a version of lua that has had the same mod applied.
I believe the problem with on device compilation is that we're trying to load too many files in one lua cycle(bf.lua). The solution is to use a compile script that loads and compiles one file each lua cycle.
compile.lua
will only run the first timebf.lua
is executed. It loads and compiles all files listed inscripts.lua
one by one and exits when done. The next timebf.lua
is executed everything will be as normal.compile.lua
will not run again unlessscripts_compiled.lua
is modified or overwritten(new bf lua version)."Free mem" in OpenTX shows over 40KB after running this(used to be close to 0 or out of memory).