1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-15 12:25:12 +03:00
Commit graph

84 commits

Author SHA1 Message Date
Damjan Adamic
f36d01d560 Fixes #4438: wrong cast used when setting Lua mixer script input source (#4470)
* 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
2017-02-21 10:59:47 +01:00
Damjan Adamic
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
40ece81de2 X10 (#4377)
[X10] New radio supported!
2017-02-04 10:42:50 +01:00
Damjan Adamic
dcbfa92b03 Lua docs update: playNumber units updated 2017-01-30 21:53:06 +01:00
Florent Martel
4a76c023e6 Update the luadoc for sportTelemetryPop() (#4287)
Followup on #4232: DIY ID range changed to 0x5000 - 0x52FF
2017-01-25 18:16:30 +01:00
Raphael Coeffic
1666fd7355 lua: added EVT_MENU_LONG on Taranis (#3991) 2016-12-28 22:39:59 +01:00
3djc
bab5fc339e Lua setTelemetryValue() function fixes (#4158)
* Protect subId, prevent endless loop in sensor discovery if more than 7 is passed.
* Documentation updated
* Add additional parameter checks
2016-12-23 19:32:39 +01:00
Max Paperno
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
Bertrand Songis
82d6b96f8b X7D renamed to X7 2016-12-12 07:39:51 +01:00
Damjan Adamic
4233e71954 Lua docs updated 2016-12-11 20:11:56 +01:00
Damjan Adamic
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
Bertrand Songis
fb27acf286 Bsongis/x7d companion support (#4028)
[X7D] Companion support added
2016-11-16 12:59:15 +01:00
Bertrand Songis
d58244ebde Bsongis/lua interpreter added on x7d (#3999)
* [X7D] Lua option added (only standalone scripts)

* [X7D] Compilation fix

* [X7D] Compilation fix

* [X7D] Compilation fix

* [X7D] Compilation fix
2016-11-10 21:41:16 +01:00
Raphael Coeffic
35571ad4d1 [LUA] added docs for telemetry push/pop functions (#4013)
related to #4009
2016-11-10 21:40:37 +01:00
Raphael Coeffic
a315f6702b lua: allow telemetry buffer availability to be queried
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).
2016-11-09 16:17:54 +01:00
Arne Schwabe
345ea0f3e8 Add constants for LUA telemetry (#3990)
* 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
2016-11-06 18:29:10 +01:00
Florent Martel
08148e2e33 Lua setTelemetryValue with optional params (#3993) 2016-11-05 13:16:56 +01:00
Bertrand Songis
19789c115c [Lua] popupConfirmation function added 2016-11-05 12:47:48 +01:00
Bertrand Songis
c52e9be3d5 [XFire] New function added to raise a warning popup 2016-11-02 22:13:45 +01:00
Damjan Adamic
5ba14734cb Projectkk2glider/gps misc fixes (#3970)
* Fixed Lua GPS date (year is now kept with four digits)

* * GPS year displayed with two digits
* GPS date/time handling fixes
2016-11-02 13:03:26 +01:00
Florent Martel
450430f22e Provide getRSSI lua method (#3976) 2016-11-02 12:53:07 +01:00
Arne Schwabe
54a9393588 Implement setting sensor values from LUA (#3977)
* Implement setting sensor values from LUA

* Fix name of lua sensors
2016-11-02 12:48:11 +01:00
Damjan Adamic
37ea272bd4 Replaced all 1900 with TM_YEAR_BASE 2016-10-30 11:35:12 +01:00
Bertrand Songis
298716189e Cosmetics 2016-09-15 19:30:54 +02:00
3djc
576c148b9c Add X12S keypad FIRST events to LUA (#3801)
* Add X12S keypad FIRST events to LUA

* X9E fix
2016-09-14 18:57:45 +02:00
3djc
d84fd993c9 Move lua evt param from signed uint8_t to unsigned event_t 2016-09-12 07:20:06 +02:00
Bertrand Songis
cc2c2b094e [Horus] S.PORT devices update should work (not tested)
[Horus] SD Manager files renaming fixed (quick & dirty, I would prefer a popup)
2016-09-05 19:33:06 +02:00
Andre Bernet
aaf7f67ebb Add getRAS to Lua interface (#3742)
* Add getRAS lua function

* Add warning

* Return nil is case of bad antenna

* Check for valid SWR

* Typo

* Cosmetic

* Clarify that it is 0x33
2016-08-31 23:12:18 +02:00
floaledm
29642e379f Haptic feedback in lua scripts 2016-08-31 15:01:31 -05:00
Bertrand Songis
1d735f2bd3 [X9E/X7D] Rotary encoder navigation speed implemented (#3724) 2016-08-27 18:19:44 +02:00
Bertrand Songis
d3ae3c035d Bsongis/gui refactoring for x7 d (#3701)
* [X7D] New board added
* Cosmetics
2016-08-18 11:49:16 +02:00
Bertrand Songis
7fbd963b3f Another big refactoring 2016-08-02 22:15:29 +02:00
Bertrand Songis
51223a5864 No more REV9E and REVPLUS 2016-07-29 14:44:59 +02:00
Bertrand Songis
53b51cac94 Bsongis/crossfire refactoring (#3613)
* Crossfire refactoring

* Crossfire script now displaying fields

* Crossfire script now displaying text selection values
2016-06-18 22:16:50 +02:00
Bertrand Songis
900266be4a [Crossfire] Cosmetics 2016-06-16 15:18:32 +02:00
Bertrand Songis
e50aa21dd2 [Crossfire] Devices parameters script started 2016-06-16 11:53:45 +02:00
Bertrand Songis
9b5b9be50c [Crossfire] Telemetry packets are bigger 2016-06-15 22:19:10 +02:00
Bertrand Songis
862fa5525e [Crossfire] Upstream link development started 2016-06-11 20:05:51 +02:00
Bertrand Songis
9056e76460 [Taranis] RIGHT attribute added + TELEMETRY page splitted 2016-05-18 21:52:16 +02:00
Bertrand Songis
f27a87dea4 toInt16 function added 2016-05-17 23:41:05 +02:00
Damjan Adamic
8eda8244c6 Re #2826: Lua API: doc update for Cels- and Cels+ 2016-05-16 22:01:06 +02:00
Damjan Adamic
67c0326cca Re #2826: Lua API: return proper values for Cels- and Cels+ 2016-05-16 21:36:19 +02:00
Bertrand Songis
3f74d54fd9 RIGHT exported to Lua 2016-05-15 13:05:51 +02:00
3djc
dcd42145d0 3djc/add lcd.rgb (#3494)
Add docs for lcd.setColor and lcd.RGB
2016-05-14 16:58:29 +02:00
3djc
01a69e3dbf Do not export COLOR_INDEX to LUA anymore, as they are not needed anymore due to change in setColor (#3490) 2016-05-13 16:18:40 +02:00
3djc
24abad55ca Fix CUSTOM_COLOR,… (#3489)
* 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
2016-05-13 14:26:18 +02:00
Damjan Adamic
49cad7f757 Re #3462: Lua doc update 2016-05-09 19:29:52 +02:00
Damjan Adamic
6349ff9496 Fixes #3462: PlayTone check for min/max frequency added. Fixes Lua playTone() crash when called with abnormal parameter values. (#3468) (ported from master) 2016-05-06 22:44:43 +02:00
Bertrand Songis
bd87028fd5 FrSky S.PORT upstream (#3426)
FrSky S.PORT upstream
2016-04-29 18:44:25 +02:00
Bertrand Songis
26e156f9ad [Crossfire] Telemetry new fields (GPS / Battery)
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
2016-04-26 19:36:48 +02:00