Skip to content

Commit

Permalink
Updated getVersion luadoc and example output
Browse files Browse the repository at this point in the history
Finished updated lua docs for getVersion() api change,
verified functionality and grabbed simulator output,
removed magic string and used a define instead.
  • Loading branch information
pfeerick authored and raphaelcoeffic committed Jun 26, 2021
1 parent 74222fe commit edbec9f
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions radio/src/lua/api_general.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@
#define RADIO_VERSION FLAVOUR
#endif

#define VERSION_OSNAME "EdgeTX"

#define FIND_FIELD_DESC 0x01

#define KEY_EVENTS(xxx, yyy) \
Expand All @@ -91,22 +93,15 @@ Return OpenTX version
@retval string OpenTX version (ie "2.1.5")
@retval multiple (available since 2.1.7) returns 5 values:
* (string) OpenTX version (ie "2.1.5")
* (string) radio type: `x12s`, `x10`, `x9e`, `x9d+`, `x9d` or `x7`.
If running in simulator the "-simu" is added
* (number) major version (ie 2 if version 2.1.5)
* (number) minor version (ie 1 if version 2.1.5)
* (number) revision number (ie 5 if version 2.1.5)
@retval multiple (available since 2.1.7) returns 6 values:
@retval multiple values (available since 2.1.7):
* (string) OpenTX version (ie "2.1.5")
* (string) radio type: `x12s`, `x10`, `x9e`, `x9d+`, `x9d` or `x7`.
If running in simulator the "-simu" is added
* (number) major version (ie 2 if version 2.1.5)
* (number) minor version (ie 1 if version 2.1.5)
* (number) revision number (ie 5 if version 2.1.5)
* (string) OS name ( i.e. EdgeTX or nil if OpenTX)
Since EdgeTX 2.4.0, sixth value added
* (string) OS name (i.e. EdgeTX or nil if OpenTX)
@status current Introduced in 2.0.0, expanded in 2.1.7, radio type strings changed in 2.2.0, os name added in EdgeTX 2.4.0
Expand All @@ -130,11 +125,12 @@ return { run=run }
```
Output of the above script in simulator:
```
version: 2.1.7
radio: taranis-simu
version: 2.4.0
radio: tx16s-simu
maj: 2
minor: 1
rev: 7
minor: 4
rev: 0
osname: EdgeTX
```
*/
static int luaGetVersion(lua_State * L)
Expand All @@ -144,7 +140,7 @@ static int luaGetVersion(lua_State * L)
lua_pushnumber(L, VERSION_MAJOR);
lua_pushnumber(L, VERSION_MINOR);
lua_pushnumber(L, VERSION_REVISION);
lua_pushstring(L, "EdgeTX");
lua_pushstring(L, VERSION_OSNAME);
return 6;
}

Expand Down

0 comments on commit edbec9f

Please sign in to comment.