Merge with latest 2.3
This commit is contained in:
+65
-20
@@ -71,7 +71,8 @@ Reset the backlight timeout
|
||||
*/
|
||||
static int luaLcdResetBacklightTimeout(lua_State * L)
|
||||
{
|
||||
if (!luaLcdAllowed) return 0;
|
||||
if (!luaLcdAllowed)
|
||||
return 0;
|
||||
resetBacklightTimeout();
|
||||
return 0;
|
||||
}
|
||||
@@ -95,7 +96,8 @@ bottom line is 63. Drawing on an existing black pixel produces white pixel (TODO
|
||||
*/
|
||||
static int luaLcdDrawPoint(lua_State *L)
|
||||
{
|
||||
if (!luaLcdAllowed) return 0;
|
||||
if (!luaLcdAllowed)
|
||||
return 0;
|
||||
int x = luaL_checkinteger(L, 1);
|
||||
int y = luaL_checkinteger(L, 2);
|
||||
LcdFlags att = luaL_optunsigned(L, 3, 0);
|
||||
@@ -123,7 +125,8 @@ whole line will not be drawn (starting from OpenTX 2.1.5)
|
||||
*/
|
||||
static int luaLcdDrawLine(lua_State *L)
|
||||
{
|
||||
if (!luaLcdAllowed) return 0;
|
||||
if (!luaLcdAllowed)
|
||||
return 0;
|
||||
coord_t x1 = luaL_checkunsigned(L, 1);
|
||||
coord_t y1 = luaL_checkunsigned(L, 2);
|
||||
coord_t x2 = luaL_checkunsigned(L, 3);
|
||||
@@ -228,7 +231,8 @@ See the [Appendix](../appendix/fonts.md) for available characters in each font s
|
||||
*/
|
||||
static int luaLcdDrawText(lua_State *L)
|
||||
{
|
||||
if (!luaLcdAllowed) return 0;
|
||||
if (!luaLcdAllowed)
|
||||
return 0;
|
||||
int x = luaL_checkinteger(L, 1);
|
||||
int y = luaL_checkinteger(L, 2);
|
||||
const char * s = luaL_checkstring(L, 3);
|
||||
@@ -259,7 +263,8 @@ Display a value formatted as time at (x,y)
|
||||
*/
|
||||
static int luaLcdDrawTimer(lua_State *L)
|
||||
{
|
||||
if (!luaLcdAllowed) return 0;
|
||||
if (!luaLcdAllowed)
|
||||
return 0;
|
||||
int x = luaL_checkinteger(L, 1);
|
||||
int y = luaL_checkinteger(L, 2);
|
||||
int seconds = luaL_checkinteger(L, 3);
|
||||
@@ -293,7 +298,8 @@ Display a number at (x,y)
|
||||
*/
|
||||
static int luaLcdDrawNumber(lua_State *L)
|
||||
{
|
||||
if (!luaLcdAllowed) return 0;
|
||||
if (!luaLcdAllowed)
|
||||
return 0;
|
||||
int x = luaL_checkinteger(L, 1);
|
||||
int y = luaL_checkinteger(L, 2);
|
||||
int val = luaL_checkinteger(L, 3);
|
||||
@@ -321,7 +327,8 @@ See getValue()
|
||||
*/
|
||||
static int luaLcdDrawChannel(lua_State *L)
|
||||
{
|
||||
if (!luaLcdAllowed) return 0;
|
||||
if (!luaLcdAllowed)
|
||||
return 0;
|
||||
int x = luaL_checkinteger(L, 1);
|
||||
int y = luaL_checkinteger(L, 2);
|
||||
int channel = -1;
|
||||
@@ -358,7 +365,8 @@ displays negated switch
|
||||
*/
|
||||
static int luaLcdDrawSwitch(lua_State *L)
|
||||
{
|
||||
if (!luaLcdAllowed) return 0;
|
||||
if (!luaLcdAllowed)
|
||||
return 0;
|
||||
int x = luaL_checkinteger(L, 1);
|
||||
int y = luaL_checkinteger(L, 2);
|
||||
int s = luaL_checkinteger(L, 3);
|
||||
@@ -382,7 +390,8 @@ Displays the name of the corresponding input as defined by the source at (x,y)
|
||||
*/
|
||||
static int luaLcdDrawSource(lua_State *L)
|
||||
{
|
||||
if (!luaLcdAllowed) return 0;
|
||||
if (!luaLcdAllowed)
|
||||
return 0;
|
||||
int x = luaL_checkinteger(L, 1);
|
||||
int y = luaL_checkinteger(L, 2);
|
||||
int s = luaL_checkinteger(L, 3);
|
||||
@@ -532,7 +541,8 @@ Omitting scale draws image in 1:1 scale and is faster than specifying 100 for sc
|
||||
*/
|
||||
static int luaLcdDrawBitmap(lua_State *L)
|
||||
{
|
||||
if (!luaLcdAllowed) return 0;
|
||||
if (!luaLcdAllowed)
|
||||
return 0;
|
||||
const BitmapBuffer * b = checkBitmap(L, 1);
|
||||
|
||||
if (b) {
|
||||
@@ -564,7 +574,8 @@ Draw a bitmap at (x,y)
|
||||
*/
|
||||
static int luaLcdDrawPixmap(lua_State *L)
|
||||
{
|
||||
if (!luaLcdAllowed) return 0;
|
||||
if (!luaLcdAllowed)
|
||||
return 0;
|
||||
int x = luaL_checkinteger(L, 1);
|
||||
int y = luaL_checkinteger(L, 2);
|
||||
const char * filename = luaL_checkstring(L, 3);
|
||||
@@ -597,7 +608,8 @@ Draw a rectangle from top left corner (x,y) of specified width and height
|
||||
*/
|
||||
static int luaLcdDrawRectangle(lua_State *L)
|
||||
{
|
||||
if (!luaLcdAllowed) return 0;
|
||||
if (!luaLcdAllowed)
|
||||
return 0;
|
||||
int x = luaL_checkinteger(L, 1);
|
||||
int y = luaL_checkinteger(L, 2);
|
||||
int w = luaL_checkinteger(L, 3);
|
||||
@@ -629,7 +641,8 @@ Draw a solid rectangle from top left corner (x,y) of specified width and height
|
||||
*/
|
||||
static int luaLcdDrawFilledRectangle(lua_State *L)
|
||||
{
|
||||
if (!luaLcdAllowed) return 0;
|
||||
if (!luaLcdAllowed)
|
||||
return 0;
|
||||
int x = luaL_checkinteger(L, 1);
|
||||
int y = luaL_checkinteger(L, 2);
|
||||
int w = luaL_checkinteger(L, 3);
|
||||
@@ -661,7 +674,8 @@ Draw a simple gauge that is filled based upon fill value
|
||||
*/
|
||||
static int luaLcdDrawGauge(lua_State *L)
|
||||
{
|
||||
if (!luaLcdAllowed) return 0;
|
||||
if (!luaLcdAllowed)
|
||||
return 0;
|
||||
int x = luaL_checkinteger(L, 1);
|
||||
int y = luaL_checkinteger(L, 2);
|
||||
int w = luaL_checkinteger(L, 3);
|
||||
@@ -699,7 +713,8 @@ the right side of title bar. (i.e. idx=2, cnt=5, display `2/5`)
|
||||
*/
|
||||
static int luaLcdDrawScreenTitle(lua_State *L)
|
||||
{
|
||||
if (!luaLcdAllowed) return 0;
|
||||
if (!luaLcdAllowed)
|
||||
return 0;
|
||||
const char * str = luaL_checkstring(L, 1);
|
||||
int idx = luaL_checkinteger(L, 2);
|
||||
int cnt = luaL_checkinteger(L, 3);
|
||||
@@ -739,7 +754,8 @@ Draw a combo box
|
||||
*/
|
||||
static int luaLcdDrawCombobox(lua_State *L)
|
||||
{
|
||||
if (!luaLcdAllowed) return 0;
|
||||
if (!luaLcdAllowed)
|
||||
return 0;
|
||||
int x = luaL_checkinteger(L, 1);
|
||||
int y = luaL_checkinteger(L, 2);
|
||||
int w = luaL_checkinteger(L, 3);
|
||||
@@ -818,7 +834,13 @@ Set a color for specific area
|
||||
* `MENU_BGCOLOR`
|
||||
* `HEADER_ICON_BGCOLOR`
|
||||
* `HEADER_CURRENT_BGCOLOR`
|
||||
* `MAINVIEW_PANES_COLOR`
|
||||
* `MAINVIEW_GRAPHICS_COLOR`
|
||||
* `OVERLAY_COLOR`
|
||||
* `BARGRAPH1_COLOR`
|
||||
* `BARGRAPH2_COLOR`
|
||||
* `BARGRAPH_BGCOLOR`
|
||||
* `CUSTOM_COLOR`
|
||||
|
||||
@param color (number) color in 5/6/5 rgb format. The following prefined colors are available
|
||||
* `WHITE`
|
||||
@@ -831,19 +853,40 @@ Set a color for specific area
|
||||
* `RED`
|
||||
* `DARKRED`
|
||||
|
||||
@notice Only available on Horus
|
||||
@notice Only available on Colorlcd radios
|
||||
|
||||
@status current Introduced in 2.2.0
|
||||
*/
|
||||
static int luaLcdSetColor(lua_State *L)
|
||||
{
|
||||
if (!luaLcdAllowed) return 0;
|
||||
if (!luaLcdAllowed)
|
||||
return 0;
|
||||
unsigned int index = luaL_checkunsigned(L, 1) >> 16;
|
||||
unsigned int color = luaL_checkunsigned(L, 2);
|
||||
lcdColorTable[index] = color;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*luadoc
|
||||
@function lcd.getColor(area)
|
||||
|
||||
Get the color for specific area : see lcd.setColor for area list
|
||||
|
||||
@notice Only available on Colorlcd radios
|
||||
|
||||
@status current Introduced in 2.3.11
|
||||
*/
|
||||
|
||||
static int luaLcdGetColor(lua_State *L)
|
||||
{
|
||||
if (!luaLcdAllowed)
|
||||
return 0;
|
||||
|
||||
unsigned int index = luaL_checkunsigned(L, 1) >> 16;
|
||||
lua_pushunsigned(L, lcdColorTable[index]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*luadoc
|
||||
@function lcd.RGB(r, g, b)
|
||||
|
||||
@@ -857,13 +900,14 @@ Returns a 5/6/5 rgb color code, that can be used with lcd.setColor
|
||||
|
||||
@retval number (integer) rgb color expressed in 5/6/5 format
|
||||
|
||||
@notice Only available on Horus
|
||||
@notice Only available on Colorlcd radios
|
||||
|
||||
@status current Introduced in 2.2.0
|
||||
*/
|
||||
static int luaRGB(lua_State *L)
|
||||
{
|
||||
if (!luaLcdAllowed) return 0;
|
||||
if (!luaLcdAllowed)
|
||||
return 0;
|
||||
int r = luaL_checkinteger(L, 1);
|
||||
int g = luaL_checkinteger(L, 2);
|
||||
int b = luaL_checkinteger(L, 3);
|
||||
@@ -890,6 +934,7 @@ const luaL_Reg lcdLib[] = {
|
||||
#if defined(COLORLCD)
|
||||
{ "drawBitmap", luaLcdDrawBitmap },
|
||||
{ "setColor", luaLcdSetColor },
|
||||
{ "getColor", luaLcdGetColor },
|
||||
{ "RGB", luaRGB },
|
||||
#else
|
||||
{ "getLastPos", luaLcdGetLastPos },
|
||||
|
||||
+11
-11
@@ -1518,16 +1518,16 @@ Get Telemetry Sensor parameters
|
||||
|
||||
@param sensor (unsigned number) sensor number (use 0 for sensor 1)
|
||||
|
||||
@retval nil requested logical switch does not exist
|
||||
@retval nil requested sensor does not exist
|
||||
|
||||
@retval table logical switch data:
|
||||
* `func` (number) function index
|
||||
* `v1` (number) V1 value (index)
|
||||
* `v2` (number) V2 value (index or value)
|
||||
* `v3` (number) V3 value (index or value)
|
||||
* `and` (number) AND switch index
|
||||
* `delay` (number) delay (time in 1/10 s)
|
||||
* `duration` (number) duration (time in 1/10 s)
|
||||
@retval table with sensor data:
|
||||
* `type` (number) 0 = custom, 1 = calculated
|
||||
* `name` (string) Name
|
||||
* `unit` (number) See list of units in the appendix of the OpenTX Lua Reference Guide
|
||||
* `prec` (number) Number of decimals
|
||||
* `id` (number) Only custom sensors
|
||||
* `instance` (number) Only custom sensors
|
||||
* `formula` (number) Only calculated sensors. 0 = Add etc. see list of formula choices in Companion popup
|
||||
|
||||
@status current Introduced in 2.3.0
|
||||
*/
|
||||
@@ -1564,7 +1564,7 @@ Reset Telemetry Sensor parameters
|
||||
|
||||
@retval nil
|
||||
|
||||
@status current Introduced in 2.3.0
|
||||
@status current Introduced in 2.3.11
|
||||
*/
|
||||
static int luaModelResetSensor(lua_State *L)
|
||||
{
|
||||
@@ -1572,7 +1572,7 @@ static int luaModelResetSensor(lua_State *L)
|
||||
if (idx < MAX_TELEMETRY_SENSORS) {
|
||||
telemetryItems[idx].clear();
|
||||
}
|
||||
|
||||
|
||||
lua_pushnil(L);
|
||||
return 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user