Commit Graph
51 Commits
Author SHA1 Message Date
jfrickmannandPeter Feerick a66e78fea8 Fixed string option for Lua widgets 2021-12-14 20:12:12 +10:00
jfrickmannandPeter Feerick d4b8717575 Added zone.absx and zone.absy to give position of a Lua widget on the screen 2021-11-27 18:18:44 +10:00
jfrickmann ce7b408445 Add touch to Standalone Lua scripts 2021-11-19 08:01:28 -05:00
jfrickmann df153b4b1f memset() -> memclear() 2021-11-18 19:51:01 -05:00
Raphael Coeffic d2ddb2e535 Fix compilation error 2021-11-10 11:06:59 +01:00
rotormanandRisto fc2142ec78 Changed uniformly to EdgeTX boiler plate (also added boiler for files that were missing it). 2021-10-02 14:22:01 +02:00
Jesper FrickmannandGitHub 8d04b5112d Add tap count support to simulator (#719)
* Removed unused #define
* Added touchState.tapCount for double taps etc. to simulator
2021-09-14 16:30:39 +10:00
jfrickmann dcd5db38f9 Set error message if script fails in create() function 2021-09-11 13:36:10 -04:00
jfrickmann 98ed28db09 Added Lua function lcd.exitFullScreen() 2021-09-11 09:00:20 -04:00
jfrickmann ca478dccba Removed unused function exec() 2021-09-11 07:35:48 -04:00
jfrickmann 935bd403ee Add tapCount to touchState in Lua widgets 2021-09-10 17:14:37 -04:00
jfrickmann f8eb2adab0 Show error message in Lua widgets instead of "disabled"
Also a new function drawTextLines(...) in draw_functions that splits a string over multiple lines
2021-08-29 18:22:31 -04:00
jfrickmann 5b3db33f03 Translate color option to create() function call
Forgot that in PR #646
2021-08-28 10:29:41 -04:00
jfrickmann 1af65969ed Color options for Lua widget get translated to Lua color flags
To support new color encoding in Lua widgets
2021-08-27 22:21:37 -04:00
jfrickmannandRaphael Coeffic bf656ffd7b Added event buffer to LuaWidget
Since Lua only runs at 10 Hz and the GUI at a higher frequency, events sometimes are skipped unless we store them in a buffer.
This buffer is only two slots, but can be expanded by changing EVENT_BUFFER_SIZE.
2021-07-31 07:54:17 +02:00
jfrickmann d4e02dbc22 Accumulate (slideX, slideY) with touch slide events.
Apparently, onTouchSlide gets called more frequently, and hence we miss some of the sliding if we do not accumulate between calls to Lua.
2021-07-26 21:34:38 -04:00
jfrickmann da94cc64ff Merge branch 'VCENTER' into Everything 2021-07-24 17:32:48 -04:00
jfrickmann 1fc59ce31a Merged LuaScriptPreemption 2021-07-24 17:32:41 -04:00
jfrickmann c62aac7bde Lua task preempts long running scripts instead of killing them
Ported to EdgeTX from https://github.com/opentx/opentx/pull/8194
2021-07-22 14:41:53 -04:00
jfrickmann 296acc6558 Code polishing 2021-07-22 08:03:48 -04:00
jfrickmann fd05bcab19 One swipe at a time
Added a timeout so we do not get a swipe storm during slide events
2021-07-22 08:03:28 -04:00
jfrickmann 61602d525b Improved swipe-onomics 2021-07-22 08:03:09 -04:00
jfrickmann 8b90754e95 Only one EVT_TOUCH_FIRST at a time 2021-07-22 08:02:53 -04:00
jfrickmann 0b9fd82074 Added touch events to Lua widgets 2021-07-22 08:02:33 -04:00
jfrickmann e1066af88c Added LuaWidget::onEvent(event) and LuaWidget::event to capture key events to be passed to the Lua widgets. 2021-07-22 08:01:29 -04:00
jfrickmann e3fb2ac6ea Added key event to fullscreen Lua widget 2021-07-22 08:01:08 -04:00
jfrickmann 2e129af9f1 Added VCENTER to lcd flags
Only for COLORLCD
2021-07-21 19:53:13 -04:00
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