-
-
Notifications
You must be signed in to change notification settings - Fork 357
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(lua): port of NodeMCU Lua53 read-only tables #2994
Conversation
And if you delete the luac files and just leave the lua files on the SD card? |
Same. Freeze |
@stronnag it would be highly beneficial if you could plug a on-board debugger ;-) That would at least give us a hint on what is happening. When you say "model that use the INAV script", you mean that have a widget with that script, correct? |
I don't have a on-board debugger, alas. In companion29, having deleted every
Freeze. In the splash screen. |
@stronnag it should work better now: I had a nasty bug left from clean-up of some strange OpenTx change to |
For the record and as reported on Discord:
|
@stronnag regarding the visual artefacts: the issue is with the flags.... Lua uses in v5.2 only floating point numbers for storing any number. Now that we move to single precision floating point numbers, we have only 24 significant bits, which is not enough to encode the flags in full. Using just When, however, a color like So what happens is that the addition overflows, and this is what we see in the C code: There are different possible solution to this issue:
|
@stronnag I reverted the change to |
OK again in the simulator and radio (TX16S). |
When jumping between v2.8.0 and this PR build, most Lua widgets and scripts I tried seem to 'just work' fine... (i.e. most of the standard widgets, ExpressLRS lua, inav, few other random ones on the radio)... the exception being whatever build of Yappu telemetry I have on the TX16S (and also latest 2.0.0 dev build) ... works fine on 2.8.0 but with this PR I get one of those lovely cryptic |
@pfeerick This errors almost looks like some binary loading error. Did you try for the fun to remove the |
Nope. I'll give that a try and report back. |
670a515
to
d348cc2
Compare
I just found something that might affect -----------------------------
-- clears the loaded table
-- and recovers memory
-----------------------------
utils.clearTable = function(t)
if type(t)=="table" then
for i,v in pairs(t) do
if type(v) == "table" then
utils.clearTable(v)
end
t[i] = nil
end
end
t = nil
collectgarbage()
collectgarbage()
end The This has been fixed with d7bc59e. |
As mentioned above, yappu telemetry was the exception, and I've not gotten back to this PR yet (or anything EdgeTX today yet 😭 ) but will try deleting the |
@pfeerick actually it should work without deleting the |
To enable tests on Companion simulation, I started these 2 manual builds: |
I've just retried this with the latest commit, and TX16S now starts yappu without any issue :) |
This change was part of the eLua LTR patches (based on 5.1), whereby this feature was already integrated in Lua 5.2.
# Conflicts: # radio/src/lua/CMakeLists.txt # radio/src/lua/api_general.cpp
As the lookup cache is attached to that one
50fc7dc
to
e1b346f
Compare
* main: (30 commits) feat(cpn): Radiomaster Boxer support (EdgeTX#2910) chore: Move __global_locale to FLASH (frees some RAM!) (EdgeTX#3169) chore: Remove obsolete language defines, single source for telemetry sensor names (EdgeTX#3119) feat(lua): Port of NodeMCU Lua53 read-only tables (EdgeTX#2994) chore: New module/serial API (EdgeTX#3055) chore: Updated SE translations 🇸🇪 (EdgeTX#3148) Update README.md fix(color): Duplicate selected theme, update color list (EdgeTX#3122) fix: Regenerate yaml, carryTrim => trimSource cleanup (EdgeTX#3121) chore(color): LVGLify custom mixer scripts page (EdgeTX#3071) fix(translation): String casting for CZ/IT/FR Fixes EdgeTX#3145 fix(cpn): Save "set main view" number for special/global function (EdgeTX#3132) chore(color): LVGLify statistics and debug screens (EdgeTX#3072) chore(color): LVGLify and enhance model -> telemetry page (EdgeTX#3070) chore: Updates to Danish translations 🇩🇰 (EdgeTX#3128) chore: CN/TW translations for theme save and delete strings (EdgeTX#3129) chore: fix STM32 HAL headers fix(color): Overlap in logical switch monitor footer (EdgeTX#3137) fix(doc): LUA doc link to units.md feat(color): Change global variables layout to better match other pages (EdgeTX#3116) ...
Port of #2986 to
main
, so that it can be tested separately.Summary of changes:
512 bytes
)changedLUA_NUMBER
default type fromdouble
tofloat
After some tweaks, it seems that changing fromdouble
tofloat
has a nice side effect: it removes some huge floating point functions and uses the smallerfloat
version. This allows to regain around 8 KB of Flash memory!Please note: Changing from
double
tofloat
has been postponed as it introduces issue withLcdFlags
using the full 32bits, whereby a float can only represent 24 bits faithfully.TODOs: