* Fixes#4438: wrong cast used when setting Lua mixer script input source
Improved parsing of Lua mixer script inputs
* Additional type check
* ScriptDataInput union introduced.
Fixed: when using SOURCE input, do not use default value
Fixed: when using SOURCE input, min-max range is fixed
* [simu] simpgmspace: Populate file date/time/size in f_stat(); Add f_utime(); Fix f_getcwd() on Windows; Fix f_mkdir() build error on Windows.
* [Lua] Add runtime support for script pre-compilation. Changes behavior with LUA_COMPILER (Re: https://github.com/opentx/opentx/issues/3318):
All .lua scripts are now compiled and saved to binary "bytecode" file (.luac extension) upon first execution;
Scripts are also automatically re-compiled if .lua source file is newer than existing .luac file;
The pre-compiled .luac version is loaded if modification time is newer or equivalent to .lua source file;
If a .luac version of a script exists, then the .lua version does not need to be present;
Guards against bytecode compatibility issues (binaries from 64-bit sim will not run on 32-bit sim/radio);
In SIMU and DEBUG builds, the source .lua file is always preferred in order to preserve full debug info (this is is controlled with new LUA_SCRIPT_LOAD_MODE macro, see lua_api.h);
GC is now run after each script is loaded.
* [Lua] Add loadScript() API function as alternative to loadfile() from Lua base. This can take advantage of the new OTx script pre-compilation features to reduce memory footprint when loading functions dynamically. This is an interface to luaLoadScriptFileToState(). Fully documented.
* [SD][Lua] Flexible file extensions support:
Allow for variable length file extensions throughout system (no longer hard-coded in LEN_FILE_EXTENSION);
Fixes issues with renaming files in SD manager which have file extensions longer than ".ext";
Expand general support for multiple file extensions per file type in sdListFiles() (eg. .lua and .luac for scripts);
Lua scripts with .luac extensions can now be selected in custom/telemetry/function menus even if no .lua version exists (duplicates are not shown);
.luac files can now also be executed from SD file manager UI.
* [Build] Added CMake options for LUA_COMPILER and LUA_SCRIPT_LOAD_MODE.
* Cosmetics.
* [SD][gui] Improve efficiency of some file name handling routines in sdmanager GUI and sdListFiles() by extending getFileExtension() function. Use shared isExtensionMatching() in place of isImageFileExtension(). Only allow executing .luac files when LUA_COMPILER defined (as per request).
* [simpgmspace] Fix f_mkdir() for MSVC build and misc. cleanup.
* [Lua] Use getFileExtension() in script loader to determine file type and check for buffer overflow.
* Better memory stats (CLI)
* Bitmap buffer overflow check added
* Lua bitmap improvements
* Proper handling of symbolic links in simulator
* S6R Lua script fixes:
* added progress screen while loading bitmaps
* memory for bitmaps is now freed when leaving the script
* S6R Lua script: improved bitmap loading
* * Lua Themes and Widgets moved to separate file and separate Lua state
* Stand-alone, mixer and function scripts now behave the same as on Taranis (restarted after the stand-alone script was run)
* both Lua states are independent: Themes and Widgets is initialized only at the start, the other one is initialized before and after the stand-alone script is run
* Better leak test and report in BitmapBuffer
* Re #3318: Lua compiler enabled in simu and Companion simulator. Usage:
* any time <xxx>.lua file is about to be loaded and if file <xxx>.lua.src exists:
* load contents of <xxx>.lua.src
* compile Lua code
* save compiled code into <xxx>.lua (effectively overwrites existing file)
* immediately following the compilation the real file loading is done from <xxx>.lua (which by now contains compiled Lua bytecode)
When crossfireTelemetryPush() or sportTelemetryPush() is called without arguments, it returns a boolean telling whether or not the output buffer is currently available.
This simplifies the LUA in case SPORT or Crossfire is used as a transport for bigger requests (like MSP/SPORT).
* Add constants for LUA telemetry
This commit added 896 bytes to flash size which is a significant size. An alternative would to just document the values in the lua telemetry function.
Shortening some of the UNIT names (e.g. UNIT_MW instead of UNIT_milliwatts) or shortening UNIT_ to U_ could save a few bytes but the
* #if 0 ... #endif constants
* horus has 2MB flash
* Fix CUSTOM_COLOR, also change to way setColor work to a more natural : lcd.setColor(CUSTOM_COLOR, RED)
* Remove _INDEX from TBS main to match the recent change to setColor
I did a refactoring for the latitude and longitude decoding which should be tested carefully for FrSky S.PORT and D telemetry
There was a double conversion in S.PORT protocol, there are less maths now, and perhaps precision will be better