Commit Graph
505 Commits
Author SHA1 Message Date
Raphael CoefficandRaphael Coeffic 5e3c20b258 Push some dirty hack to give internal CRSF a higher prio
This allows for BF scripts to run on internal CRSF.
2021-11-21 11:18:35 +01:00
Raphael CoefficandRaphael Coeffic 043c1e6a2d Fixed pushing CRSF telem packets to internal module 2021-11-21 11:18:35 +01:00
Jesper FrickmannandGitHub f1baa383ae Fix standalone Lua script screen flicker and improve error messages (#982)
* Relax assumptions about when Lua is called in foreground and background

* Start Lua cycle timer both in foreground and background
Do not assume that background/foreground alternates

* Lua is called at every Standalone GUI cycle instead of 5 Hz
Since Lua preempts every 50 ms or so, the GUI should remain responsive.

* In standalone script, only call Lua once per GUI cycle, to avoid messing up buffer handling.

* Revamped error reporting for Standalone and Telemetry Lua scripts

* Font size for Lua error is reduced from XL to L on color if LCD_W < LCD_H

* In drawTextLines, also possible linebreaks for opening brackets.

* Smaller font for error message on tall color screen

* Make titlebar height match font size on narrow LCD
2021-11-15 12:57:14 +11:00
Jesper FrickmannandGitHub 30780d82ec [lua] Add shared memory variables which can be accessed from Lua widgets and other Lua scripts (#1018)
* Issue #132
Added 16 shared memory variables which can be accessed bot from Lua widgets and other Lua scripts.

* Notice Only available on radios with color display
2021-11-13 16:10:33 +11:00
Raphael Coeffic 69c017091a More stringified values 2021-11-10 11:07:01 +01:00
Raphael Coeffic d2ddb2e535 Fix compilation error 2021-11-10 11:06:59 +01:00
Peter FeerickandGitHub 3ad98bacf4 [NV14] Use trim hats to emulate key events when standalone lua script running (#985)
* Preliminary trims as keys for lua
Largely based on open-flysky implementation

* Add `isLuaStandaloneRunning()`

* Add more virtual events

* Tweak virtual events further

* Finish remapping keys to virtual events

* Move some virtuals to right trim hat

* Add missing "defined"

* Revert to common EVT_VIRTUAL_MENU mapping

* Make keys/trims reset backlight like other radios
2021-11-09 12:50:20 +11:00
eshifriandGitHub 4e571c1325 Improvements to time and timer display #911 (#912)
* Fix time display #911

* move TIMEHOUR definition

* change time format

* Refactoring

* rename

* remove unncessary code

* Change hour/minute format

* pack TimerDisplayOptions structure
2021-10-25 12:36:16 +11:00
Jesper FrickmannandGitHub ecf386e71f Fix certain Lua script errors hanging the GUI (#899)
* Fixed a bug where a standalone Lua script w/o a run function will hang the GUI on non-color radios

* Prevent Lua standalone window from opening if Lua failed on load

* Fixed scroll down key in TX12 simulator
Copied key definitions from TX16S

* Fixed the Lua error trying to call nil value when no scripts are loaded.

* I messed up in the previous commit; now it does not freeze and it does not call nil.
2021-10-15 12:03:23 +11:00
jfrickmannandPeter Feerick b316a11bba Per discussion on Discord
https://discord.com/channels/839849772864503828/842693696629899274/894878085210574889
2021-10-06 11:42:05 +11: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
Raphael Coeffic a17a02c541 Compute SDKROOT and use it 2021-09-16 12:05:41 +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
Peter FeerickandGitHub 3778ed26dd Merge pull request #703 from jfrickmann/DoubleTap
Double tap
2021-09-11 11:28:07 +10:00
jfrickmann 935bd403ee Add tapCount to touchState in Lua widgets 2021-09-10 17:14:37 -04:00
jfrickmann c0e25bfbff Modify Lua function lcd.RGB(...)
Now it can take *either* (r, g, b) as before *or* one single argument between 0 and 0xFFFFFF.
2021-09-09 16:51:03 -04:00
jfrickmann 1e505d4029 Do not apply (x,y) offsets! 2021-09-04 15:55:14 -04:00
jfrickmann e15b9636fa Implemented BLINK, INVERSE and SHADOWED
Also updated documentation
2021-09-04 07:15:02 -04:00
jfrickmann b100d9a164 Add Lua function lcd.drawTextLines(...) drawing text across multiple lines inside bounding box 2021-09-02 14:33:14 -04:00
Jesper FrickmannandGitHub cea723c56e Do not reload bitmps during theme update, unless reload argument is true (#661)
* Do not reload bitmps during theme update, unless reload argument is true
Trying to optimize speed for theme color changes.
FlySky is not optimized yet.

* Do not update theme from Lua lcd.setColor(CUSTOM_COLOR, x)
Some widgets like e.g. Timer2 constantly change CUSTOM_COLOR, and this seems to slow down things

* Lua function lcd.setColor() only updates if color is changed
To avoid that scripts calling lcd.setColor() repeatedly trash performance
2021-09-01 11:10:52 +10:00
Raphael CoefficandGitHub bbea8795a6 Merge pull request #630 from Riwan2/lua-fs-ops2
Added LUA file system operations
2021-08-31 06:27:12 +02:00
Peter FeerickandGitHub 4ad5cc0ab5 Merge pull request #651 from jfrickmann/FixMissingColors
Fix missing colors
2021-08-30 20:46:40 +10: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
jfrickmann 5fd78ce0d7 Updated libopenui 2021-08-26 10:49:45 -04:00
Riwan 5f10f8c1f6 update headers and luadoc "introduced in" 2021-08-24 11:48:24 +02:00
Riwan c1d8ae531a moving include api_filesystem 2021-08-24 10:24:47 +02:00
Riwan ec1c1ec345 Added LUA file system operations 2021-08-23 14:39:49 +02:00
jfrickmannandRaphael Coeffic 468a322f61 Updated documentation for Lua functions, mainly related to color 2021-08-22 19:39:50 +02:00
jfrickmannandRaphael Coeffic 9d878b71ce Improved color handling in Lua
LCD flags can now hold either a theme color index or a RGB value. Hence, values from lcd.RGB() and literal colors like e.g. RED, WHITE etc. can be used interchangeably with theme colors and CUSTOM_COLOR.
Also redesigned drawText, drawNumber and drawTimer, so they now use a common function to implement the party tricks with BLINK and INVERS flags.
2021-08-22 19:39:50 +02:00
jfrickmannandRaphael Coeffic 57e455d343 Made all flags optional and updated documentation 2021-08-22 19:39:50 +02:00
jfrickmannandRaphael Coeffic 3ae5f032fc Fixed a bug in lcd.drawLine function 2021-08-22 19:39:50 +02:00
jfrickmannandRaphael Coeffic d0e4b767d3 Converted literal colors to indices that can be used everywhere.
Also modified lcd.setColor function so it accepts either RGB or index color as new color. That way, literal colors work as before.
2021-08-22 19:39:50 +02:00
jfrickmannandRaphael Coeffic 8fb260d2b2 Fixed Lua function drawPoint and default color
I had deleted the default color, now it is back again. Lua drawPoint color did not work, it does now. Some style updates to the Lua code where several different names were used for variables holding flags.
2021-08-22 19:39:50 +02:00
jfrickmannandRaphael Coeffic 23ee5d933c Added back Lua constants for old style them colors 2021-08-22 19:39:50 +02:00
jfrickmannandRaphael Coeffic 95b87db3e0 Did a scripted search and replace to replace 40 existing theme colors with 11 new theme colors. 2021-08-22 19:39:50 +02:00
jfrickmannandRaphael Coeffic 302fcef465 Added OS theme colors as suggested by JimB40 in #506
Amend: trying if tests will pass when I move the new color indices to then end of the enum.
2021-08-22 19:33:03 +02:00
jfrickmann 8e4e2cceea Fix for issue #537
The function luaResume(...) assumes that it is called alternatingly in the background and the foreground.
But on color LCD radios it is only called in the foreground by standalone and tools script, so it got stuck waiting for a foreground call.
2021-08-03 20:57:16 -04:00
Raphael Coeffic 56542bf7e8 Some fixes for simu 2021-07-31 17:31:50 +02:00
jfrickmannandRaphael Coeffic 6e37d11710 Added a lua function lcd.sizeText(text[, flags])
Gets the width and height (incl. vertical offset) of text on the LCD with flags applied.
2021-07-31 07:59:08 +02: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
Raphael CoefficandGitHub 6e9b09b548 Merge pull request #494 from EdgeTX/nv14-build
NV14 Support and Build
2021-07-27 09:39:03 +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
richardclliandGitHub f12e9d4599 Merge pull request #501 from EdgeTX/main
Merge from main
2021-07-26 10:50:32 +08: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