Commit Graph
24 Commits
Author SHA1 Message Date
Raphael Coeffic 9ecccef315 Call LuaWidget background() if widget is not painted
Resolves #222
2021-06-19 17:47:47 +02:00
Raphael Coeffic 78915daf95 Fixed memory leak: widget factories need to be deleted
in opentxClose()
2021-06-12 07:38:31 +02:00
Raphael Coeffic c37bc91475 Unregister LUA widgets when the factory is destoyed
Resolves #183
2021-06-12 07:38:30 +02:00
Raphael CoefficandRaphael Coeffic f305fd397d Selectable widgets (+edit, fullscreen mode, etc) 2021-05-06 12:55:59 +02:00
Raphael CoefficandRaphael Coeffic f0f6a1e093 Fixed various issues while running "teckel12/LuaTelemetry" widget 2021-05-06 12:55:59 +02:00
Raphael CoefficandRaphael Coeffic 72a7409d10 First working LUA widget: Timer2 2021-05-06 12:55:59 +02:00
3djcGitHub3djc <Th1sisfmyofmyo>
87cd9047b1 2.4 continued (#8092)
Quite a bit of work on 2.4

Co-authored-by: 3djc <Th1sisfmyofmyo>
2020-11-14 14:55:37 +04:00
Bertrand Songis 42a3198568 Merge with latest 2.3 2020-10-07 21:01:45 +02:00
Bertrand Songis f410d5c74b Warnings removed 2020-10-05 09:13:09 +02:00
Bertrand Songis 71ec1db9f6 Merge with latest 2.3 2020-06-18 11:14:07 +02:00
Bertrand Songis 36839dd417 [Horus] Gauge percent was not vertically centered 2020-06-01 16:02:20 +02:00
Raphael CoefficandBertrand Songis 8b4d2b698d YAML storage (#7071)
YAML storage
2019-11-12 14:50:05 +01:00
Bertrand Songis 3e2cb83991 Now uses the external libopenui 2019-10-02 14:41:52 +02:00
Damjan AdamicandBertrand Songis 49a63d43b3 Fix some bugs found by Sonar (#5392)
* Fix some bugs found by Sonar

* Different syntax for NOSONAR

* Switch Sonar badge to proper branch
2017-11-23 23:28:36 +01:00
Andre BernetandBertrand Songis 7f4daf3f5b Lua themes with no options wouldn't load anymore (got broken in b4939… (#5351)
* Lua themes with no options wouldn't load anymore (got broken in b493973d7d)

* Keep protection

* Changes according to PR comments
2017-11-18 11:59:59 +01:00
Damjan AdamicandBertrand Songis f0f3e35bf6 Lua memory (de)allocation tracer: (#5191)
* Lua memory (de)allocation tracer:

Usage:
 * turn on: `cmake -DLUA=YES -DLUA_ALLOCATOR_TRACER=YES -DDEBUG=YES -DNANO=NO`
 * get debug output and make plot data: `./simu 2>&1 | grep "^LT" | ../radio/util/lua_trace2plot.py > data.plot`
 * plot: `gnuplot  -e 'set xtics rotate;  plot "data.plot" using 2:xtic(1) ; pause mouse close'`

* Changes based on Bertrand comments
2017-11-11 09:41:05 +01:00
Damjan AdamicandAndre Bernet 582546f8ed Fixes #4839: path buffer overflow if LUA widget or theme directory name was too long (max length of directory name is 13 characters) (#4876) 2017-04-29 22:18:11 +02:00
Damjan AdamicandBertrand Songis 8375304d61 Several fixes for Lua Widgets and Themes options (#4648) 2017-03-21 07:42:00 +01:00
Damjan AdamicandBertrand Songis e80c4c858e Prevent Lua from allocating all heap memory (Horus) (#4440)
* Fixes #4284: Prevent Lua from allocating all heap memory (Horus)
Lua bitmap functions cleanup and docs update
Added x or y < 0 check to drawBitmap()

* Proper float constant
2017-02-11 22:21:14 +01:00
Damjan AdamicandBertrand Songis 17a77114d0 Re #3882: parse theme/widget options depending on option type (#4391) 2017-02-04 15:35:00 +01:00
Damjan AdamicandBertrand Songis b493973d7d Lua: Use incremental GC and also call it for Widgets (#4369)
Fixes #3885: Error in Lua Widget options handled better (does not disable entire Lua state)
Disable Lua Widget if any of its functions has error.
2017-02-04 10:58:06 +01:00
Bertrand Songis cdb3f48da7 [Horus] Malloc check added 2017-01-22 21:44:44 +01:00
Max PapernoandBertrand Songis 5d5dc67605 Add runtime Lua script pre-compilation and general .luac file support (#3318) (#4119)
* [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.
2016-12-17 10:56:40 +01:00
Damjan AdamicandBertrand Songis 92553b6589 Projectkk2glider/lua bitmap free (#4075)
* 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)
2016-11-28 23:08:18 +01:00