feat(lua): Port of NodeMCU Lua53 read-only tables (#2994)
* chore(lua): revert useless c light function change This change was part of the eLua LTR patches (based on 5.1), whereby this feature was already integrated in Lua 5.2. * feat(lua): port of NodeMCU Lua53 read-only tables # Conflicts: # radio/src/lua/CMakeLists.txt # radio/src/lua/api_general.cpp * fix(nv14): missing SDRAM definition * fix: l_mathop * fix: use float functions in drawPower() * fix: ltable resize * fix: correct name is "bit32" * fix: first Lua context must be closed last As the lookup cache is attached to that one * Revert to Lua using double * Ensure byte-code compatibility * Fix possible compatibility issue with `lua_typename`/`luaL_typename` * Fix Bitmap symbol table * Re-add table lib for COLORLCD
This commit is contained in:
@@ -41,3 +41,76 @@ if(PYTHONINTERP_FOUND)
|
||||
add_lua_export_target(t16 ${LUA_INCLUDES} -DPCBHORUS -DPCBX10 -DRADIO_T16)
|
||||
add_lua_export_target(nv14 ${LUA_INCLUDES} -I${RADIO_SRC_DIR}/targets/nv14 -DPCBNV14)
|
||||
endif()
|
||||
|
||||
add_definitions(-DLUA)
|
||||
|
||||
if(LUA_COMPILER)
|
||||
add_definitions(-DLUA_COMPILER)
|
||||
endif()
|
||||
|
||||
if(LUA_ALLOCATOR_TRACER AND DEBUG)
|
||||
add_definitions(-DLUA_ALLOCATOR_TRACER)
|
||||
endif()
|
||||
|
||||
if(NOT "${LUA_SCRIPT_LOAD_MODE}" STREQUAL "")
|
||||
add_definitions(-DLUA_SCRIPT_LOAD_MODE="${LUA_SCRIPT_LOAD_MODE}")
|
||||
endif()
|
||||
|
||||
include_directories(${LUA_DIR})
|
||||
|
||||
set(RADIO_DEPENDENCIES ${RADIO_DEPENDENCIES} ${LUA_EXPORT})
|
||||
|
||||
if(LUA_MIXER)
|
||||
add_definitions(-DLUA_MODEL_SCRIPTS)
|
||||
endif()
|
||||
|
||||
set(SRC ${SRC}
|
||||
lua/interface.cpp
|
||||
lua/api_general.cpp
|
||||
lua/api_model.cpp
|
||||
lua/api_filesystem.cpp
|
||||
lua/lua_event.cpp
|
||||
)
|
||||
|
||||
if(GUI_DIR STREQUAL colorlcd)
|
||||
set(SRC ${SRC} lua/api_colorlcd.cpp lua/widgets.cpp)
|
||||
else()
|
||||
set(SRC ${SRC} lua/api_stdlcd.cpp)
|
||||
endif()
|
||||
|
||||
set(LUA_SRC
|
||||
lapi.c
|
||||
lcode.c
|
||||
lctype.c
|
||||
ldebug.c
|
||||
ldo.c
|
||||
ldump.c
|
||||
lfunc.c
|
||||
lgc.c
|
||||
llex.c
|
||||
lmem.c
|
||||
lobject.c
|
||||
lopcodes.c
|
||||
lparser.c
|
||||
lstate.c
|
||||
lstring.c
|
||||
ltable.c
|
||||
ltm.c
|
||||
lundump.c
|
||||
lvm.c
|
||||
lzio.c
|
||||
linit.c
|
||||
lbaselib.c
|
||||
lmathlib.c
|
||||
lbitlib.c
|
||||
loadlib.c
|
||||
lauxlib.c
|
||||
ltablib.c
|
||||
lcorolib.c
|
||||
liolib.c
|
||||
lstrlib.c
|
||||
)
|
||||
|
||||
foreach(FILE ${LUA_SRC})
|
||||
set(SRC ${SRC} ${LUA_DIR}/${FILE})
|
||||
endforeach()
|
||||
|
||||
@@ -19,13 +19,24 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#define LUA_LIB
|
||||
|
||||
#include <cctype>
|
||||
#include <cstdio>
|
||||
|
||||
#include "opentx.h"
|
||||
#include "libopenui.h"
|
||||
#include "widget.h"
|
||||
|
||||
#include "lua_api.h"
|
||||
#include "api_colorlcd.h"
|
||||
|
||||
#define BITMAP_METATABLE "BITMAP*"
|
||||
|
||||
constexpr coord_t INVERT_BOX_MARGIN = 2;
|
||||
constexpr int8_t text_horizontal_offset[7] {-2,-1,-2,-2,-2,-2,-2};
|
||||
constexpr int8_t text_vertical_offset[7] {0,0,0,0,0,-1,7};
|
||||
|
||||
BitmapBuffer* luaLcdBuffer = nullptr;
|
||||
Widget* runningFS = nullptr;
|
||||
|
||||
@@ -499,8 +510,6 @@ static int luaLcdDrawSource(lua_State *L)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define LUA_BITMAPHANDLE "BITMAP*"
|
||||
|
||||
/*luadoc
|
||||
@function Bitmap.open(name)
|
||||
|
||||
@@ -547,7 +556,7 @@ static int luaOpenBitmap(lua_State *L)
|
||||
TRACE("luaOpenBitmap: %p (%u)", *b, size);
|
||||
}
|
||||
|
||||
luaL_getmetatable(L, LUA_BITMAPHANDLE);
|
||||
luaL_getmetatable(L, BITMAP_METATABLE);
|
||||
lua_setmetatable(L, -2);
|
||||
|
||||
return 1;
|
||||
@@ -555,7 +564,7 @@ static int luaOpenBitmap(lua_State *L)
|
||||
|
||||
static BitmapBuffer * checkBitmap(lua_State * L, int index)
|
||||
{
|
||||
BitmapBuffer ** b = (BitmapBuffer **)luaL_checkudata(L, index, LUA_BITMAPHANDLE);
|
||||
BitmapBuffer ** b = (BitmapBuffer **)luaL_checkudata(L, index, BITMAP_METATABLE);
|
||||
return *b;
|
||||
}
|
||||
|
||||
@@ -633,7 +642,7 @@ static int luaBitmapResize(lua_State * L)
|
||||
TRACE("luaResizeBitmap: %p (%u)", *n, size);
|
||||
}
|
||||
|
||||
luaL_getmetatable(L, LUA_BITMAPHANDLE);
|
||||
luaL_getmetatable(L, BITMAP_METATABLE);
|
||||
lua_setmetatable(L, -2);
|
||||
|
||||
return 1;
|
||||
@@ -683,23 +692,6 @@ static int luaDestroyBitmap(lua_State * L)
|
||||
return 0;
|
||||
}
|
||||
|
||||
const luaL_Reg bitmapFuncs[] = {
|
||||
{ "open", luaOpenBitmap },
|
||||
{ "getSize", luaGetBitmapSize },
|
||||
{ "resize", luaBitmapResize },
|
||||
{ "toMask", luaBitmapTo8bitMask },
|
||||
{ "__gc", luaDestroyBitmap },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
void registerBitmapClass(lua_State * L)
|
||||
{
|
||||
luaL_newmetatable(L, LUA_BITMAPHANDLE);
|
||||
luaL_setfuncs(L, bitmapFuncs, 0);
|
||||
lua_pushvalue(L, -1);
|
||||
lua_setfield(L, -2, "__index");
|
||||
lua_setglobal(L, "Bitmap");
|
||||
}
|
||||
|
||||
/*luadoc
|
||||
@function lcd.drawBitmap(bitmap, x, y [, scale])
|
||||
@@ -1427,39 +1419,59 @@ static int luaLcdExitFullScreen(lua_State *L)
|
||||
return 0;
|
||||
}
|
||||
|
||||
const luaL_Reg lcdLib[] = {
|
||||
{ "refresh", luaLcdRefresh },
|
||||
{ "clear", luaLcdClear },
|
||||
{ "resetBacklightTimeout", luaLcdResetBacklightTimeout },
|
||||
{ "drawPoint", luaLcdDrawPoint },
|
||||
{ "drawLine", luaLcdDrawLine },
|
||||
{ "drawRectangle", luaLcdDrawRectangle },
|
||||
{ "drawFilledRectangle", luaLcdDrawFilledRectangle },
|
||||
{ "invertRect", luaLcdInvertRect },
|
||||
{ "drawText", luaLcdDrawText },
|
||||
{ "drawTextLines", luaLcdDrawTextLines },
|
||||
{ "sizeText", luaLcdSizeText },
|
||||
{ "drawTimer", luaLcdDrawTimer },
|
||||
{ "drawNumber", luaLcdDrawNumber },
|
||||
{ "drawChannel", luaLcdDrawChannel },
|
||||
{ "drawSwitch", luaLcdDrawSwitch },
|
||||
{ "drawSource", luaLcdDrawSource },
|
||||
{ "drawGauge", luaLcdDrawGauge },
|
||||
{ "drawBitmap", luaLcdDrawBitmap },
|
||||
{ "drawBitmapPattern", luaLcdDrawBitmapPattern },
|
||||
{ "drawBitmapPatternPie", luaLcdDrawBitmapPatternPie },
|
||||
{ "setColor", luaLcdSetColor },
|
||||
{ "getColor", luaLcdGetColor },
|
||||
{ "RGB", luaRGB },
|
||||
{ "drawCircle", luaLcdDrawCircle },
|
||||
{ "drawFilledCircle", luaLcdDrawFilledCircle },
|
||||
{ "drawTriangle", luaLcdDrawTriangle },
|
||||
{ "drawFilledTriangle", luaLcdDrawFilledTriangle },
|
||||
{ "drawArc", luaLcdDrawArc },
|
||||
{ "drawPie", luaLcdDrawPie },
|
||||
{ "drawAnnulus", luaLcdDrawAnnulus },
|
||||
{ "drawLineWithClipping", luaLcdDrawLineWithClipping },
|
||||
{ "drawHudRectangle", luaLcdDrawHudRectangle },
|
||||
{ "exitFullScreen", luaLcdExitFullScreen },
|
||||
{ NULL, NULL } /* sentinel */
|
||||
};
|
||||
LROT_BEGIN(lcdlib, NULL, 0)
|
||||
LROT_FUNCENTRY( refresh, luaLcdRefresh )
|
||||
LROT_FUNCENTRY( clear, luaLcdClear )
|
||||
LROT_FUNCENTRY( resetBacklightTimeout, luaLcdResetBacklightTimeout )
|
||||
LROT_FUNCENTRY( drawPoint, luaLcdDrawPoint )
|
||||
LROT_FUNCENTRY( drawLine, luaLcdDrawLine )
|
||||
LROT_FUNCENTRY( drawRectangle, luaLcdDrawRectangle )
|
||||
LROT_FUNCENTRY( drawFilledRectangle, luaLcdDrawFilledRectangle )
|
||||
LROT_FUNCENTRY( invertRect, luaLcdInvertRect )
|
||||
LROT_FUNCENTRY( drawText, luaLcdDrawText )
|
||||
LROT_FUNCENTRY( drawTextLines, luaLcdDrawTextLines )
|
||||
LROT_FUNCENTRY( sizeText, luaLcdSizeText )
|
||||
LROT_FUNCENTRY( drawTimer, luaLcdDrawTimer )
|
||||
LROT_FUNCENTRY( drawNumber, luaLcdDrawNumber )
|
||||
LROT_FUNCENTRY( drawChannel, luaLcdDrawChannel )
|
||||
LROT_FUNCENTRY( drawSwitch, luaLcdDrawSwitch )
|
||||
LROT_FUNCENTRY( drawSource, luaLcdDrawSource )
|
||||
LROT_FUNCENTRY( drawGauge, luaLcdDrawGauge )
|
||||
LROT_FUNCENTRY( drawBitmap, luaLcdDrawBitmap )
|
||||
LROT_FUNCENTRY( drawBitmapPattern, luaLcdDrawBitmapPattern )
|
||||
LROT_FUNCENTRY( drawBitmapPatternPie, luaLcdDrawBitmapPatternPie )
|
||||
LROT_FUNCENTRY( setColor, luaLcdSetColor )
|
||||
LROT_FUNCENTRY( getColor, luaLcdGetColor )
|
||||
LROT_FUNCENTRY( RGB, luaRGB )
|
||||
LROT_FUNCENTRY( drawCircle, luaLcdDrawCircle )
|
||||
LROT_FUNCENTRY( drawFilledCircle, luaLcdDrawFilledCircle )
|
||||
LROT_FUNCENTRY( drawTriangle, luaLcdDrawTriangle )
|
||||
LROT_FUNCENTRY( drawFilledTriangle, luaLcdDrawFilledTriangle )
|
||||
LROT_FUNCENTRY( drawArc, luaLcdDrawArc )
|
||||
LROT_FUNCENTRY( drawPie, luaLcdDrawPie )
|
||||
LROT_FUNCENTRY( drawAnnulus, luaLcdDrawAnnulus )
|
||||
LROT_FUNCENTRY( drawLineWithClipping, luaLcdDrawLineWithClipping )
|
||||
LROT_FUNCENTRY( drawHudRectangle, luaLcdDrawHudRectangle )
|
||||
LROT_FUNCENTRY( exitFullScreen, luaLcdExitFullScreen )
|
||||
LROT_END(lcdlib, NULL, 0)
|
||||
|
||||
LROT_BEGIN(bitmap_mt, NULL, LROT_MASK_GC)
|
||||
LROT_FUNCENTRY( __gc, luaDestroyBitmap )
|
||||
LROT_FUNCENTRY( getSize, luaGetBitmapSize )
|
||||
LROT_FUNCENTRY( resize, luaBitmapResize )
|
||||
LROT_FUNCENTRY( toMask, luaBitmapTo8bitMask )
|
||||
LROT_END(bitmap_mt, NULL, LROT_MASK_GC)
|
||||
|
||||
LROT_BEGIN(bitmaplib, NULL, 0)
|
||||
LROT_FUNCENTRY( open, luaOpenBitmap )
|
||||
LROT_FUNCENTRY( getSize, luaGetBitmapSize )
|
||||
LROT_FUNCENTRY( resize, luaBitmapResize )
|
||||
LROT_FUNCENTRY( toMask, luaBitmapTo8bitMask )
|
||||
LROT_END(bitmaplib, NULL, 0)
|
||||
|
||||
extern "C" {
|
||||
LUALIB_API int luaopen_bitmap(lua_State * L) {
|
||||
luaL_rometatable( L, BITMAP_METATABLE, LROT_TABLEREF(bitmap_mt));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,27 +19,6 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
//
|
||||
// Obsoleted definitions:
|
||||
// -> please check against libopenui_defines.h for conflicts
|
||||
// -> here we use the 4 most significant bits for our flags (32 bit unsigned)
|
||||
//
|
||||
// INVERS & BLINK are used in most scripts, let's offer a compatibility mode.
|
||||
//
|
||||
#undef INVERS
|
||||
#undef BLINK
|
||||
#include "definitions.h"
|
||||
|
||||
#define INVERS 0x01u
|
||||
#define BLINK 0x1000u
|
||||
#define RGB_FLAG 0x8000u
|
||||
|
||||
constexpr coord_t INVERT_BOX_MARGIN = 2;
|
||||
|
||||
constexpr int8_t text_horizontal_offset[7] {-2,-1,-2,-2,-2,-2,-2};
|
||||
constexpr int8_t text_vertical_offset[7] {0,0,0,0,0,-1,7};
|
||||
|
||||
extern bool luaLcdAllowed;
|
||||
extern BitmapBuffer * luaLcdBuffer;
|
||||
extern Widget * runningFS;
|
||||
|
||||
LcdFlags flagsRGB(LcdFlags flags);
|
||||
EXTERN_C(LUALIB_API int luaopen_bitmap(lua_State * L));
|
||||
|
||||
@@ -19,10 +19,11 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#define LUA_LIB
|
||||
|
||||
#include <cstdio>
|
||||
#include "lua_api.h"
|
||||
|
||||
#include "lua_api.h"
|
||||
#include "api_filesystem.h"
|
||||
|
||||
// garbage collector for luaDir
|
||||
@@ -33,18 +34,6 @@ static int dir_gc(lua_State* L)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void registerDirIter(lua_State* L)
|
||||
{
|
||||
luaL_newmetatable(L, DIR_METATABLE);
|
||||
|
||||
/* set the garbage colector field */
|
||||
lua_pushstring(L, "__gc");
|
||||
lua_pushcfunction(L, dir_gc);
|
||||
lua_settable(L, -3);
|
||||
|
||||
lua_pop(L, 1);
|
||||
}
|
||||
|
||||
static int dir_iter(lua_State* L)
|
||||
{
|
||||
DIR* dir = (DIR*)lua_touserdata(L, lua_upvalueindex(1));
|
||||
@@ -160,4 +149,21 @@ int luaFstat(lua_State* L)
|
||||
lua_settable(L, -3);
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
LROT_BEGIN(dir_handle, NULL, LROT_MASK_GC)
|
||||
LROT_FUNCENTRY( __gc, dir_gc )
|
||||
LROT_END(dir_handle, NULL, LROT_MASK_GC)
|
||||
|
||||
LROT_BEGIN(etxdir, NULL, 0)
|
||||
LROT_FUNCENTRY( dir, luaDir )
|
||||
LROT_FUNCENTRY( fstat, luaFstat )
|
||||
LROT_END(etxdir, NULL, 0)
|
||||
|
||||
extern "C" {
|
||||
LUAMOD_API int luaopen_etxdir(lua_State* L) {
|
||||
luaL_rometatable( L, DIR_METATABLE, LROT_TABLEREF(dir_handle));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#define DIR_METATABLE "directory metatable"
|
||||
#include "definitions.h"
|
||||
|
||||
void registerDirIter(lua_State* L);
|
||||
int luaDir(lua_State* L);
|
||||
int luaFstat(lua_State* L);
|
||||
#define DIR_METATABLE "DIR*"
|
||||
|
||||
EXTERN_C(LUALIB_API int luaopen_etxdir(lua_State* L));
|
||||
|
||||
+408
-409
@@ -19,6 +19,8 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#define LUA_LIB
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include "opentx.h"
|
||||
@@ -34,51 +36,51 @@
|
||||
#endif
|
||||
|
||||
#if defined(PCBX12S)
|
||||
#include "lua/lua_exports_x12s.inc" // this line must be after lua headers
|
||||
#include "lua_exports_x12s.inc" // this line must be after lua headers
|
||||
#elif defined(RADIO_FAMILY_T16)
|
||||
#include "lua/lua_exports_t16.inc"
|
||||
#include "lua_exports_t16.inc"
|
||||
#elif defined(PCBX10)
|
||||
#include "lua/lua_exports_x10.inc"
|
||||
#include "lua_exports_x10.inc"
|
||||
#elif defined(PCBX9E)
|
||||
#include "lua/lua_exports_x9e.inc"
|
||||
#include "lua_exports_x9e.inc"
|
||||
#elif defined(RADIO_X7ACCESS)
|
||||
#include "lua/lua_exports_x7access.inc"
|
||||
#include "lua_exports_x7access.inc"
|
||||
#elif defined(RADIO_X7)
|
||||
#include "lua/lua_exports_x7.inc"
|
||||
#include "lua_exports_x7.inc"
|
||||
#elif defined(RADIO_T12)
|
||||
#include "lua/lua_exports_t12.inc"
|
||||
#include "lua_exports_t12.inc"
|
||||
#elif defined(RADIO_TLITE)
|
||||
#include "lua/lua_exports_tlite.inc"
|
||||
#include "lua_exports_tlite.inc"
|
||||
#elif defined(RADIO_TPRO)
|
||||
#include "lua/lua_exports_tpro.inc"
|
||||
#include "lua_exports_tpro.inc"
|
||||
#elif defined(RADIO_TX12)
|
||||
#include "lua/lua_exports_tx12.inc"
|
||||
#include "lua_exports_tx12.inc"
|
||||
#elif defined(RADIO_TX12MK2)
|
||||
#include "lua/lua_exports_tx12mk2.inc"
|
||||
#include "lua_exports_tx12mk2.inc"
|
||||
#elif defined(RADIO_LR3PRO)
|
||||
#include "lua/lua_exports_lr3pro.inc"
|
||||
#include "lua_exports_lr3pro.inc"
|
||||
#elif defined(RADIO_BOXER)
|
||||
#include "lua/lua_exports_boxer.inc"
|
||||
#include "lua_exports_boxer.inc"
|
||||
#elif defined(RADIO_ZORRO)
|
||||
#include "lua/lua_exports_zorro.inc"
|
||||
#include "lua_exports_zorro.inc"
|
||||
#elif defined(RADIO_T8)
|
||||
#include "lua/lua_exports_t8.inc"
|
||||
#include "lua_exports_t8.inc"
|
||||
#elif defined(RADIO_COMMANDO8)
|
||||
#include "lua/lua_exports_commando8.inc"
|
||||
#include "lua_exports_commando8.inc"
|
||||
#elif defined(PCBX9LITES)
|
||||
#include "lua/lua_exports_x9lites.inc"
|
||||
#include "lua_exports_x9lites.inc"
|
||||
#elif defined(PCBX9LITE)
|
||||
#include "lua/lua_exports_x9lite.inc"
|
||||
#include "lua_exports_x9lite.inc"
|
||||
#elif defined(PCBXLITES)
|
||||
#include "lua/lua_exports_xlites.inc"
|
||||
#include "lua_exports_xlites.inc"
|
||||
#elif defined(PCBXLITE)
|
||||
#include "lua/lua_exports_xlite.inc"
|
||||
#include "lua_exports_xlite.inc"
|
||||
#elif defined(RADIO_X9DP2019)
|
||||
#include "lua/lua_exports_x9d+2019.inc"
|
||||
#include "lua_exports_x9d+2019.inc"
|
||||
#elif defined(PCBTARANIS)
|
||||
#include "lua/lua_exports_x9d.inc"
|
||||
#include "lua_exports_x9d.inc"
|
||||
#elif defined(PCBNV14)
|
||||
#include "lua/lua_exports_nv14.inc"
|
||||
#include "lua_exports_nv14.inc"
|
||||
#endif
|
||||
|
||||
#include "telemetry/frsky.h"
|
||||
@@ -105,12 +107,6 @@
|
||||
|
||||
#define FIND_FIELD_DESC 0x01
|
||||
|
||||
#define KEY_EVENTS(xxx, yyy) \
|
||||
{ "EVT_"#xxx"_FIRST", EVT_KEY_FIRST(yyy) }, \
|
||||
{ "EVT_"#xxx"_BREAK", EVT_KEY_BREAK(yyy) }, \
|
||||
{ "EVT_"#xxx"_LONG", EVT_KEY_LONG(yyy) }, \
|
||||
{ "EVT_"#xxx"_REPT", EVT_KEY_REPT(yyy) }
|
||||
|
||||
// see strhelpers.cpp for pre-instantiation of function-template
|
||||
// getSourceString() for this parametrization
|
||||
static constexpr uint8_t maxSourceNameLength{16};
|
||||
@@ -2628,502 +2624,505 @@ static int luaGetTrainerStatus(lua_State * L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
const luaL_Reg opentxLib[] = {
|
||||
{ "getTime", luaGetTime },
|
||||
{ "getDateTime", luaGetDateTime },
|
||||
|
||||
#define KEY_EVENTS(xxx, yyy) \
|
||||
{ "EVT_"#xxx"_FIRST", LRO_NUMVAL(EVT_KEY_FIRST(yyy)) }, \
|
||||
{ "EVT_"#xxx"_BREAK", LRO_NUMVAL(EVT_KEY_BREAK(yyy)) }, \
|
||||
{ "EVT_"#xxx"_LONG", LRO_NUMVAL(EVT_KEY_LONG(yyy)) }, \
|
||||
{ "EVT_"#xxx"_REPT", LRO_NUMVAL(EVT_KEY_REPT(yyy)) },
|
||||
|
||||
LROT_BEGIN(etxlib, NULL, 0)
|
||||
LROT_FUNCENTRY( getTime, luaGetTime )
|
||||
LROT_FUNCENTRY( getDateTime, luaGetDateTime )
|
||||
#if defined(RTCLOCK)
|
||||
{ "getRtcTime", luaGetRtcTime },
|
||||
LROT_FUNCENTRY( getRtcTime, luaGetRtcTime )
|
||||
#endif
|
||||
{ "getVersion", luaGetVersion },
|
||||
{ "getGeneralSettings", luaGetGeneralSettings },
|
||||
{ "getGlobalTimer", luaGetGlobalTimer },
|
||||
{ "getRotEncSpeed", luaGetRotEncSpeed },
|
||||
{ "getRotEncMode", luaGetRotEncMode },
|
||||
{ "getValue", luaGetValue },
|
||||
{ "getOutputValue", luaGetOutputValue },
|
||||
{ "getSourceValue", luaGetSourceValue },
|
||||
{ "getTrainerStatus", luaGetTrainerStatus },
|
||||
{ "getRAS", luaGetRAS },
|
||||
{ "getTxGPS", luaGetTxGPS },
|
||||
{ "getFieldInfo", luaGetFieldInfo },
|
||||
{ "getSourceInfo", luaGetFieldInfo },
|
||||
{ "getFlightMode", luaGetFlightMode },
|
||||
{ "playFile", luaPlayFile },
|
||||
{ "playNumber", luaPlayNumber },
|
||||
{ "playDuration", luaPlayDuration },
|
||||
{ "playTone", luaPlayTone },
|
||||
{ "playHaptic", luaPlayHaptic },
|
||||
{ "flushAudio", luaFlushAudio },
|
||||
LROT_FUNCENTRY( getVersion, luaGetVersion )
|
||||
LROT_FUNCENTRY( getGeneralSettings, luaGetGeneralSettings )
|
||||
LROT_FUNCENTRY( getGlobalTimer, luaGetGlobalTimer )
|
||||
LROT_FUNCENTRY( getRotEncSpeed, luaGetRotEncSpeed )
|
||||
LROT_FUNCENTRY( getRotEncMode, luaGetRotEncMode )
|
||||
LROT_FUNCENTRY( getValue, luaGetValue )
|
||||
LROT_FUNCENTRY( getOutputValue, luaGetOutputValue )
|
||||
LROT_FUNCENTRY( getSourceValue, luaGetSourceValue )
|
||||
LROT_FUNCENTRY( getTrainerStatus, luaGetTrainerStatus )
|
||||
LROT_FUNCENTRY( getRAS, luaGetRAS )
|
||||
LROT_FUNCENTRY( getTxGPS, luaGetTxGPS )
|
||||
LROT_FUNCENTRY( getFieldInfo, luaGetFieldInfo )
|
||||
LROT_FUNCENTRY( getSourceInfo, luaGetFieldInfo )
|
||||
LROT_FUNCENTRY( getFlightMode, luaGetFlightMode )
|
||||
LROT_FUNCENTRY( playFile, luaPlayFile )
|
||||
LROT_FUNCENTRY( playNumber, luaPlayNumber )
|
||||
LROT_FUNCENTRY( playDuration, luaPlayDuration )
|
||||
LROT_FUNCENTRY( playTone, luaPlayTone )
|
||||
LROT_FUNCENTRY( playHaptic, luaPlayHaptic )
|
||||
LROT_FUNCENTRY( flushAudio, luaFlushAudio )
|
||||
#if defined(ENABLE_LUA_POPUP_INPUT)
|
||||
{ "popupInput", luaPopupInput },
|
||||
LROT_FUNCENTRY( popupInput, luaPopupInput )
|
||||
#endif
|
||||
{ "popupWarning", luaPopupWarning },
|
||||
{ "popupConfirmation", luaPopupConfirmation },
|
||||
{ "defaultStick", luaDefaultStick },
|
||||
{ "defaultChannel", luaDefaultChannel },
|
||||
{ "getRSSI", luaGetRSSI },
|
||||
{ "killEvents", luaKillEvents },
|
||||
{ "dir", luaDir },
|
||||
{ "fstat", luaFstat },
|
||||
{ "chdir", luaChdir },
|
||||
{ "loadScript", luaLoadScript },
|
||||
{ "getUsage", luaGetUsage },
|
||||
{ "getAvailableMemory", luaGetAvailableMemory },
|
||||
{ "resetGlobalTimer", luaResetGlobalTimer },
|
||||
LROT_FUNCENTRY( popupWarning, luaPopupWarning )
|
||||
LROT_FUNCENTRY( popupConfirmation, luaPopupConfirmation )
|
||||
LROT_FUNCENTRY( defaultStick, luaDefaultStick )
|
||||
LROT_FUNCENTRY( defaultChannel, luaDefaultChannel )
|
||||
LROT_FUNCENTRY( getRSSI, luaGetRSSI )
|
||||
LROT_FUNCENTRY( killEvents, luaKillEvents )
|
||||
LROT_FUNCENTRY( chdir, luaChdir )
|
||||
LROT_FUNCENTRY( loadScript, luaLoadScript )
|
||||
LROT_FUNCENTRY( getUsage, luaGetUsage )
|
||||
LROT_FUNCENTRY( getAvailableMemory, luaGetAvailableMemory )
|
||||
LROT_FUNCENTRY( resetGlobalTimer, luaResetGlobalTimer )
|
||||
#if LCD_DEPTH > 1 && !defined(COLORLCD)
|
||||
{ "GREY", luaGrey },
|
||||
LROT_FUNCENTRY( GREY, luaGrey )
|
||||
#endif
|
||||
#if defined(PXX2)
|
||||
{ "accessTelemetryPush", luaAccessTelemetryPush },
|
||||
LROT_FUNCENTRY( accessTelemetryPush, luaAccessTelemetryPush )
|
||||
#endif
|
||||
{ "sportTelemetryPop", luaSportTelemetryPop },
|
||||
{ "sportTelemetryPush", luaSportTelemetryPush },
|
||||
{ "setTelemetryValue", luaSetTelemetryValue },
|
||||
LROT_FUNCENTRY( sportTelemetryPop, luaSportTelemetryPop )
|
||||
LROT_FUNCENTRY( sportTelemetryPush, luaSportTelemetryPush )
|
||||
LROT_FUNCENTRY( setTelemetryValue, luaSetTelemetryValue )
|
||||
#if defined(CROSSFIRE)
|
||||
{ "crossfireTelemetryPop", luaCrossfireTelemetryPop },
|
||||
{ "crossfireTelemetryPush", luaCrossfireTelemetryPush },
|
||||
LROT_FUNCENTRY( crossfireTelemetryPop, luaCrossfireTelemetryPop )
|
||||
LROT_FUNCENTRY( crossfireTelemetryPush, luaCrossfireTelemetryPush )
|
||||
#endif
|
||||
#if defined(GHOST)
|
||||
{ "ghostTelemetryPop", luaGhostTelemetryPop },
|
||||
{ "ghostTelemetryPush", luaGhostTelemetryPush },
|
||||
LROT_FUNCENTRY( ghostTelemetryPop, luaGhostTelemetryPop )
|
||||
LROT_FUNCENTRY( ghostTelemetryPush, luaGhostTelemetryPush )
|
||||
#endif
|
||||
#if defined(MULTIMODULE)
|
||||
{ "multiBuffer", luaMultiBuffer },
|
||||
LROT_FUNCENTRY( multiBuffer, luaMultiBuffer )
|
||||
#endif
|
||||
{ "setSerialBaudrate", luaSetSerialBaudrate },
|
||||
{ "serialWrite", luaSerialWrite },
|
||||
{ "serialRead", luaSerialRead },
|
||||
LROT_FUNCENTRY( setSerialBaudrate, luaSetSerialBaudrate )
|
||||
LROT_FUNCENTRY( serialWrite, luaSerialWrite )
|
||||
LROT_FUNCENTRY( serialRead, luaSerialRead )
|
||||
#if defined(COLORLCD)
|
||||
{ "setShmVar", luaSetShmVar },
|
||||
{ "getShmVar", luaGetShmVar },
|
||||
LROT_FUNCENTRY( setShmVar, luaSetShmVar )
|
||||
LROT_FUNCENTRY( getShmVar, luaGetShmVar )
|
||||
#endif
|
||||
{ "setStickySwitch", luaSetStickySwitch },
|
||||
{ "getLogicalSwitchValue", luaGetLogicalSwitchValue },
|
||||
{ "getSwitchIndex", luaGetSwitchIndex },
|
||||
{ "getSwitchName", luaGetSwitchName },
|
||||
{ "getSwitchValue", luaGetSwitchValue },
|
||||
{ "switches", luaSwitches },
|
||||
{ "getSourceIndex", luaGetSourceIndex },
|
||||
{ "getSourceName", luaGetSourceName },
|
||||
{ "sources", luaSources },
|
||||
{ nullptr, nullptr } /* sentinel */
|
||||
};
|
||||
LROT_FUNCENTRY( setStickySwitch, luaSetStickySwitch )
|
||||
LROT_FUNCENTRY( getLogicalSwitchValue, luaGetLogicalSwitchValue )
|
||||
LROT_FUNCENTRY( getSwitchIndex, luaGetSwitchIndex )
|
||||
LROT_FUNCENTRY( getSwitchName, luaGetSwitchName )
|
||||
LROT_FUNCENTRY( getSwitchValue, luaGetSwitchValue )
|
||||
LROT_FUNCENTRY( switches, luaSwitches )
|
||||
LROT_FUNCENTRY( getSourceIndex, luaGetSourceIndex )
|
||||
LROT_FUNCENTRY( getSourceName, luaGetSourceName )
|
||||
LROT_FUNCENTRY( sources, luaSources )
|
||||
LROT_END(etxlib, NULL, 0)
|
||||
|
||||
const luaR_value_entry opentxConstants[] = {
|
||||
{ "FULLSCALE", RESX },
|
||||
LROT_BEGIN(etxcst, NULL, 0)
|
||||
// Constants
|
||||
LROT_NUMENTRY( FULLSCALE, RESX )
|
||||
#if defined(COLORLCD)
|
||||
{ "XXLSIZE", FONT(XXL) },
|
||||
{ "DBLSIZE", FONT(XL) },
|
||||
{ "MIDSIZE", FONT(L) },
|
||||
{ "SMLSIZE", FONT(XS) },
|
||||
{ "TINSIZE", FONT(XXS) },
|
||||
{ "BLINK", BLINK },
|
||||
{ "INVERS", INVERS },
|
||||
LROT_NUMENTRY( XXLSIZE, FONT(XXL) )
|
||||
LROT_NUMENTRY( DBLSIZE, FONT(XL) )
|
||||
LROT_NUMENTRY( MIDSIZE, FONT(L) )
|
||||
LROT_NUMENTRY( SMLSIZE, FONT(XS) )
|
||||
LROT_NUMENTRY( TINSIZE, FONT(XXS) )
|
||||
LROT_NUMENTRY( BLINK, BLINK )
|
||||
LROT_NUMENTRY( INVERS, INVERS )
|
||||
#else
|
||||
{ "XXLSIZE", XXLSIZE },
|
||||
{ "DBLSIZE", DBLSIZE },
|
||||
{ "MIDSIZE", MIDSIZE },
|
||||
{ "SMLSIZE", SMLSIZE },
|
||||
{ "BLINK", BLINK },
|
||||
{ "INVERS", INVERS },
|
||||
LROT_NUMENTRY( XXLSIZE, XXLSIZE )
|
||||
LROT_NUMENTRY( DBLSIZE, DBLSIZE )
|
||||
LROT_NUMENTRY( MIDSIZE, MIDSIZE )
|
||||
LROT_NUMENTRY( SMLSIZE, SMLSIZE )
|
||||
LROT_NUMENTRY( BLINK, BLINK )
|
||||
LROT_NUMENTRY( INVERS, INVERS )
|
||||
#endif
|
||||
#if defined(COLORLCD)
|
||||
{ "BOLD", FONT(BOLD) },
|
||||
{ "VCENTER", VCENTERED },
|
||||
LROT_NUMENTRY( BOLD, FONT(BOLD) )
|
||||
LROT_NUMENTRY( VCENTER, VCENTERED )
|
||||
#else
|
||||
{ "BOLD", BOLD },
|
||||
LROT_NUMENTRY( BOLD, BOLD )
|
||||
#endif
|
||||
{ "RIGHT", RIGHT },
|
||||
{ "LEFT", LEFT },
|
||||
{ "CENTER", CENTERED },
|
||||
{ "PREC1", PREC1 },
|
||||
{ "PREC2", PREC2 },
|
||||
{ "VALUE", INPUT_TYPE_VALUE },
|
||||
{ "SOURCE", INPUT_TYPE_SOURCE },
|
||||
{ "REPLACE", MLTPX_REPL },
|
||||
{ "MIXSRC_MAX", MIXSRC_MAX },
|
||||
{ "MIXSRC_FIRST_INPUT", MIXSRC_FIRST_INPUT },
|
||||
{ "MIXSRC_Rud", MIXSRC_Rud },
|
||||
{ "MIXSRC_Ele", MIXSRC_Ele },
|
||||
{ "MIXSRC_Thr", MIXSRC_Thr },
|
||||
{ "MIXSRC_Ail", MIXSRC_Ail },
|
||||
{ "MIXSRC_SA", MIXSRC_SA },
|
||||
{ "MIXSRC_SB", MIXSRC_SB },
|
||||
{ "MIXSRC_SC", MIXSRC_SC },
|
||||
{ "MIXSRC_SD", MIXSRC_SD },
|
||||
LROT_NUMENTRY( RIGHT, RIGHT )
|
||||
LROT_NUMENTRY( LEFT, LEFT )
|
||||
LROT_NUMENTRY( CENTER, CENTERED )
|
||||
LROT_NUMENTRY( PREC1, PREC1 )
|
||||
LROT_NUMENTRY( PREC2, PREC2 )
|
||||
LROT_NUMENTRY( VALUE, INPUT_TYPE_VALUE )
|
||||
LROT_NUMENTRY( SOURCE, INPUT_TYPE_SOURCE )
|
||||
LROT_NUMENTRY( REPLACE, MLTPX_REPL )
|
||||
LROT_NUMENTRY( MIXSRC_MAX, MIXSRC_MAX )
|
||||
LROT_NUMENTRY( MIXSRC_FIRST_INPUT, MIXSRC_FIRST_INPUT )
|
||||
LROT_NUMENTRY( MIXSRC_Rud, MIXSRC_Rud )
|
||||
LROT_NUMENTRY( MIXSRC_Ele, MIXSRC_Ele )
|
||||
LROT_NUMENTRY( MIXSRC_Thr, MIXSRC_Thr )
|
||||
LROT_NUMENTRY( MIXSRC_Ail, MIXSRC_Ail )
|
||||
LROT_NUMENTRY( MIXSRC_SA, MIXSRC_SA )
|
||||
LROT_NUMENTRY( MIXSRC_SB, MIXSRC_SB )
|
||||
LROT_NUMENTRY( MIXSRC_SC, MIXSRC_SC )
|
||||
LROT_NUMENTRY( MIXSRC_SD, MIXSRC_SD )
|
||||
#if !defined(PCBX7) && !defined(PCBXLITE) && !defined(PCBX9LITE)
|
||||
{ "MIXSRC_SE", MIXSRC_SE },
|
||||
{ "MIXSRC_SG", MIXSRC_SG },
|
||||
LROT_NUMENTRY( MIXSRC_SE, MIXSRC_SE )
|
||||
LROT_NUMENTRY( MIXSRC_SG, MIXSRC_SG )
|
||||
#endif
|
||||
#if defined(HARDWARE_SWITCH_F)
|
||||
{ "MIXSRC_SF", MIXSRC_SF },
|
||||
LROT_NUMENTRY( MIXSRC_SF, MIXSRC_SF )
|
||||
#endif
|
||||
#if defined(HARDWARE_SWITCH_H)
|
||||
{ "MIXSRC_SH", MIXSRC_SH },
|
||||
LROT_NUMENTRY( MIXSRC_SH, MIXSRC_SH )
|
||||
#endif
|
||||
{ "MIXSRC_CH1", MIXSRC_CH1 },
|
||||
{ "SWSRC_LAST", SWSRC_LAST_LOGICAL_SWITCH },
|
||||
{ "SWITCH_COUNT", SWSRC_COUNT },
|
||||
{ "MAX_SENSORS", MAX_TELEMETRY_SENSORS },
|
||||
LROT_NUMENTRY( MIXSRC_CH1, MIXSRC_CH1 )
|
||||
LROT_NUMENTRY( SWSRC_LAST, SWSRC_LAST_LOGICAL_SWITCH )
|
||||
LROT_NUMENTRY( SWITCH_COUNT, SWSRC_COUNT )
|
||||
LROT_NUMENTRY( MAX_SENSORS, MAX_TELEMETRY_SENSORS )
|
||||
|
||||
{ "MAX_OUTPUT_CHANNELS", MAX_OUTPUT_CHANNELS },
|
||||
{ "LIMIT_EXT_PERCENT", LIMIT_EXT_PERCENT },
|
||||
{ "LIMIT_STD_PERCENT", LIMIT_STD_PERCENT },
|
||||
LROT_NUMENTRY( MAX_OUTPUT_CHANNELS, MAX_OUTPUT_CHANNELS )
|
||||
LROT_NUMENTRY( LIMIT_EXT_PERCENT, LIMIT_EXT_PERCENT )
|
||||
LROT_NUMENTRY( LIMIT_STD_PERCENT, LIMIT_STD_PERCENT )
|
||||
|
||||
{ "LS_FUNC_NONE", LS_FUNC_NONE },
|
||||
{ "LS_FUNC_VEQUAL", LS_FUNC_VEQUAL },
|
||||
{ "LS_FUNC_VALMOSTEQUAL", LS_FUNC_VALMOSTEQUAL },
|
||||
{ "LS_FUNC_VPOS", LS_FUNC_VPOS },
|
||||
{ "LS_FUNC_VNEG", LS_FUNC_VNEG },
|
||||
{ "LS_FUNC_RANGE", LS_FUNC_RANGE },
|
||||
{ "LS_FUNC_APOS", LS_FUNC_APOS },
|
||||
{ "LS_FUNC_ANEG", LS_FUNC_ANEG },
|
||||
{ "LS_FUNC_AND", LS_FUNC_AND },
|
||||
{ "LS_FUNC_OR", LS_FUNC_OR },
|
||||
{ "LS_FUNC_XOR", LS_FUNC_XOR },
|
||||
{ "LS_FUNC_EDGE", LS_FUNC_EDGE },
|
||||
{ "LS_FUNC_EQUAL", LS_FUNC_EQUAL },
|
||||
{ "LS_FUNC_GREATER", LS_FUNC_GREATER },
|
||||
{ "LS_FUNC_LESS", LS_FUNC_LESS },
|
||||
{ "LS_FUNC_DIFFEGREATER", LS_FUNC_DIFFEGREATER },
|
||||
{ "LS_FUNC_ADIFFEGREATER", LS_FUNC_ADIFFEGREATER },
|
||||
{ "LS_FUNC_TIMER", LS_FUNC_TIMER },
|
||||
{ "LS_FUNC_STICKY", LS_FUNC_STICKY },
|
||||
LROT_NUMENTRY( LS_FUNC_NONE, LS_FUNC_NONE )
|
||||
LROT_NUMENTRY( LS_FUNC_VEQUAL, LS_FUNC_VEQUAL )
|
||||
LROT_NUMENTRY( LS_FUNC_VALMOSTEQUAL, LS_FUNC_VALMOSTEQUAL )
|
||||
LROT_NUMENTRY( LS_FUNC_VPOS, LS_FUNC_VPOS )
|
||||
LROT_NUMENTRY( LS_FUNC_VNEG, LS_FUNC_VNEG )
|
||||
LROT_NUMENTRY( LS_FUNC_RANGE, LS_FUNC_RANGE )
|
||||
LROT_NUMENTRY( LS_FUNC_APOS, LS_FUNC_APOS )
|
||||
LROT_NUMENTRY( LS_FUNC_ANEG, LS_FUNC_ANEG )
|
||||
LROT_NUMENTRY( LS_FUNC_AND, LS_FUNC_AND )
|
||||
LROT_NUMENTRY( LS_FUNC_OR, LS_FUNC_OR )
|
||||
LROT_NUMENTRY( LS_FUNC_XOR, LS_FUNC_XOR )
|
||||
LROT_NUMENTRY( LS_FUNC_EDGE, LS_FUNC_EDGE )
|
||||
LROT_NUMENTRY( LS_FUNC_EQUAL, LS_FUNC_EQUAL )
|
||||
LROT_NUMENTRY( LS_FUNC_GREATER, LS_FUNC_GREATER )
|
||||
LROT_NUMENTRY( LS_FUNC_LESS, LS_FUNC_LESS )
|
||||
LROT_NUMENTRY( LS_FUNC_DIFFEGREATER, LS_FUNC_DIFFEGREATER )
|
||||
LROT_NUMENTRY( LS_FUNC_ADIFFEGREATER, LS_FUNC_ADIFFEGREATER )
|
||||
LROT_NUMENTRY( LS_FUNC_TIMER, LS_FUNC_TIMER )
|
||||
LROT_NUMENTRY( LS_FUNC_STICKY, LS_FUNC_STICKY )
|
||||
|
||||
{ "FUNC_OVERRIDE_CHANNEL", FUNC_OVERRIDE_CHANNEL },
|
||||
{ "FUNC_TRAINER", FUNC_TRAINER },
|
||||
{ "FUNC_INSTANT_TRIM", FUNC_INSTANT_TRIM },
|
||||
{ "FUNC_RESET", FUNC_RESET },
|
||||
{ "FUNC_SET_TIMER", FUNC_SET_TIMER },
|
||||
{ "FUNC_ADJUST_GVAR", FUNC_ADJUST_GVAR },
|
||||
{ "FUNC_VOLUME", FUNC_VOLUME },
|
||||
{ "FUNC_SET_FAILSAFE", FUNC_SET_FAILSAFE },
|
||||
{ "FUNC_RANGECHECK", FUNC_RANGECHECK },
|
||||
{ "FUNC_BIND", FUNC_BIND },
|
||||
{ "FUNC_PLAY_SOUND", FUNC_PLAY_SOUND },
|
||||
{ "FUNC_PLAY_TRACK", FUNC_PLAY_TRACK },
|
||||
{ "FUNC_PLAY_VALUE", FUNC_PLAY_VALUE },
|
||||
{ "FUNC_PLAY_SCRIPT", FUNC_PLAY_SCRIPT },
|
||||
{ "FUNC_BACKGND_MUSIC", FUNC_BACKGND_MUSIC },
|
||||
{ "FUNC_BACKGND_MUSIC_PAUSE", FUNC_BACKGND_MUSIC_PAUSE },
|
||||
{ "FUNC_VARIO", FUNC_VARIO },
|
||||
{ "FUNC_HAPTIC", FUNC_HAPTIC },
|
||||
{ "FUNC_LOGS", FUNC_LOGS },
|
||||
{ "FUNC_BACKLIGHT", FUNC_BACKLIGHT },
|
||||
{ "FUNC_SCREENSHOT", FUNC_SCREENSHOT },
|
||||
{ "FUNC_RACING_MODE", FUNC_RACING_MODE },
|
||||
LROT_NUMENTRY( FUNC_OVERRIDE_CHANNEL, FUNC_OVERRIDE_CHANNEL )
|
||||
LROT_NUMENTRY( FUNC_TRAINER, FUNC_TRAINER )
|
||||
LROT_NUMENTRY( FUNC_INSTANT_TRIM, FUNC_INSTANT_TRIM )
|
||||
LROT_NUMENTRY( FUNC_RESET, FUNC_RESET )
|
||||
LROT_NUMENTRY( FUNC_SET_TIMER, FUNC_SET_TIMER )
|
||||
LROT_NUMENTRY( FUNC_ADJUST_GVAR, FUNC_ADJUST_GVAR )
|
||||
LROT_NUMENTRY( FUNC_VOLUME, FUNC_VOLUME )
|
||||
LROT_NUMENTRY( FUNC_SET_FAILSAFE, FUNC_SET_FAILSAFE )
|
||||
LROT_NUMENTRY( FUNC_RANGECHECK, FUNC_RANGECHECK )
|
||||
LROT_NUMENTRY( FUNC_BIND, FUNC_BIND )
|
||||
LROT_NUMENTRY( FUNC_PLAY_SOUND, FUNC_PLAY_SOUND )
|
||||
LROT_NUMENTRY( FUNC_PLAY_TRACK, FUNC_PLAY_TRACK )
|
||||
LROT_NUMENTRY( FUNC_PLAY_VALUE, FUNC_PLAY_VALUE )
|
||||
LROT_NUMENTRY( FUNC_PLAY_SCRIPT, FUNC_PLAY_SCRIPT )
|
||||
LROT_NUMENTRY( FUNC_BACKGND_MUSIC, FUNC_BACKGND_MUSIC )
|
||||
LROT_NUMENTRY( FUNC_BACKGND_MUSIC_PAUSE, FUNC_BACKGND_MUSIC_PAUSE )
|
||||
LROT_NUMENTRY( FUNC_VARIO, FUNC_VARIO )
|
||||
LROT_NUMENTRY( FUNC_HAPTIC, FUNC_HAPTIC )
|
||||
LROT_NUMENTRY( FUNC_LOGS, FUNC_LOGS )
|
||||
LROT_NUMENTRY( FUNC_BACKLIGHT, FUNC_BACKLIGHT )
|
||||
LROT_NUMENTRY( FUNC_SCREENSHOT, FUNC_SCREENSHOT )
|
||||
LROT_NUMENTRY( FUNC_RACING_MODE, FUNC_RACING_MODE )
|
||||
#if defined(COLORLCD)
|
||||
{ "FUNC_DISABLE_TOUCH", FUNC_DISABLE_TOUCH },
|
||||
{ "FUNC_SET_SCREEN", FUNC_SET_SCREEN },
|
||||
LROT_NUMENTRY( FUNC_DISABLE_TOUCH, FUNC_DISABLE_TOUCH )
|
||||
LROT_NUMENTRY( FUNC_SET_SCREEN, FUNC_SET_SCREEN )
|
||||
|
||||
{ "SHADOWED", SHADOWED },
|
||||
{ "COLOR", ZoneOption::Color },
|
||||
{ "BOOL", ZoneOption::Bool },
|
||||
{ "STRING", ZoneOption::String },
|
||||
{ "TIMER", ZoneOption::Timer },
|
||||
{ "TEXT_SIZE", ZoneOption::TextSize },
|
||||
{ "MENU_HEADER_HEIGHT", COLOR2FLAGS(MENU_HEADER_HEIGHT) },
|
||||
LROT_NUMENTRY( SHADOWED, SHADOWED )
|
||||
LROT_NUMENTRY( COLOR, ZoneOption::Color )
|
||||
LROT_NUMENTRY( BOOL, ZoneOption::Bool )
|
||||
LROT_NUMENTRY( STRING, ZoneOption::String )
|
||||
LROT_NUMENTRY( TIMER, ZoneOption::Timer )
|
||||
LROT_NUMENTRY( TEXT_SIZE, ZoneOption::TextSize )
|
||||
LROT_NUMENTRY( MENU_HEADER_HEIGHT, COLOR2FLAGS(MENU_HEADER_HEIGHT) )
|
||||
|
||||
// Colors gui/colorlcd/colors.h
|
||||
{ "COLOR_THEME_PRIMARY1", COLOR2FLAGS(COLOR_THEME_PRIMARY1_INDEX) },
|
||||
{ "COLOR_THEME_PRIMARY2", COLOR2FLAGS(COLOR_THEME_PRIMARY2_INDEX) },
|
||||
{ "COLOR_THEME_PRIMARY3", COLOR2FLAGS(COLOR_THEME_PRIMARY3_INDEX) },
|
||||
{ "COLOR_THEME_SECONDARY1", COLOR2FLAGS(COLOR_THEME_SECONDARY1_INDEX) },
|
||||
{ "COLOR_THEME_SECONDARY2", COLOR2FLAGS(COLOR_THEME_SECONDARY2_INDEX) },
|
||||
{ "COLOR_THEME_SECONDARY3", COLOR2FLAGS(COLOR_THEME_SECONDARY3_INDEX) },
|
||||
{ "COLOR_THEME_FOCUS", COLOR2FLAGS(COLOR_THEME_FOCUS_INDEX) },
|
||||
{ "COLOR_THEME_EDIT", COLOR2FLAGS(COLOR_THEME_EDIT_INDEX) },
|
||||
{ "COLOR_THEME_ACTIVE", COLOR2FLAGS(COLOR_THEME_ACTIVE_INDEX) },
|
||||
{ "COLOR_THEME_WARNING", COLOR2FLAGS(COLOR_THEME_WARNING_INDEX) },
|
||||
{ "COLOR_THEME_DISABLED", COLOR2FLAGS(COLOR_THEME_DISABLED_INDEX) },
|
||||
{ "CUSTOM_COLOR", COLOR2FLAGS(CUSTOM_COLOR_INDEX) },
|
||||
LROT_NUMENTRY( COLOR_THEME_PRIMARY1, COLOR2FLAGS(COLOR_THEME_PRIMARY1_INDEX) )
|
||||
LROT_NUMENTRY( COLOR_THEME_PRIMARY2, COLOR2FLAGS(COLOR_THEME_PRIMARY2_INDEX) )
|
||||
LROT_NUMENTRY( COLOR_THEME_PRIMARY3, COLOR2FLAGS(COLOR_THEME_PRIMARY3_INDEX) )
|
||||
LROT_NUMENTRY( COLOR_THEME_SECONDARY1, COLOR2FLAGS(COLOR_THEME_SECONDARY1_INDEX) )
|
||||
LROT_NUMENTRY( COLOR_THEME_SECONDARY2, COLOR2FLAGS(COLOR_THEME_SECONDARY2_INDEX) )
|
||||
LROT_NUMENTRY( COLOR_THEME_SECONDARY3, COLOR2FLAGS(COLOR_THEME_SECONDARY3_INDEX) )
|
||||
LROT_NUMENTRY( COLOR_THEME_FOCUS, COLOR2FLAGS(COLOR_THEME_FOCUS_INDEX) )
|
||||
LROT_NUMENTRY( COLOR_THEME_EDIT, COLOR2FLAGS(COLOR_THEME_EDIT_INDEX) )
|
||||
LROT_NUMENTRY( COLOR_THEME_ACTIVE, COLOR2FLAGS(COLOR_THEME_ACTIVE_INDEX) )
|
||||
LROT_NUMENTRY( COLOR_THEME_WARNING, COLOR2FLAGS(COLOR_THEME_WARNING_INDEX) )
|
||||
LROT_NUMENTRY( COLOR_THEME_DISABLED, COLOR2FLAGS(COLOR_THEME_DISABLED_INDEX) )
|
||||
LROT_NUMENTRY( CUSTOM_COLOR, COLOR2FLAGS(CUSTOM_COLOR_INDEX) )
|
||||
|
||||
// Old style theme color constants
|
||||
{ "ALARM_COLOR", COLOR2FLAGS(COLOR_THEME_WARNING_INDEX) },
|
||||
{ "BARGRAPH_BGCOLOR", COLOR2FLAGS(COLOR_THEME_SECONDARY3_INDEX) },
|
||||
{ "BARGRAPH1_COLOR", COLOR2FLAGS(COLOR_THEME_SECONDARY1_INDEX) },
|
||||
{ "BARGRAPH2_COLOR", COLOR2FLAGS(COLOR_THEME_SECONDARY2_INDEX) },
|
||||
{ "CURVE_AXIS_COLOR", COLOR2FLAGS(COLOR_THEME_SECONDARY2_INDEX) },
|
||||
{ "CURVE_COLOR", COLOR2FLAGS(COLOR_THEME_SECONDARY1_INDEX) },
|
||||
{ "CURVE_CURSOR_COLOR", COLOR2FLAGS(COLOR_THEME_WARNING_INDEX) },
|
||||
{ "HEADER_BGCOLOR", COLOR2FLAGS(COLOR_THEME_FOCUS_INDEX) },
|
||||
{ "HEADER_COLOR", COLOR2FLAGS(COLOR_THEME_SECONDARY1_INDEX) },
|
||||
{ "HEADER_CURRENT_BGCOLOR", COLOR2FLAGS(COLOR_THEME_FOCUS_INDEX) },
|
||||
{ "HEADER_ICON_BGCOLOR", COLOR2FLAGS(COLOR_THEME_SECONDARY1_INDEX) },
|
||||
{ "LINE_COLOR", COLOR2FLAGS(COLOR_THEME_PRIMARY3_INDEX) },
|
||||
{ "MAINVIEW_GRAPHICS_COLOR", COLOR2FLAGS(COLOR_THEME_SECONDARY1_INDEX) },
|
||||
{ "MAINVIEW_PANES_COLOR", COLOR2FLAGS(COLOR_THEME_PRIMARY2_INDEX) },
|
||||
{ "MENU_TITLE_BGCOLOR", COLOR2FLAGS(COLOR_THEME_SECONDARY1_INDEX) },
|
||||
{ "MENU_TITLE_COLOR", COLOR2FLAGS(COLOR_THEME_PRIMARY2_INDEX) },
|
||||
{ "MENU_TITLE_DISABLE_COLOR", COLOR2FLAGS(COLOR_THEME_PRIMARY3_INDEX) },
|
||||
{ "OVERLAY_COLOR", COLOR2FLAGS(COLOR_THEME_PRIMARY1_INDEX) },
|
||||
{ "SCROLLBOX_COLOR", COLOR2FLAGS(COLOR_THEME_SECONDARY3_INDEX) },
|
||||
{ "TEXT_BGCOLOR", COLOR2FLAGS(COLOR_THEME_SECONDARY3_INDEX) },
|
||||
{ "TEXT_COLOR", COLOR2FLAGS(COLOR_THEME_SECONDARY1_INDEX) },
|
||||
{ "TEXT_DISABLE_COLOR", COLOR2FLAGS(COLOR_THEME_DISABLED_INDEX) },
|
||||
{ "TEXT_INVERTED_BGCOLOR", COLOR2FLAGS(COLOR_THEME_FOCUS_INDEX) },
|
||||
{ "TEXT_INVERTED_COLOR", COLOR2FLAGS(COLOR_THEME_PRIMARY2_INDEX) },
|
||||
{ "TITLE_BGCOLOR", COLOR2FLAGS(COLOR_THEME_SECONDARY1_INDEX) },
|
||||
{ "TRIM_BGCOLOR", COLOR2FLAGS(COLOR_THEME_FOCUS_INDEX) },
|
||||
{ "TRIM_SHADOW_COLOR", COLOR2FLAGS(COLOR_THEME_PRIMARY1_INDEX) },
|
||||
{ "WARNING_COLOR", COLOR2FLAGS(COLOR_THEME_WARNING_INDEX) },
|
||||
LROT_NUMENTRY( ALARM_COLOR, COLOR2FLAGS(COLOR_THEME_WARNING_INDEX) )
|
||||
LROT_NUMENTRY( BARGRAPH_BGCOLOR, COLOR2FLAGS(COLOR_THEME_SECONDARY3_INDEX) )
|
||||
LROT_NUMENTRY( BARGRAPH1_COLOR, COLOR2FLAGS(COLOR_THEME_SECONDARY1_INDEX) )
|
||||
LROT_NUMENTRY( BARGRAPH2_COLOR, COLOR2FLAGS(COLOR_THEME_SECONDARY2_INDEX) )
|
||||
LROT_NUMENTRY( CURVE_AXIS_COLOR, COLOR2FLAGS(COLOR_THEME_SECONDARY2_INDEX) )
|
||||
LROT_NUMENTRY( CURVE_COLOR, COLOR2FLAGS(COLOR_THEME_SECONDARY1_INDEX) )
|
||||
LROT_NUMENTRY( CURVE_CURSOR_COLOR, COLOR2FLAGS(COLOR_THEME_WARNING_INDEX) )
|
||||
LROT_NUMENTRY( HEADER_BGCOLOR, COLOR2FLAGS(COLOR_THEME_FOCUS_INDEX) )
|
||||
LROT_NUMENTRY( HEADER_COLOR, COLOR2FLAGS(COLOR_THEME_SECONDARY1_INDEX) )
|
||||
LROT_NUMENTRY( HEADER_CURRENT_BGCOLOR, COLOR2FLAGS(COLOR_THEME_FOCUS_INDEX) )
|
||||
LROT_NUMENTRY( HEADER_ICON_BGCOLOR, COLOR2FLAGS(COLOR_THEME_SECONDARY1_INDEX) )
|
||||
LROT_NUMENTRY( LINE_COLOR, COLOR2FLAGS(COLOR_THEME_PRIMARY3_INDEX) )
|
||||
LROT_NUMENTRY( MAINVIEW_GRAPHICS_COLOR, COLOR2FLAGS(COLOR_THEME_SECONDARY1_INDEX) )
|
||||
LROT_NUMENTRY( MAINVIEW_PANES_COLOR, COLOR2FLAGS(COLOR_THEME_PRIMARY2_INDEX) )
|
||||
LROT_NUMENTRY( MENU_TITLE_BGCOLOR, COLOR2FLAGS(COLOR_THEME_SECONDARY1_INDEX) )
|
||||
LROT_NUMENTRY( MENU_TITLE_COLOR, COLOR2FLAGS(COLOR_THEME_PRIMARY2_INDEX) )
|
||||
LROT_NUMENTRY( MENU_TITLE_DISABLE_COLOR, COLOR2FLAGS(COLOR_THEME_PRIMARY3_INDEX) )
|
||||
LROT_NUMENTRY( OVERLAY_COLOR, COLOR2FLAGS(COLOR_THEME_PRIMARY1_INDEX) )
|
||||
LROT_NUMENTRY( SCROLLBOX_COLOR, COLOR2FLAGS(COLOR_THEME_SECONDARY3_INDEX) )
|
||||
LROT_NUMENTRY( TEXT_BGCOLOR, COLOR2FLAGS(COLOR_THEME_SECONDARY3_INDEX) )
|
||||
LROT_NUMENTRY( TEXT_COLOR, COLOR2FLAGS(COLOR_THEME_SECONDARY1_INDEX) )
|
||||
LROT_NUMENTRY( TEXT_DISABLE_COLOR, COLOR2FLAGS(COLOR_THEME_DISABLED_INDEX) )
|
||||
LROT_NUMENTRY( TEXT_INVERTED_BGCOLOR, COLOR2FLAGS(COLOR_THEME_FOCUS_INDEX) )
|
||||
LROT_NUMENTRY( TEXT_INVERTED_COLOR, COLOR2FLAGS(COLOR_THEME_PRIMARY2_INDEX) )
|
||||
LROT_NUMENTRY( TITLE_BGCOLOR, COLOR2FLAGS(COLOR_THEME_SECONDARY1_INDEX) )
|
||||
LROT_NUMENTRY( TRIM_BGCOLOR, COLOR2FLAGS(COLOR_THEME_FOCUS_INDEX) )
|
||||
LROT_NUMENTRY( TRIM_SHADOW_COLOR, COLOR2FLAGS(COLOR_THEME_PRIMARY1_INDEX) )
|
||||
LROT_NUMENTRY( WARNING_COLOR, COLOR2FLAGS(COLOR_THEME_WARNING_INDEX) )
|
||||
|
||||
// Literal colors
|
||||
{ "BLACK", RGB2FLAGS(0x00, 0x00, 0x00) },
|
||||
{ "WHITE", RGB2FLAGS(0xFF, 0xFF, 0xFF) },
|
||||
{ "LIGHTWHITE", RGB2FLAGS(0xEA, 0xEA, 0xEA) },
|
||||
{ "YELLOW", RGB2FLAGS(0xFF, 0xFF, 0x00) },
|
||||
{ "BLUE", RGB2FLAGS(0x00, 0x00, 0xFF) },
|
||||
{ "DARKBLUE", RGB2FLAGS(0x00, 0x00, 0xA0) },
|
||||
{ "GREY", RGB2FLAGS(0x60, 0x60, 0x60) },
|
||||
{ "DARKGREY", RGB2FLAGS(0x40, 0x40, 0x40) },
|
||||
{ "LIGHTGREY", RGB2FLAGS(0xC0, 0xC0, 0xC0) },
|
||||
{ "RED", RGB2FLAGS(0xFF, 0x00, 0x00) },
|
||||
{ "DARKRED", RGB2FLAGS(0xA0, 0x00, 0x00) },
|
||||
{ "GREEN", RGB2FLAGS(0x00, 0xFF, 0x00) },
|
||||
{ "DARKGREEN", RGB2FLAGS(0x00, 0xA0, 0x00) },
|
||||
{ "LIGHTBROWN", RGB2FLAGS(0x9C, 0x6D, 0x20) },
|
||||
{ "DARKBROWN", RGB2FLAGS(0x6A, 0x48, 0x10) },
|
||||
{ "BRIGHTGREEN", RGB2FLAGS(0x00, 0xB4, 0x3C) },
|
||||
{ "ORANGE", RGB2FLAGS(0xE5, 0x64, 0x1E) },
|
||||
LROT_NUMENTRY( BLACK, RGB2FLAGS(0x00, 0x00, 0x00) )
|
||||
LROT_NUMENTRY( WHITE, RGB2FLAGS(0xFF, 0xFF, 0xFF) )
|
||||
LROT_NUMENTRY( LIGHTWHITE, RGB2FLAGS(0xEA, 0xEA, 0xEA) )
|
||||
LROT_NUMENTRY( YELLOW, RGB2FLAGS(0xFF, 0xFF, 0x00) )
|
||||
LROT_NUMENTRY( BLUE, RGB2FLAGS(0x00, 0x00, 0xFF) )
|
||||
LROT_NUMENTRY( DARKBLUE, RGB2FLAGS(0x00, 0x00, 0xA0) )
|
||||
LROT_NUMENTRY( GREY, RGB2FLAGS(0x60, 0x60, 0x60) )
|
||||
LROT_NUMENTRY( DARKGREY, RGB2FLAGS(0x40, 0x40, 0x40) )
|
||||
LROT_NUMENTRY( LIGHTGREY, RGB2FLAGS(0xC0, 0xC0, 0xC0) )
|
||||
LROT_NUMENTRY( RED, RGB2FLAGS(0xFF, 0x00, 0x00) )
|
||||
LROT_NUMENTRY( DARKRED, RGB2FLAGS(0xA0, 0x00, 0x00) )
|
||||
LROT_NUMENTRY( GREEN, RGB2FLAGS(0x00, 0xFF, 0x00) )
|
||||
LROT_NUMENTRY( DARKGREEN, RGB2FLAGS(0x00, 0xA0, 0x00) )
|
||||
LROT_NUMENTRY( LIGHTBROWN, RGB2FLAGS(0x9C, 0x6D, 0x20) )
|
||||
LROT_NUMENTRY( DARKBROWN, RGB2FLAGS(0x6A, 0x48, 0x10) )
|
||||
LROT_NUMENTRY( BRIGHTGREEN, RGB2FLAGS(0x00, 0xB4, 0x3C) )
|
||||
LROT_NUMENTRY( ORANGE, RGB2FLAGS(0xE5, 0x64, 0x1E) )
|
||||
|
||||
#else
|
||||
{ "FIXEDWIDTH", FIXEDWIDTH },
|
||||
LROT_NUMENTRY( FIXEDWIDTH, FIXEDWIDTH )
|
||||
#endif
|
||||
|
||||
// Virtual events
|
||||
#if defined(ROTARY_ENCODER_NAVIGATION)
|
||||
{ "EVT_VIRTUAL_PREV", EVT_ROTARY_LEFT },
|
||||
{ "EVT_VIRTUAL_NEXT", EVT_ROTARY_RIGHT },
|
||||
{ "EVT_VIRTUAL_DEC", EVT_ROTARY_LEFT },
|
||||
{ "EVT_VIRTUAL_INC", EVT_ROTARY_RIGHT },
|
||||
{ "ROTENC_LOWSPEED", ROTENC_LOWSPEED },
|
||||
{ "ROTENC_MIDSPEED", ROTENC_MIDSPEED },
|
||||
{ "ROTENC_HIGHSPEED", ROTENC_HIGHSPEED },
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_PREV, EVT_ROTARY_LEFT )
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_NEXT, EVT_ROTARY_RIGHT )
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_DEC, EVT_ROTARY_LEFT )
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_INC, EVT_ROTARY_RIGHT )
|
||||
LROT_NUMENTRY( ROTENC_LOWSPEED, ROTENC_LOWSPEED )
|
||||
LROT_NUMENTRY( ROTENC_MIDSPEED, ROTENC_MIDSPEED )
|
||||
LROT_NUMENTRY( ROTENC_HIGHSPEED, ROTENC_HIGHSPEED )
|
||||
#elif defined(PCBX9D) || defined(PCBX9DP) || defined(RADIO_T8) || defined(RADIO_COMMANDO8)// key reverted between field nav and value change
|
||||
{ "EVT_VIRTUAL_PREV", EVT_KEY_FIRST(KEY_PLUS) },
|
||||
{ "EVT_VIRTUAL_PREV_REPT", EVT_KEY_REPT(KEY_PLUS) },
|
||||
{ "EVT_VIRTUAL_NEXT", EVT_KEY_FIRST(KEY_MINUS) },
|
||||
{ "EVT_VIRTUAL_NEXT_REPT", EVT_KEY_REPT(KEY_MINUS) },
|
||||
{ "EVT_VIRTUAL_DEC", EVT_KEY_FIRST(KEY_MINUS) },
|
||||
{ "EVT_VIRTUAL_DEC_REPT", EVT_KEY_REPT(KEY_MINUS) },
|
||||
{ "EVT_VIRTUAL_INC", EVT_KEY_FIRST(KEY_PLUS) },
|
||||
{ "EVT_VIRTUAL_INC_REPT", EVT_KEY_REPT(KEY_PLUS) },
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_PREV, EVT_KEY_FIRST(KEY_PLUS) )
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_PREV_REPT, EVT_KEY_REPT(KEY_PLUS) )
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_NEXT, EVT_KEY_FIRST(KEY_MINUS) )
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_NEXT_REPT, EVT_KEY_REPT(KEY_MINUS) )
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_DEC, EVT_KEY_FIRST(KEY_MINUS) )
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_DEC_REPT, EVT_KEY_REPT(KEY_MINUS) )
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_INC, EVT_KEY_FIRST(KEY_PLUS) )
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_INC_REPT, EVT_KEY_REPT(KEY_PLUS) )
|
||||
#else
|
||||
{ "EVT_VIRTUAL_PREV", EVT_KEY_FIRST(KEY_UP) },
|
||||
{ "EVT_VIRTUAL_PREV_REPT", EVT_KEY_REPT(KEY_UP) },
|
||||
{ "EVT_VIRTUAL_NEXT", EVT_KEY_FIRST(KEY_DOWN) },
|
||||
{ "EVT_VIRTUAL_NEXT_REPT", EVT_KEY_REPT(KEY_DOWN) },
|
||||
{ "EVT_VIRTUAL_DEC", EVT_KEY_FIRST(KEY_DOWN) },
|
||||
{ "EVT_VIRTUAL_DEC_REPT", EVT_KEY_REPT(KEY_DOWN) },
|
||||
{ "EVT_VIRTUAL_INC", EVT_KEY_FIRST(KEY_UP) },
|
||||
{ "EVT_VIRTUAL_INC_REPT", EVT_KEY_REPT(KEY_UP) },
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_PREV, EVT_KEY_FIRST(KEY_UP) )
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_PREV_REPT, EVT_KEY_REPT(KEY_UP) )
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_NEXT, EVT_KEY_FIRST(KEY_DOWN) )
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_NEXT_REPT, EVT_KEY_REPT(KEY_DOWN) )
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_DEC, EVT_KEY_FIRST(KEY_DOWN) )
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_DEC_REPT, EVT_KEY_REPT(KEY_DOWN) )
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_INC, EVT_KEY_FIRST(KEY_UP) )
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_INC_REPT, EVT_KEY_REPT(KEY_UP) )
|
||||
#endif
|
||||
|
||||
#if defined(NAVIGATION_9X)
|
||||
{ "EVT_VIRTUAL_PREV_PAGE", EVT_KEY_LONG(KEY_LEFT) },
|
||||
{ "EVT_VIRTUAL_NEXT_PAGE", EVT_KEY_BREAK(KEY_LEFT) },
|
||||
{ "EVT_VIRTUAL_MENU", EVT_KEY_BREAK(KEY_RIGHT) },
|
||||
{ "EVT_VIRTUAL_MENU_LONG", EVT_KEY_LONG(KEY_RIGHT) },
|
||||
{ "EVT_VIRTUAL_ENTER", EVT_KEY_BREAK(KEY_ENTER) },
|
||||
{ "EVT_VIRTUAL_ENTER_LONG", EVT_KEY_LONG(KEY_ENTER) },
|
||||
{ "EVT_VIRTUAL_EXIT", EVT_KEY_BREAK(KEY_EXIT) },
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_PREV_PAGE, EVT_KEY_LONG(KEY_LEFT) )
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_NEXT_PAGE, EVT_KEY_BREAK(KEY_LEFT) )
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_MENU, EVT_KEY_BREAK(KEY_RIGHT) )
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_MENU_LONG, EVT_KEY_LONG(KEY_RIGHT) )
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_ENTER, EVT_KEY_BREAK(KEY_ENTER) )
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_ENTER_LONG, EVT_KEY_LONG(KEY_ENTER) )
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_EXIT, EVT_KEY_BREAK(KEY_EXIT) )
|
||||
#elif defined(NAVIGATION_XLITE)
|
||||
{ "EVT_VIRTUAL_PREV_PAGE", EVT_KEY_LONG(KEY_LEFT) },
|
||||
{ "EVT_VIRTUAL_NEXT_PAGE", EVT_KEY_LONG(KEY_RIGHT) },
|
||||
{ "EVT_VIRTUAL_MENU", EVT_KEY_BREAK(KEY_SHIFT) },
|
||||
{ "EVT_VIRTUAL_MENU_LONG", EVT_KEY_LONG(KEY_SHIFT) },
|
||||
{ "EVT_VIRTUAL_ENTER", EVT_KEY_BREAK(KEY_ENTER) },
|
||||
{ "EVT_VIRTUAL_ENTER_LONG", EVT_KEY_LONG(KEY_ENTER) },
|
||||
{ "EVT_VIRTUAL_EXIT", EVT_KEY_BREAK(KEY_EXIT) },
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_PREV_PAGE, EVT_KEY_LONG(KEY_LEFT) )
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_NEXT_PAGE, EVT_KEY_LONG(KEY_RIGHT) )
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_MENU, EVT_KEY_BREAK(KEY_SHIFT) )
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_MENU_LONG, EVT_KEY_LONG(KEY_SHIFT) )
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_ENTER, EVT_KEY_BREAK(KEY_ENTER) )
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_ENTER_LONG, EVT_KEY_LONG(KEY_ENTER) )
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_EXIT, EVT_KEY_BREAK(KEY_EXIT) )
|
||||
#elif defined(NAVIGATION_X7) || defined(NAVIGATION_X9D)
|
||||
#if defined(RADIO_TX12) || defined(RADIO_TX12MK2) || defined(RADIO_BOXER) || defined(RADIO_ZORRO) || defined(RADIO_T8) || defined(RADIO_COMMANDO8)
|
||||
{ "EVT_VIRTUAL_PREV_PAGE", EVT_KEY_BREAK(KEY_PAGEUP) },
|
||||
{ "EVT_VIRTUAL_NEXT_PAGE", EVT_KEY_BREAK(KEY_PAGEDN) },
|
||||
{ "EVT_VIRTUAL_MENU", EVT_KEY_BREAK(KEY_MODEL) },
|
||||
{ "EVT_VIRTUAL_MENU_LONG", EVT_KEY_LONG(KEY_MODEL) },
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_PREV_PAGE, EVT_KEY_BREAK(KEY_PAGEUP) )
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_NEXT_PAGE, EVT_KEY_BREAK(KEY_PAGEDN) )
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_MENU, EVT_KEY_BREAK(KEY_MODEL) )
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_MENU_LONG, EVT_KEY_LONG(KEY_MODEL) )
|
||||
#else
|
||||
{ "EVT_VIRTUAL_PREV_PAGE", EVT_KEY_LONG(KEY_PAGE) },
|
||||
{ "EVT_VIRTUAL_NEXT_PAGE", EVT_KEY_BREAK(KEY_PAGE) },
|
||||
{ "EVT_VIRTUAL_MENU", EVT_KEY_BREAK(KEY_MENU) },
|
||||
{ "EVT_VIRTUAL_MENU_LONG", EVT_KEY_LONG(KEY_MENU) },
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_PREV_PAGE, EVT_KEY_LONG(KEY_PAGE) )
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_NEXT_PAGE, EVT_KEY_BREAK(KEY_PAGE) )
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_MENU, EVT_KEY_BREAK(KEY_MENU) )
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_MENU_LONG, EVT_KEY_LONG(KEY_MENU) )
|
||||
#endif
|
||||
{ "EVT_VIRTUAL_ENTER", EVT_KEY_BREAK(KEY_ENTER) },
|
||||
{ "EVT_VIRTUAL_ENTER_LONG", EVT_KEY_LONG(KEY_ENTER) },
|
||||
{ "EVT_VIRTUAL_EXIT", EVT_KEY_BREAK(KEY_EXIT) },
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_ENTER, EVT_KEY_BREAK(KEY_ENTER) )
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_ENTER_LONG, EVT_KEY_LONG(KEY_ENTER) )
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_EXIT, EVT_KEY_BREAK(KEY_EXIT) )
|
||||
#elif defined(COLORLCD)
|
||||
#if defined(KEYS_GPIO_REG_PGUP)
|
||||
{ "EVT_VIRTUAL_PREV_PAGE", EVT_KEY_BREAK(KEY_PGUP) },
|
||||
{ "EVT_VIRTUAL_NEXT_PAGE", EVT_KEY_BREAK(KEY_PGDN) },
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_PREV_PAGE, EVT_KEY_BREAK(KEY_PGUP) )
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_NEXT_PAGE, EVT_KEY_BREAK(KEY_PGDN) )
|
||||
#elif defined(PCBNV14)
|
||||
{ "EVT_VIRTUAL_PREV_PAGE", EVT_KEY_BREAK(KEY_LEFT) },
|
||||
{ "EVT_VIRTUAL_NEXT_PAGE", EVT_KEY_BREAK(KEY_RIGHT) },
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_PREV_PAGE, EVT_KEY_BREAK(KEY_LEFT) )
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_NEXT_PAGE, EVT_KEY_BREAK(KEY_RIGHT) )
|
||||
#else
|
||||
{ "EVT_VIRTUAL_PREV_PAGE", EVT_KEY_LONG(KEY_PGDN) },
|
||||
{ "EVT_VIRTUAL_NEXT_PAGE", EVT_KEY_BREAK(KEY_PGDN) },
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_PREV_PAGE, EVT_KEY_LONG(KEY_PGDN) )
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_NEXT_PAGE, EVT_KEY_BREAK(KEY_PGDN) )
|
||||
#endif
|
||||
{ "EVT_VIRTUAL_MENU", EVT_KEY_BREAK(KEY_MODEL) },
|
||||
{ "EVT_VIRTUAL_MENU_LONG", EVT_KEY_LONG(KEY_MODEL) },
|
||||
{ "EVT_VIRTUAL_ENTER", EVT_KEY_BREAK(KEY_ENTER) },
|
||||
{ "EVT_VIRTUAL_ENTER_LONG", EVT_KEY_LONG(KEY_ENTER) },
|
||||
{ "EVT_VIRTUAL_EXIT", EVT_KEY_BREAK(KEY_EXIT) },
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_MENU, EVT_KEY_BREAK(KEY_MODEL) )
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_MENU_LONG, EVT_KEY_LONG(KEY_MODEL) )
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_ENTER, EVT_KEY_BREAK(KEY_ENTER) )
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_ENTER_LONG, EVT_KEY_LONG(KEY_ENTER) )
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_EXIT, EVT_KEY_BREAK(KEY_EXIT) )
|
||||
#endif
|
||||
|
||||
{ "EVT_EXIT_BREAK", EVT_KEY_BREAK(KEY_EXIT) },
|
||||
LROT_NUMENTRY( EVT_EXIT_BREAK, EVT_KEY_BREAK(KEY_EXIT) )
|
||||
|
||||
#if defined(KEYS_GPIO_REG_ENTER)
|
||||
KEY_EVENTS(ENTER, KEY_ENTER),
|
||||
KEY_EVENTS(ENTER, KEY_ENTER)
|
||||
#endif
|
||||
|
||||
#if defined(KEYS_GPIO_REG_MENU)
|
||||
KEY_EVENTS(MENU, KEY_MENU),
|
||||
KEY_EVENTS(MENU, KEY_MENU)
|
||||
#endif
|
||||
|
||||
#if defined(KEYS_GPIO_REG_RIGHT) && defined(COLORLCD)
|
||||
KEY_EVENTS(TELEM, KEY_TELEM),
|
||||
KEY_EVENTS(TELEM, KEY_TELEM)
|
||||
#elif defined(KEYS_GPIO_REG_RIGHT)
|
||||
KEY_EVENTS(RIGHT, KEY_RIGHT),
|
||||
KEY_EVENTS(RIGHT, KEY_RIGHT)
|
||||
#endif
|
||||
|
||||
#if defined(KEYS_GPIO_REG_UP) && defined(COLORLCD)
|
||||
KEY_EVENTS(MODEL, KEY_MODEL),
|
||||
KEY_EVENTS(MODEL, KEY_MODEL)
|
||||
#elif defined(KEYS_GPIO_REG_UP)
|
||||
KEY_EVENTS(UP, KEY_UP),
|
||||
KEY_EVENTS(UP, KEY_UP)
|
||||
#endif
|
||||
|
||||
#if defined(KEYS_GPIO_REG_LEFT) && defined(COLORLCD)
|
||||
KEY_EVENTS(SYS, KEY_RADIO),
|
||||
KEY_EVENTS(SYS, KEY_RADIO)
|
||||
#elif defined(KEYS_GPIO_REG_LEFT)
|
||||
KEY_EVENTS(LEFT, KEY_LEFT),
|
||||
KEY_EVENTS(LEFT, KEY_LEFT)
|
||||
#endif
|
||||
|
||||
#if defined(KEYS_GPIO_REG_DOWN) && defined(COLORLCD)
|
||||
{ "EVT_RTN_FIRST", EVT_KEY_BREAK(KEY_EXIT) },
|
||||
LROT_NUMENTRY( EVT_RTN_FIRST, EVT_KEY_BREAK(KEY_EXIT) )
|
||||
#else
|
||||
KEY_EVENTS(DOWN, KEY_DOWN),
|
||||
KEY_EVENTS(DOWN, KEY_DOWN)
|
||||
#endif
|
||||
|
||||
#if defined(KEYS_GPIO_REG_PGUP)
|
||||
KEY_EVENTS(PAGEUP, KEY_PGUP),
|
||||
KEY_EVENTS(PAGEUP, KEY_PGUP)
|
||||
#endif
|
||||
|
||||
#if defined(KEYS_GPIO_REG_PGDN)
|
||||
KEY_EVENTS(PAGEDN, KEY_PGDN),
|
||||
KEY_EVENTS(PAGEDN, KEY_PGDN)
|
||||
#endif
|
||||
|
||||
#if defined(KEYS_GPIO_REG_PAGE)
|
||||
KEY_EVENTS(PAGE, KEY_PAGE),
|
||||
KEY_EVENTS(PAGE, KEY_PAGE)
|
||||
#endif
|
||||
|
||||
#if defined(KEYS_GPIO_REG_SHIFT)
|
||||
KEY_EVENTS(SHIFT, KEY_SHIFT),
|
||||
KEY_EVENTS(SHIFT, KEY_SHIFT)
|
||||
#endif
|
||||
|
||||
#if defined(KEYS_GPIO_REG_PLUS)
|
||||
KEY_EVENTS(PLUS, KEY_PLUS),
|
||||
KEY_EVENTS(PLUS, KEY_PLUS)
|
||||
#endif
|
||||
|
||||
#if defined(KEYS_GPIO_REG_MINUS)
|
||||
KEY_EVENTS(MINUS, KEY_MINUS),
|
||||
KEY_EVENTS(MINUS, KEY_MINUS)
|
||||
#endif
|
||||
|
||||
#if defined(ROTARY_ENCODER_NAVIGATION)
|
||||
KEY_EVENTS(ROT, KEY_ENTER),
|
||||
{ "EVT_ROT_LEFT", EVT_ROTARY_LEFT },
|
||||
{ "EVT_ROT_RIGHT", EVT_ROTARY_RIGHT },
|
||||
KEY_EVENTS(ROT, KEY_ENTER)
|
||||
LROT_NUMENTRY( EVT_ROT_LEFT, EVT_ROTARY_LEFT )
|
||||
LROT_NUMENTRY( EVT_ROT_RIGHT, EVT_ROTARY_RIGHT )
|
||||
#endif
|
||||
|
||||
#if defined(HARDWARE_TOUCH)
|
||||
{ "EVT_TOUCH_FIRST", EVT_TOUCH_FIRST },
|
||||
{ "EVT_TOUCH_BREAK", EVT_TOUCH_BREAK },
|
||||
{ "EVT_TOUCH_SLIDE", EVT_TOUCH_SLIDE },
|
||||
{ "EVT_TOUCH_TAP", EVT_TOUCH_TAP },
|
||||
LROT_NUMENTRY( EVT_TOUCH_FIRST, EVT_TOUCH_FIRST )
|
||||
LROT_NUMENTRY( EVT_TOUCH_BREAK, EVT_TOUCH_BREAK )
|
||||
LROT_NUMENTRY( EVT_TOUCH_SLIDE, EVT_TOUCH_SLIDE )
|
||||
LROT_NUMENTRY( EVT_TOUCH_TAP, EVT_TOUCH_TAP )
|
||||
#endif
|
||||
|
||||
#if LCD_DEPTH > 1 && !defined(COLORLCD)
|
||||
{ "FILL_WHITE", FILL_WHITE },
|
||||
{ "GREY_DEFAULT", GREY_DEFAULT },
|
||||
LROT_NUMENTRY( FILL_WHITE, FILL_WHITE )
|
||||
LROT_NUMENTRY( GREY_DEFAULT, GREY_DEFAULT )
|
||||
#endif
|
||||
|
||||
#if LCD_W <= 212
|
||||
{ "FORCE", FORCE },
|
||||
{ "ERASE", ERASE },
|
||||
{ "ROUND", ROUND },
|
||||
LROT_NUMENTRY( FORCE, FORCE )
|
||||
LROT_NUMENTRY( ERASE, ERASE )
|
||||
LROT_NUMENTRY( ROUND, ROUND )
|
||||
#endif
|
||||
|
||||
{ "SOLID", SOLID },
|
||||
{ "DOTTED", DOTTED },
|
||||
{ "LCD_W", LCD_W },
|
||||
{ "LCD_H", LCD_H },
|
||||
{ "PLAY_NOW", PLAY_NOW },
|
||||
{ "PLAY_BACKGROUND", PLAY_BACKGROUND },
|
||||
{ "TIMEHOUR", TIMEHOUR },
|
||||
LROT_NUMENTRY( SOLID, SOLID )
|
||||
LROT_NUMENTRY( DOTTED, DOTTED )
|
||||
LROT_NUMENTRY( LCD_W, LCD_W )
|
||||
LROT_NUMENTRY( LCD_H, LCD_H )
|
||||
LROT_NUMENTRY( PLAY_NOW, PLAY_NOW )
|
||||
LROT_NUMENTRY( PLAY_BACKGROUND, PLAY_BACKGROUND )
|
||||
LROT_NUMENTRY( TIMEHOUR, TIMEHOUR )
|
||||
|
||||
{"UNIT_RAW", UNIT_RAW },
|
||||
{"UNIT_VOLTS", UNIT_VOLTS },
|
||||
{"UNIT_AMPS", UNIT_AMPS },
|
||||
{"UNIT_MILLIAMPS", UNIT_MILLIAMPS },
|
||||
{"UNIT_KTS", UNIT_KTS },
|
||||
{"UNIT_METERS_PER_SECOND", UNIT_METERS_PER_SECOND },
|
||||
{"UNIT_FEET_PER_SECOND", UNIT_FEET_PER_SECOND },
|
||||
{"UNIT_KMH", UNIT_KMH },
|
||||
{"UNIT_MPH", UNIT_MPH },
|
||||
{"UNIT_METERS", UNIT_METERS },
|
||||
{"UNIT_KM", UNIT_KM },
|
||||
{"UNIT_FEET", UNIT_FEET },
|
||||
{"UNIT_CELSIUS", UNIT_CELSIUS },
|
||||
{"UNIT_FAHRENHEIT", UNIT_FAHRENHEIT },
|
||||
{"UNIT_PERCENT", UNIT_PERCENT },
|
||||
{"UNIT_MAH", UNIT_MAH },
|
||||
{"UNIT_WATTS", UNIT_WATTS },
|
||||
{"UNIT_MILLIWATTS", UNIT_MILLIWATTS },
|
||||
{"UNIT_DB", UNIT_DB },
|
||||
{"UNIT_RPMS", UNIT_RPMS },
|
||||
{"UNIT_G", UNIT_G },
|
||||
{"UNIT_DEGREE", UNIT_DEGREE },
|
||||
{"UNIT_RADIANS", UNIT_RADIANS },
|
||||
{"UNIT_MILLILITERS", UNIT_MILLILITERS },
|
||||
{"UNIT_FLOZ", UNIT_FLOZ },
|
||||
{"UNIT_MILLILITERS_PER_MINUTE", UNIT_MILLILITERS_PER_MINUTE },
|
||||
{"UNIT_HERTZ", UNIT_HERTZ },
|
||||
{"UNIT_MS", UNIT_MS },
|
||||
{"UNIT_US", UNIT_US },
|
||||
{"UNIT_HOURS", UNIT_HOURS },
|
||||
{"UNIT_MINUTES", UNIT_MINUTES },
|
||||
{"UNIT_SECONDS", UNIT_SECONDS },
|
||||
{"UNIT_CELLS", UNIT_CELLS},
|
||||
{"UNIT_DATETIME", UNIT_DATETIME},
|
||||
{"UNIT_GPS", UNIT_GPS},
|
||||
{"UNIT_BITFIELD", UNIT_BITFIELD},
|
||||
{"UNIT_TEXT", UNIT_TEXT},
|
||||
LROT_NUMENTRY( UNIT_RAW, UNIT_RAW )
|
||||
LROT_NUMENTRY( UNIT_VOLTS, UNIT_VOLTS )
|
||||
LROT_NUMENTRY( UNIT_AMPS, UNIT_AMPS )
|
||||
LROT_NUMENTRY( UNIT_MILLIAMPS, UNIT_MILLIAMPS )
|
||||
LROT_NUMENTRY( UNIT_KTS, UNIT_KTS )
|
||||
LROT_NUMENTRY( UNIT_METERS_PER_SECOND, UNIT_METERS_PER_SECOND )
|
||||
LROT_NUMENTRY( UNIT_FEET_PER_SECOND, UNIT_FEET_PER_SECOND )
|
||||
LROT_NUMENTRY( UNIT_KMH, UNIT_KMH )
|
||||
LROT_NUMENTRY( UNIT_MPH, UNIT_MPH )
|
||||
LROT_NUMENTRY( UNIT_METERS, UNIT_METERS )
|
||||
LROT_NUMENTRY( UNIT_KM, UNIT_KM )
|
||||
LROT_NUMENTRY( UNIT_FEET, UNIT_FEET )
|
||||
LROT_NUMENTRY( UNIT_CELSIUS, UNIT_CELSIUS )
|
||||
LROT_NUMENTRY( UNIT_FAHRENHEIT, UNIT_FAHRENHEIT )
|
||||
LROT_NUMENTRY( UNIT_PERCENT, UNIT_PERCENT )
|
||||
LROT_NUMENTRY( UNIT_MAH, UNIT_MAH )
|
||||
LROT_NUMENTRY( UNIT_WATTS, UNIT_WATTS )
|
||||
LROT_NUMENTRY( UNIT_MILLIWATTS, UNIT_MILLIWATTS )
|
||||
LROT_NUMENTRY( UNIT_DB, UNIT_DB )
|
||||
LROT_NUMENTRY( UNIT_RPMS, UNIT_RPMS )
|
||||
LROT_NUMENTRY( UNIT_G, UNIT_G )
|
||||
LROT_NUMENTRY( UNIT_DEGREE, UNIT_DEGREE )
|
||||
LROT_NUMENTRY( UNIT_RADIANS, UNIT_RADIANS )
|
||||
LROT_NUMENTRY( UNIT_MILLILITERS, UNIT_MILLILITERS )
|
||||
LROT_NUMENTRY( UNIT_FLOZ, UNIT_FLOZ )
|
||||
LROT_NUMENTRY( UNIT_MILLILITERS_PER_MINUTE, UNIT_MILLILITERS_PER_MINUTE )
|
||||
LROT_NUMENTRY( UNIT_HERTZ, UNIT_HERTZ )
|
||||
LROT_NUMENTRY( UNIT_MS, UNIT_MS )
|
||||
LROT_NUMENTRY( UNIT_US, UNIT_US )
|
||||
LROT_NUMENTRY( UNIT_HOURS, UNIT_HOURS )
|
||||
LROT_NUMENTRY( UNIT_MINUTES, UNIT_MINUTES )
|
||||
LROT_NUMENTRY( UNIT_SECONDS, UNIT_SECONDS )
|
||||
LROT_NUMENTRY( UNIT_CELLS, UNIT_CELLS )
|
||||
LROT_NUMENTRY( UNIT_DATETIME, UNIT_DATETIME )
|
||||
LROT_NUMENTRY( UNIT_GPS, UNIT_GPS )
|
||||
LROT_NUMENTRY( UNIT_BITFIELD, UNIT_BITFIELD )
|
||||
LROT_NUMENTRY( UNIT_TEXT, UNIT_TEXT )
|
||||
|
||||
{"AM_RDO", AM_RDO},
|
||||
{"AM_HID", AM_HID},
|
||||
{"AM_SYS", AM_SYS},
|
||||
{"AM_DIR", AM_DIR},
|
||||
{"AM_ARC", AM_ARC},
|
||||
LROT_NUMENTRY( AM_RDO, AM_RDO )
|
||||
LROT_NUMENTRY( AM_HID, AM_HID )
|
||||
LROT_NUMENTRY( AM_SYS, AM_SYS )
|
||||
LROT_NUMENTRY( AM_DIR, AM_DIR )
|
||||
LROT_NUMENTRY( AM_ARC, AM_ARC )
|
||||
LROT_END(etxcst, NULL, 0)
|
||||
|
||||
{ nullptr, 0 } /* sentinel */
|
||||
};
|
||||
|
||||
const luaR_string_entry edgetxStrings[] = {
|
||||
{ "CHAR_RIGHT", STR_CHAR_RIGHT },
|
||||
{ "CHAR_LEFT", STR_CHAR_LEFT },
|
||||
{ "CHAR_UP", STR_CHAR_UP },
|
||||
{ "CHAR_DOWN", STR_CHAR_DOWN },
|
||||
{ "CHAR_DELTA", STR_CHAR_DELTA },
|
||||
{ "CHAR_STICK", STR_CHAR_STICK },
|
||||
{ "CHAR_POT", STR_CHAR_POT },
|
||||
{ "CHAR_SLIDER", STR_CHAR_SLIDER },
|
||||
{ "CHAR_SWITCH", STR_CHAR_SWITCH },
|
||||
{ "CHAR_TRIM", STR_CHAR_TRIM },
|
||||
{ "CHAR_INPUT", STR_CHAR_INPUT },
|
||||
{ "CHAR_FUNCTION", STR_CHAR_FUNCTION },
|
||||
{ "CHAR_CYC", STR_CHAR_CYC },
|
||||
{ "CHAR_TRAINER", STR_CHAR_TRAINER },
|
||||
{ "CHAR_CHANNEL", STR_CHAR_CHANNEL },
|
||||
{ "CHAR_TELEMETRY", STR_CHAR_TELEMETRY },
|
||||
{ "CHAR_LUA", STR_CHAR_LUA },
|
||||
|
||||
{ nullptr, "" } /* sentinel */
|
||||
};
|
||||
// LUA strings cannot be encoded statically,
|
||||
// use light user data instead
|
||||
LROT_BEGIN(etxstr, NULL, 0)
|
||||
LROT_LUDENTRY( CHAR_RIGHT, STR_CHAR_RIGHT )
|
||||
LROT_LUDENTRY( CHAR_LEFT, STR_CHAR_LEFT )
|
||||
LROT_LUDENTRY( CHAR_UP, STR_CHAR_UP )
|
||||
LROT_LUDENTRY( CHAR_DOWN, STR_CHAR_DOWN )
|
||||
LROT_LUDENTRY( CHAR_DELTA, STR_CHAR_DELTA )
|
||||
LROT_LUDENTRY( CHAR_STICK, STR_CHAR_STICK )
|
||||
LROT_LUDENTRY( CHAR_POT, STR_CHAR_POT )
|
||||
LROT_LUDENTRY( CHAR_SLIDER, STR_CHAR_SLIDER )
|
||||
LROT_LUDENTRY( CHAR_SWITCH, STR_CHAR_SWITCH )
|
||||
LROT_LUDENTRY( CHAR_TRIM, STR_CHAR_TRIM )
|
||||
LROT_LUDENTRY( CHAR_INPUT, STR_CHAR_INPUT )
|
||||
LROT_LUDENTRY( CHAR_FUNCTION, STR_CHAR_FUNCTION )
|
||||
LROT_LUDENTRY( CHAR_CYC, STR_CHAR_CYC )
|
||||
LROT_LUDENTRY( CHAR_TRAINER, STR_CHAR_TRAINER )
|
||||
LROT_LUDENTRY( CHAR_CHANNEL, STR_CHAR_CHANNEL )
|
||||
LROT_LUDENTRY( CHAR_TELEMETRY, STR_CHAR_TELEMETRY )
|
||||
LROT_LUDENTRY( CHAR_LUA, STR_CHAR_LUA )
|
||||
LROT_END(etxstr, NULL, 0)
|
||||
|
||||
@@ -1,949 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) EdgeTX
|
||||
*
|
||||
* Based on code named
|
||||
* opentx - https://github.com/opentx/opentx
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include "opentx.h"
|
||||
#include "lua_api.h"
|
||||
|
||||
/*luadoc
|
||||
@function lcd.refresh()
|
||||
|
||||
Refresh the LCD screen
|
||||
|
||||
@status current Introduced in 2.2.0
|
||||
|
||||
@notice This function only works in stand-alone and telemetry scripts.
|
||||
*/
|
||||
static int luaLcdRefresh(lua_State *L)
|
||||
{
|
||||
if (luaLcdAllowed) lcdRefresh();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*luadoc
|
||||
@function lcd.clear([color])
|
||||
|
||||
Clear the LCD screen
|
||||
|
||||
@param color (optional, only on color screens)
|
||||
|
||||
@status current Introduced in 2.0.0, `color` parameter introduced in 2.2.0 RC12
|
||||
|
||||
@notice This function only works in stand-alone and telemetry scripts.
|
||||
*/
|
||||
static int luaLcdClear(lua_State *L)
|
||||
{
|
||||
if (luaLcdAllowed) {
|
||||
#if defined(COLORLCD)
|
||||
LcdFlags color = luaL_optunsigned(L, 1, COLOR_THEME_SECONDARY3);
|
||||
lcd->clear(color);
|
||||
#else
|
||||
lcdClear();
|
||||
#endif
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*luadoc
|
||||
@function lcd.resetBacklightTimeout()
|
||||
|
||||
Reset the backlight timeout
|
||||
|
||||
@status current Introduced in 2.3.6
|
||||
*/
|
||||
static int luaLcdResetBacklightTimeout(lua_State * L)
|
||||
{
|
||||
if (!luaLcdAllowed)
|
||||
return 0;
|
||||
resetBacklightTimeout();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*luadoc
|
||||
@function lcd.drawPoint(x, y)
|
||||
|
||||
Draw a single pixel at (x,y) position
|
||||
|
||||
@param x (positive number) x position
|
||||
|
||||
@param y (positive number) y position
|
||||
|
||||
@param flags (optional) lcdflags
|
||||
|
||||
@notice Taranis has an LCD display width of 212 pixels and height of 64 pixels.
|
||||
Position (0,0) is at top left. Y axis is negative, top line is 0,
|
||||
bottom line is 63. Drawing on an existing black pixel produces white pixel (TODO check this!)
|
||||
|
||||
@status current Introduced in 2.0.0
|
||||
*/
|
||||
static int luaLcdDrawPoint(lua_State *L)
|
||||
{
|
||||
if (!luaLcdAllowed)
|
||||
return 0;
|
||||
int x = luaL_checkinteger(L, 1);
|
||||
int y = luaL_checkinteger(L, 2);
|
||||
LcdFlags att = luaL_optunsigned(L, 3, 0);
|
||||
lcdDrawPoint(x, y, att);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*luadoc
|
||||
@function lcd.drawLine(x1, y1, x2, y2, pattern, flags)
|
||||
|
||||
Draw a straight line on LCD
|
||||
|
||||
@param x1,y1 (positive numbers) starting coordinate
|
||||
|
||||
@param x2,y2 (positive numbers) end coordinate
|
||||
|
||||
@param pattern SOLID or DOTTED
|
||||
|
||||
@param flags lcdflags
|
||||
|
||||
@notice If the start or the end of the line is outside the LCD dimensions, then the
|
||||
whole line will not be drawn (starting from OpenTX 2.1.5)
|
||||
|
||||
@status current Introduced in 2.0.0, flags introduced in 2.3.6
|
||||
*/
|
||||
static int luaLcdDrawLine(lua_State *L)
|
||||
{
|
||||
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);
|
||||
coord_t y2 = luaL_checkunsigned(L, 4);
|
||||
uint8_t pat = luaL_checkunsigned(L, 5);
|
||||
LcdFlags flags = luaL_checkunsigned(L, 6);
|
||||
|
||||
if (x1 > LCD_W || y1 > LCD_H || x2 > LCD_W || y2 > LCD_H)
|
||||
return 0;
|
||||
|
||||
if (pat == SOLID) {
|
||||
if (x1 == x2) {
|
||||
lcdDrawSolidVerticalLine(x1, y1<y2 ? y1 : y2, y1<y2 ? (y2-y1)+1 : (y1-y2)+1, flags);
|
||||
return 0;
|
||||
}
|
||||
else if (y1 == y2) {
|
||||
lcdDrawSolidHorizontalLine(x1<x2 ? x1 : x2, y1, x1<x2 ? (x2-x1)+1 : (x1-x2)+1, flags);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
lcdDrawLine(x1, y1, x2, y2, pat, flags);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if !defined(COLORLCD)
|
||||
/*luadoc
|
||||
@function lcd.getLastPos()
|
||||
|
||||
Returns the rightmost x position from previous output
|
||||
|
||||
@retval number (integer) x position
|
||||
|
||||
@notice Only available on Taranis
|
||||
|
||||
@notice For added clarity, it is recommended to use lcd.getLastRightPos()
|
||||
|
||||
@status current Introduced in 2.0.0
|
||||
*/
|
||||
|
||||
/*luadoc
|
||||
@function lcd.getLastRightPos()
|
||||
|
||||
Returns the rightest x position from previous drawtext or drawNumber output
|
||||
|
||||
@retval number (integer) x position
|
||||
|
||||
@notice Only available on Taranis
|
||||
|
||||
@notice This is strictly equivalent to former lcd.getLastPos()
|
||||
|
||||
@status current Introduced in 2.2.0
|
||||
*/
|
||||
|
||||
static int luaLcdGetLastPos(lua_State *L)
|
||||
{
|
||||
lua_pushinteger(L, lcdLastRightPos);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*luadoc
|
||||
@function lcd.getLastLeftPos()
|
||||
|
||||
Returns the leftmost x position from previous drawtext or drawNumber output
|
||||
|
||||
@retval number (integer) x position
|
||||
|
||||
@notice Only available on Taranis
|
||||
|
||||
@status current Introduced in 2.2.0
|
||||
*/
|
||||
static int luaLcdGetLeftPos(lua_State *L)
|
||||
{
|
||||
lua_pushinteger(L, lcdLastLeftPos);
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif // COLORLCD
|
||||
|
||||
/*luadoc
|
||||
@function lcd.drawText(x, y, text [, flags])
|
||||
|
||||
Draw a text beginning at (x,y)
|
||||
|
||||
@param x,y (positive numbers) starting coordinate
|
||||
|
||||
@param text (string) text to display
|
||||
|
||||
@param flags (unsigned number) drawing flags. All values can be
|
||||
combined together using the + character. ie BLINK + DBLSIZE.
|
||||
See the [Appendix](../appendix/fonts.md) for available characters in each font set.
|
||||
* `0 or not specified` normal font
|
||||
* `XXLSIZE` jumbo sized font
|
||||
* `DBLSIZE` double size font
|
||||
* `MIDSIZE` mid sized font
|
||||
* `SMLSIZE` small font
|
||||
* `INVERS` inverted display
|
||||
* `BLINK` blinking text
|
||||
* `SHADOWED` Horus only, apply a shadow effect
|
||||
|
||||
@status current Introduced in 2.0.0, `SHADOWED` introduced in 2.2.1
|
||||
*/
|
||||
static int luaLcdDrawText(lua_State *L)
|
||||
{
|
||||
if (!luaLcdAllowed)
|
||||
return 0;
|
||||
int x = luaL_checkinteger(L, 1);
|
||||
int y = luaL_checkinteger(L, 2);
|
||||
const char * s = luaL_checkstring(L, 3);
|
||||
unsigned int att = luaL_optunsigned(L, 4, 0);
|
||||
#if defined(COLORLCD)
|
||||
if ((att&SHADOWED) && !(att&INVERS)) lcdDrawText(x+1, y+1, s, att&0xFFFF);
|
||||
#endif
|
||||
lcdDrawText(x, y, s, att);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*luadoc
|
||||
@function lcd.drawTimer(x, y, value [, flags])
|
||||
|
||||
Display a value formatted as time at (x,y)
|
||||
|
||||
@param x,y (positive numbers) starting coordinate
|
||||
|
||||
@param value (number) time in seconds
|
||||
|
||||
@param flags (unsigned number) drawing flags:
|
||||
* `0 or not specified` normal representation (minutes and seconds)
|
||||
* `TIMEHOUR` display hours
|
||||
* other general LCD flag also apply
|
||||
* `SHADOWED` Horus only, apply a shadow effect
|
||||
|
||||
@status current Introduced in 2.0.0, `SHADOWED` introduced in 2.2.1
|
||||
*/
|
||||
static int luaLcdDrawTimer(lua_State *L)
|
||||
{
|
||||
if (!luaLcdAllowed)
|
||||
return 0;
|
||||
int x = luaL_checkinteger(L, 1);
|
||||
int y = luaL_checkinteger(L, 2);
|
||||
int seconds = luaL_checkinteger(L, 3);
|
||||
unsigned int att = luaL_optunsigned(L, 4, 0);
|
||||
#if defined(COLORLCD)
|
||||
if (att&SHADOWED) drawTimer(x+1, y+1, seconds, (att&0xFFFF)|LEFT);
|
||||
drawTimer(x, y, seconds, att|LEFT);
|
||||
#else
|
||||
drawTimer(x, y, seconds, att|LEFT, att);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*luadoc
|
||||
@function lcd.drawNumber(x, y, value [, flags])
|
||||
|
||||
Display a number at (x,y)
|
||||
|
||||
@param x,y (positive numbers) starting coordinate
|
||||
|
||||
@param value (number) value to display
|
||||
|
||||
@param flags (unsigned number) drawing flags:
|
||||
* `0 or not specified` display with no decimal (like abs())
|
||||
* `PREC1` display with one decimal place (number 386 is displayed as 38.6)
|
||||
* `PREC2` display with tow decimal places (number 386 is displayed as 3.86)
|
||||
* other general LCD flag also apply
|
||||
* `SHADOWED` Horus only, apply a shadow effect
|
||||
|
||||
@status current Introduced in 2.0.0, `SHADOWED` introduced in 2.2.1
|
||||
*/
|
||||
static int luaLcdDrawNumber(lua_State *L)
|
||||
{
|
||||
if (!luaLcdAllowed)
|
||||
return 0;
|
||||
int x = luaL_checkinteger(L, 1);
|
||||
int y = luaL_checkinteger(L, 2);
|
||||
int val = luaL_checkinteger(L, 3);
|
||||
unsigned int att = luaL_optunsigned(L, 4, 0);
|
||||
#if defined(COLORLCD)
|
||||
if ((att&SHADOWED) && !(att&INVERS)) lcdDrawNumber(x, y, val, att&0xFFFF);
|
||||
#endif
|
||||
lcdDrawNumber(x, y, val, att);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*luadoc
|
||||
@function lcd.drawChannel(x, y, source, flags)
|
||||
|
||||
Display a telemetry value at (x,y)
|
||||
|
||||
@param x,y (positive numbers) starting coordinate
|
||||
|
||||
@param source can be a source identifier (number) or a source name (string).
|
||||
See getValue()
|
||||
|
||||
@param flags (unsigned number) drawing flags
|
||||
|
||||
@status current Introduced in 2.0.6, changed in 2.1.0 (only telemetry sources are valid)
|
||||
*/
|
||||
static int luaLcdDrawChannel(lua_State *L)
|
||||
{
|
||||
if (!luaLcdAllowed)
|
||||
return 0;
|
||||
int x = luaL_checkinteger(L, 1);
|
||||
int y = luaL_checkinteger(L, 2);
|
||||
int channel = -1;
|
||||
if (lua_isnumber(L, 3)) {
|
||||
channel = luaL_checkinteger(L, 3);
|
||||
}
|
||||
else {
|
||||
const char * what = luaL_checkstring(L, 3);
|
||||
LuaField field;
|
||||
bool found = luaFindFieldByName(what, field);
|
||||
if (found) {
|
||||
channel = field.id;
|
||||
}
|
||||
}
|
||||
unsigned int att = luaL_optunsigned(L, 4, 0);
|
||||
getvalue_t value = getValue(channel);
|
||||
drawSensorCustomValue(x, y, (channel-MIXSRC_FIRST_TELEM)/3, value, att);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*luadoc
|
||||
@function lcd.drawSwitch(x, y, switch, flags)
|
||||
|
||||
Draw a text representation of switch at (x,y)
|
||||
|
||||
@param x,y (positive numbers) starting coordinate
|
||||
|
||||
@param switch (number) number of switch to display, negative number
|
||||
displays negated switch
|
||||
|
||||
@param flags (unsigned number) drawing flags, only SMLSIZE, BLINK and INVERS.
|
||||
|
||||
@status current Introduced in 2.0.0
|
||||
*/
|
||||
static int luaLcdDrawSwitch(lua_State *L)
|
||||
{
|
||||
if (!luaLcdAllowed)
|
||||
return 0;
|
||||
int x = luaL_checkinteger(L, 1);
|
||||
int y = luaL_checkinteger(L, 2);
|
||||
int s = luaL_checkinteger(L, 3);
|
||||
unsigned int att = luaL_optunsigned(L, 4, 0);
|
||||
drawSwitch(x, y, s, att);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*luadoc
|
||||
@function lcd.drawSource(x, y, source [, flags])
|
||||
|
||||
Displays the name of the corresponding input as defined by the source at (x,y)
|
||||
|
||||
@param x,y (positive numbers) starting coordinate
|
||||
|
||||
@param source (number) source index
|
||||
|
||||
@param flags (unsigned number) drawing flags
|
||||
|
||||
@status current Introduced in 2.0.0
|
||||
*/
|
||||
static int luaLcdDrawSource(lua_State *L)
|
||||
{
|
||||
if (!luaLcdAllowed)
|
||||
return 0;
|
||||
int x = luaL_checkinteger(L, 1);
|
||||
int y = luaL_checkinteger(L, 2);
|
||||
int s = luaL_checkinteger(L, 3);
|
||||
unsigned int att = luaL_optunsigned(L, 4, 0);
|
||||
drawSource(x, y, s, att);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined(COLORLCD)
|
||||
|
||||
#define LUA_BITMAPHANDLE "BITMAP*"
|
||||
|
||||
/*luadoc
|
||||
@function Bitmap.open(name)
|
||||
|
||||
Loads a bitmap in memory, for later use with lcd.drawBitmap(). Bitmaps should be loaded only
|
||||
once, returned object should be stored and used for drawing. If loading fails for whatever
|
||||
reason the resulting bitmap object will have width and height set to zero.
|
||||
|
||||
Bitmap loading can fail if:
|
||||
* File is not found or contains invalid image
|
||||
* System is low on memory
|
||||
* Combined memory usage of all Lua script bitmaps exceeds certain value
|
||||
|
||||
@param name (string) full path to the bitmap on SD card (i.e. “/IMAGES/test.bmp”)
|
||||
|
||||
@retval bitmap (object) a bitmap object that can be used with other bitmap functions
|
||||
|
||||
@notice Only available on Horus
|
||||
|
||||
@status current Introduced in 2.2.0
|
||||
*/
|
||||
static int luaOpenBitmap(lua_State * L)
|
||||
{
|
||||
const char * filename = luaL_checkstring(L, 1);
|
||||
|
||||
BitmapBuffer ** b = (BitmapBuffer **)lua_newuserdata(L, sizeof(BitmapBuffer *));
|
||||
|
||||
if (luaExtraMemoryUsage > LUA_MEM_EXTRA_MAX) {
|
||||
// already allocated more than max allowed, fail
|
||||
TRACE("luaOpenBitmap: Error, using too much memory %u/%u", luaExtraMemoryUsage, LUA_MEM_EXTRA_MAX);
|
||||
*b = 0;
|
||||
}
|
||||
else {
|
||||
*b = BitmapBuffer::load(filename);
|
||||
if (*b == NULL && G(L)->gcrunning) {
|
||||
luaC_fullgc(L, 1); /* try to free some memory... */
|
||||
*b = BitmapBuffer::load(filename); /* try again */
|
||||
}
|
||||
}
|
||||
|
||||
if (*b) {
|
||||
uint32_t size = (*b)->getDataSize();
|
||||
luaExtraMemoryUsage += size;
|
||||
TRACE("luaOpenBitmap: %p (%u)", *b, size);
|
||||
}
|
||||
|
||||
luaL_getmetatable(L, LUA_BITMAPHANDLE);
|
||||
lua_setmetatable(L, -2);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static BitmapBuffer * checkBitmap(lua_State * L, int index)
|
||||
{
|
||||
BitmapBuffer ** b = (BitmapBuffer **)luaL_checkudata(L, index, LUA_BITMAPHANDLE);
|
||||
return *b;
|
||||
}
|
||||
|
||||
/*luadoc
|
||||
@function Bitmap.getSize(name)
|
||||
|
||||
Return width, height of a bitmap object
|
||||
|
||||
@param bitmap (pointer) point to a bitmap previously opened with Bitmap.open()
|
||||
|
||||
@retval multiple returns 2 values:
|
||||
* (number) width in pixels
|
||||
* (number) height in pixels
|
||||
|
||||
@notice Only available on Horus
|
||||
|
||||
@status current Introduced in 2.2.0
|
||||
*/
|
||||
static int luaGetBitmapSize(lua_State * L)
|
||||
{
|
||||
const BitmapBuffer * b = checkBitmap(L, 1);
|
||||
if (b) {
|
||||
lua_pushinteger(L, b->width());
|
||||
lua_pushinteger(L, b->height());
|
||||
}
|
||||
else {
|
||||
lua_pushinteger(L, 0);
|
||||
lua_pushinteger(L, 0);
|
||||
}
|
||||
return 2;
|
||||
}
|
||||
|
||||
static int luaDestroyBitmap(lua_State * L)
|
||||
{
|
||||
BitmapBuffer * b = checkBitmap(L, 1);
|
||||
if (b) {
|
||||
uint32_t size = b->getDataSize();
|
||||
TRACE("luaDestroyBitmap: %p (%u)", b, size);
|
||||
if (luaExtraMemoryUsage >= size) {
|
||||
luaExtraMemoryUsage -= size;
|
||||
}
|
||||
else {
|
||||
luaExtraMemoryUsage = 0;
|
||||
}
|
||||
delete b;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
const luaL_Reg bitmapFuncs[] = {
|
||||
{ "open", luaOpenBitmap },
|
||||
{ "getSize", luaGetBitmapSize },
|
||||
{ "__gc", luaDestroyBitmap },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
void registerBitmapClass(lua_State * L)
|
||||
{
|
||||
luaL_newmetatable(L, LUA_BITMAPHANDLE);
|
||||
luaL_setfuncs(L, bitmapFuncs, 0);
|
||||
lua_pushvalue(L, -1);
|
||||
lua_setfield(L, -2, "__index");
|
||||
lua_setglobal(L, "Bitmap");
|
||||
}
|
||||
|
||||
/*luadoc
|
||||
@function lcd.drawBitmap(bitmap, x, y [, scale])
|
||||
|
||||
Displays a bitmap at (x,y)
|
||||
|
||||
@param bitmap (pointer) point to a bitmap previously opened with Bitmap.open()
|
||||
|
||||
@param x,y (positive numbers) starting coordinates
|
||||
|
||||
@param scale (positive numbers) scale in %, 50 divides size by two, 100 is unchanged, 200 doubles size.
|
||||
Omitting scale draws image in 1:1 scale and is faster than specifying 100 for scale.
|
||||
|
||||
@notice Only available on Horus
|
||||
|
||||
@status current Introduced in 2.2.0
|
||||
*/
|
||||
static int luaLcdDrawBitmap(lua_State *L)
|
||||
{
|
||||
if (!luaLcdAllowed)
|
||||
return 0;
|
||||
const BitmapBuffer * b = checkBitmap(L, 1);
|
||||
|
||||
if (b) {
|
||||
unsigned int x = luaL_checkunsigned(L, 2);
|
||||
unsigned int y = luaL_checkunsigned(L, 3);
|
||||
unsigned int scale = luaL_optunsigned(L, 4, 0);
|
||||
if (scale) {
|
||||
lcd->drawBitmap(x, y, b, 0, 0, 0, 0, scale/100.0f);
|
||||
}
|
||||
else {
|
||||
lcd->drawBitmap(x, y, b);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
/*luadoc
|
||||
@function lcd.drawPixmap(x, y, name)
|
||||
|
||||
Draw a bitmap at (x,y)
|
||||
|
||||
@param x,y (positive numbers) starting coordinates
|
||||
|
||||
@param name (string) full path to the bitmap on SD card (i.e. “/IMAGES/test.bmp”)
|
||||
|
||||
@notice Maximum image size is [display width / 2] x [display height] pixels.
|
||||
|
||||
@status current Introduced in 2.0.0
|
||||
*/
|
||||
static int luaLcdDrawPixmap(lua_State *L)
|
||||
{
|
||||
if (!luaLcdAllowed)
|
||||
return 0;
|
||||
int x = luaL_checkinteger(L, 1);
|
||||
int y = luaL_checkinteger(L, 2);
|
||||
const char * filename = luaL_checkstring(L, 3);
|
||||
|
||||
uint8_t bitmap[BITMAP_BUFFER_SIZE(LCD_W/2, LCD_H)]; // width max is LCD_W/2 pixels for saving stack and avoid a malloc here
|
||||
if (lcdLoadBitmap(bitmap, filename, LCD_W/2, LCD_H)) {
|
||||
lcdDrawBitmap(x, y, bitmap);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*luadoc
|
||||
@function lcd.drawRectangle(x, y, w, h [, flags [, t]])
|
||||
|
||||
Draw a rectangle from top left corner (x,y) of specified width and height
|
||||
|
||||
@param x,y (positive numbers) top left corner position
|
||||
|
||||
@param w (number) width in pixels
|
||||
|
||||
@param h (number) height in pixels
|
||||
|
||||
@param flags (unsigned number) drawing flags
|
||||
|
||||
@param t (number) thickness in pixels, defaults to 1 (only on Horus)
|
||||
|
||||
@status current Introduced in 2.0.0, changed in 2.2.0
|
||||
*/
|
||||
static int luaLcdDrawRectangle(lua_State *L)
|
||||
{
|
||||
if (!luaLcdAllowed)
|
||||
return 0;
|
||||
int x = luaL_checkinteger(L, 1);
|
||||
int y = luaL_checkinteger(L, 2);
|
||||
int w = luaL_checkinteger(L, 3);
|
||||
int h = luaL_checkinteger(L, 4);
|
||||
unsigned int flags = luaL_optunsigned(L, 5, 0);
|
||||
#if defined(PCBHORUS)
|
||||
unsigned int t = luaL_optunsigned(L, 6, 1);
|
||||
lcdDrawRect(x, y, w, h, t, 0xff, flags);
|
||||
#else
|
||||
lcdDrawRect(x, y, w, h, 0xff, flags);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*luadoc
|
||||
@function lcd.drawFilledRectangle(x, y, w, h [, flags])
|
||||
|
||||
Draw a solid rectangle from top left corner (x,y) of specified width and height
|
||||
|
||||
@param x,y (positive numbers) top left corner position
|
||||
|
||||
@param w (number) width in pixels
|
||||
|
||||
@param h (number) height in pixels
|
||||
|
||||
@param flags (unsigned number) drawing flags
|
||||
|
||||
@status current Introduced in 2.0.0
|
||||
*/
|
||||
static int luaLcdDrawFilledRectangle(lua_State *L)
|
||||
{
|
||||
if (!luaLcdAllowed)
|
||||
return 0;
|
||||
int x = luaL_checkinteger(L, 1);
|
||||
int y = luaL_checkinteger(L, 2);
|
||||
int w = luaL_checkinteger(L, 3);
|
||||
int h = luaL_checkinteger(L, 4);
|
||||
unsigned int flags = luaL_optunsigned(L, 5, 0);
|
||||
lcdDrawFilledRect(x, y, w, h, SOLID, flags);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*luadoc
|
||||
@function lcd.drawGauge(x, y, w, h, fill, maxfill [, flags])
|
||||
|
||||
Draw a simple gauge that is filled based upon fill value
|
||||
|
||||
@param x,y (positive numbers) top left corner position
|
||||
|
||||
@param w (number) width in pixels
|
||||
|
||||
@param h (number) height in pixels
|
||||
|
||||
@param fill (number) amount of fill to apply
|
||||
|
||||
@param maxfill (number) total value of fill
|
||||
|
||||
@param flags (unsigned number) drawing flags
|
||||
|
||||
@status current Introduced in 2.0.0, changed in 2.2.0
|
||||
*/
|
||||
static int luaLcdDrawGauge(lua_State *L)
|
||||
{
|
||||
if (!luaLcdAllowed)
|
||||
return 0;
|
||||
int x = luaL_checkinteger(L, 1);
|
||||
int y = luaL_checkinteger(L, 2);
|
||||
int w = luaL_checkinteger(L, 3);
|
||||
int h = luaL_checkinteger(L, 4);
|
||||
int num = luaL_checkinteger(L, 5);
|
||||
int den = luaL_checkinteger(L, 6);
|
||||
unsigned int flags = luaL_optunsigned(L, 7, 0);
|
||||
#if defined(PCBHORUS)
|
||||
lcdDrawRect(x, y, w, h, 1, 0xff, flags);
|
||||
#else
|
||||
lcdDrawRect(x, y, w, h, 0xff, flags);
|
||||
#endif
|
||||
uint8_t len = limit((uint8_t)1, uint8_t(w*num/den), uint8_t(w));
|
||||
lcdDrawSolidFilledRect(x+1, y+1, len, h-2, flags);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#if !defined(COLORLCD)
|
||||
/*luadoc
|
||||
@function lcd.drawScreenTitle(title, page, pages)
|
||||
|
||||
Draw a title bar
|
||||
|
||||
@param title (string) text for the title
|
||||
|
||||
@param page (number) page number
|
||||
|
||||
@param pages (number) total number of pages. Only used as indicator on
|
||||
the right side of title bar. (i.e. idx=2, cnt=5, display `2/5`)
|
||||
|
||||
@notice Only available on Taranis
|
||||
|
||||
@status current Introduced in 2.0.0
|
||||
*/
|
||||
static int luaLcdDrawScreenTitle(lua_State *L)
|
||||
{
|
||||
if (!luaLcdAllowed)
|
||||
return 0;
|
||||
const char * str = luaL_checkstring(L, 1);
|
||||
int idx = luaL_checkinteger(L, 2);
|
||||
int cnt = luaL_checkinteger(L, 3);
|
||||
|
||||
if (cnt) drawScreenIndex(idx-1, cnt, 0);
|
||||
#if LCD_DEPTH > 1
|
||||
lcdDrawFilledRect(0, 0, LCD_W, FH, SOLID, FILL_WHITE|GREY_DEFAULT);
|
||||
#endif
|
||||
title(str);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(COLORLCD)
|
||||
/*luadoc
|
||||
@function lcd.drawCombobox(x, y, w, list, idx [, flags])
|
||||
|
||||
Draw a combo box
|
||||
|
||||
@param x,y (positive numbers) top left corner position
|
||||
|
||||
@param w (number) width of combo box in pixels
|
||||
|
||||
@param list (table) combo box elements, each element is a string
|
||||
|
||||
@param idx (integer) index of entry to highlight
|
||||
|
||||
@param flags (unsigned number) drawing flags, the flags can not be combined:
|
||||
* `BLINK` combo box is expanded
|
||||
* `INVERS` combo box collapsed, text inversed
|
||||
* `0 or not present` combo box collapsed, text normal
|
||||
|
||||
@notice Only available on Taranis
|
||||
|
||||
@status current Introduced in 2.0.0
|
||||
*/
|
||||
static int luaLcdDrawCombobox(lua_State *L)
|
||||
{
|
||||
if (!luaLcdAllowed)
|
||||
return 0;
|
||||
int x = luaL_checkinteger(L, 1);
|
||||
int y = luaL_checkinteger(L, 2);
|
||||
int w = luaL_checkinteger(L, 3);
|
||||
luaL_checktype(L, 4, LUA_TTABLE);
|
||||
int count = luaL_len(L, 4); /* get size of table */
|
||||
int idx = luaL_checkinteger(L, 5);
|
||||
unsigned int flags = luaL_optunsigned(L, 6, 0);
|
||||
if (idx >= count) {
|
||||
// TODO error
|
||||
}
|
||||
if (flags & BLINK) {
|
||||
lcdDrawFilledRect(x, y, w-9, count*9+2, SOLID, ERASE);
|
||||
lcdDrawRect(x, y, w-9, count*9+2);
|
||||
for (int i=0; i<count; i++) {
|
||||
lua_rawgeti(L, 4, i+1);
|
||||
const char * item = luaL_checkstring(L, -1);
|
||||
lcdDrawText(x+2, y+2+9*i, item, 0);
|
||||
}
|
||||
lcdDrawFilledRect(x+1, y+1+9*idx, w-11, 9);
|
||||
lcdDrawFilledRect(x+w-10, y, 10, 11, SOLID, ERASE);
|
||||
lcdDrawRect(x+w-10, y, 10, 11);
|
||||
}
|
||||
else if (flags & INVERS) {
|
||||
lcdDrawFilledRect(x, y, w, 11);
|
||||
lcdDrawFilledRect(x+w-9, y+1, 8, 9, SOLID, ERASE);
|
||||
lua_rawgeti(L, 4, idx+1);
|
||||
const char * item = luaL_checkstring(L, -1);
|
||||
lcdDrawText(x+2, y+2, item, INVERS);
|
||||
}
|
||||
else {
|
||||
lcdDrawFilledRect(x, y, w, 11, SOLID, ERASE);
|
||||
lcdDrawRect(x, y, w, 11);
|
||||
lcdDrawFilledRect(x+w-10, y+1, 9, 9, SOLID);
|
||||
lua_rawgeti(L, 4, idx+1);
|
||||
const char * item = luaL_checkstring(L, -1);
|
||||
lcdDrawText(x+2, y+2, item, 0);
|
||||
}
|
||||
|
||||
lcdDrawSolidHorizontalLine(x+w-8, y+3, 6);
|
||||
lcdDrawSolidHorizontalLine(x+w-8, y+5, 6);
|
||||
lcdDrawSolidHorizontalLine(x+w-8, y+7, 6);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(COLORLCD)
|
||||
/*luadoc
|
||||
@function lcd.setColor(area, color)
|
||||
|
||||
Set a color for specific area
|
||||
|
||||
@param area (unsigned number) specific screen area in the list bellow
|
||||
* `CUSTOM_COLOR`
|
||||
* `COLOR_THEME_SECONDARY1`
|
||||
* `COLOR_THEME_SECONDARY3`
|
||||
* `COLOR_THEME_PRIMARY2`
|
||||
* `COLOR_THEME_FOCUS`
|
||||
* `COLOR_THEME_PRIMARY3`
|
||||
* `COLOR_THEME_FOCUS`
|
||||
* `COLOR_THEME_PRIMARY2`
|
||||
* `COLOR_THEME_SECONDARY1`
|
||||
* `COLOR_THEME_PRIMARY3`
|
||||
* `COLOR_THEME_SECONDARY1`
|
||||
* `COLOR_THEME_WARNING`
|
||||
* `COLOR_THEME_ACTIVE`
|
||||
* `COLOR_THEME_DISABLED`
|
||||
* `COLOR_THEME_SECONDARY1`
|
||||
* `COLOR_THEME_DISABLED`
|
||||
* `COLOR_THEME_WARNING`
|
||||
* `COLOR_THEME_SECONDARY1`
|
||||
* `COLOR_THEME_FOCUS`
|
||||
* `COLOR_THEME_PRIMARY1`
|
||||
* `COLOR_THEME_PRIMARY2`
|
||||
* `COLOR_THEME_SECONDARY1`
|
||||
* `COLOR_THEME_PRIMARY2`
|
||||
* `COLOR_THEME_SECONDARY1`
|
||||
* `COLOR_THEME_FOCUS`
|
||||
* `COLOR_THEME_PRIMARY2`
|
||||
* `COLOR_THEME_SECONDARY1`
|
||||
* `COLOR_THEME_PRIMARY1`
|
||||
* `COLOR_THEME_SECONDARY1`
|
||||
* `COLOR_THEME_SECONDARY2`
|
||||
* `COLOR_THEME_SECONDARY3`
|
||||
* `CUSTOM_COLOR`
|
||||
|
||||
@param color (number) color in 5/6/5 rgb format. The following prefined colors are available
|
||||
* `WHITE`
|
||||
* `GREY`
|
||||
* `LIGHTGREY`
|
||||
* `DARKGREY`
|
||||
* `BLACK`
|
||||
* `YELLOW`
|
||||
* `BLUE`
|
||||
* `RED`
|
||||
* `DARKRED`
|
||||
|
||||
@notice Only available on Colorlcd radios
|
||||
|
||||
@status current Introduced in 2.2.0
|
||||
*/
|
||||
static int luaLcdSetColor(lua_State *L)
|
||||
{
|
||||
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)
|
||||
|
||||
Returns a 5/6/5 rgb color code, that can be used with lcd.setColor
|
||||
|
||||
@param r (integer) a number between 0x00 and 0xff that expresses te amount of red in the color
|
||||
|
||||
@param g (integer) a number between 0x00 and 0xff that expresses te amount of green in the color
|
||||
|
||||
@param b (integer) a number between 0x00 and 0xff that expresses te amount of blue in the color
|
||||
|
||||
@retval number (integer) rgb color expressed in 5/6/5 format
|
||||
|
||||
@notice Only available on Colorlcd radios
|
||||
|
||||
@status current Introduced in 2.2.0
|
||||
*/
|
||||
static int luaRGB(lua_State *L)
|
||||
{
|
||||
if (!luaLcdAllowed)
|
||||
return 0;
|
||||
int r = luaL_checkinteger(L, 1);
|
||||
int g = luaL_checkinteger(L, 2);
|
||||
int b = luaL_checkinteger(L, 3);
|
||||
lua_pushinteger(L, RGB(r, g, b));
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
const luaL_Reg lcdLib[] = {
|
||||
{ "refresh", luaLcdRefresh },
|
||||
{ "clear", luaLcdClear },
|
||||
{ "resetBacklightTimeout", luaLcdResetBacklightTimeout },
|
||||
{ "drawPoint", luaLcdDrawPoint },
|
||||
{ "drawLine", luaLcdDrawLine },
|
||||
{ "drawRectangle", luaLcdDrawRectangle },
|
||||
{ "drawFilledRectangle", luaLcdDrawFilledRectangle },
|
||||
{ "drawText", luaLcdDrawText },
|
||||
{ "drawTimer", luaLcdDrawTimer },
|
||||
{ "drawNumber", luaLcdDrawNumber },
|
||||
{ "drawChannel", luaLcdDrawChannel },
|
||||
{ "drawSwitch", luaLcdDrawSwitch },
|
||||
{ "drawSource", luaLcdDrawSource },
|
||||
{ "drawGauge", luaLcdDrawGauge },
|
||||
#if defined(COLORLCD)
|
||||
{ "drawBitmap", luaLcdDrawBitmap },
|
||||
{ "setColor", luaLcdSetColor },
|
||||
{ "getColor", luaLcdGetColor },
|
||||
{ "RGB", luaRGB },
|
||||
#else
|
||||
{ "getLastPos", luaLcdGetLastPos },
|
||||
{ "getLastRightPos", luaLcdGetLastPos },
|
||||
{ "getLastLeftPos", luaLcdGetLeftPos },
|
||||
{ "drawPixmap", luaLcdDrawPixmap },
|
||||
{ "drawScreenTitle", luaLcdDrawScreenTitle },
|
||||
{ "drawCombobox", luaLcdDrawCombobox },
|
||||
#endif
|
||||
{ NULL, NULL } /* sentinel */
|
||||
};
|
||||
+39
-38
@@ -19,6 +19,8 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#define LUA_LIB
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include "opentx.h"
|
||||
@@ -1737,45 +1739,44 @@ static int luaModelSetSwashRing(lua_State *L)
|
||||
}
|
||||
#endif // HELI
|
||||
|
||||
const luaL_Reg modelLib[] = {
|
||||
{ "getInfo", luaModelGetInfo },
|
||||
{ "setInfo", luaModelSetInfo },
|
||||
{ "getModule", luaModelGetModule },
|
||||
{ "setModule", luaModelSetModule },
|
||||
{ "getTimer", luaModelGetTimer },
|
||||
{ "setTimer", luaModelSetTimer },
|
||||
{ "resetTimer", luaModelResetTimer },
|
||||
{ "deleteFlightModes", luaModelDeleteFlightModes },
|
||||
{ "getFlightMode", luaModelGetFlightMode },
|
||||
{ "setFlightMode", luaModelSetFlightMode },
|
||||
{ "getInputsCount", luaModelGetInputsCount },
|
||||
{ "getInput", luaModelGetInput },
|
||||
{ "insertInput", luaModelInsertInput },
|
||||
{ "deleteInput", luaModelDeleteInput },
|
||||
{ "deleteInputs", luaModelDeleteInputs },
|
||||
{ "defaultInputs", luaModelDefaultInputs },
|
||||
{ "getMixesCount", luaModelGetMixesCount },
|
||||
{ "getMix", luaModelGetMix },
|
||||
{ "insertMix", luaModelInsertMix },
|
||||
{ "deleteMix", luaModelDeleteMix },
|
||||
{ "deleteMixes", luaModelDeleteMixes },
|
||||
{ "getLogicalSwitch", luaModelGetLogicalSwitch },
|
||||
{ "setLogicalSwitch", luaModelSetLogicalSwitch },
|
||||
{ "getCustomFunction", luaModelGetCustomFunction },
|
||||
{ "setCustomFunction", luaModelSetCustomFunction },
|
||||
{ "getCurve", luaModelGetCurve },
|
||||
{ "setCurve", luaModelSetCurve },
|
||||
{ "getOutput", luaModelGetOutput },
|
||||
{ "setOutput", luaModelSetOutput },
|
||||
LROT_BEGIN(modellib, NULL, 0)
|
||||
LROT_FUNCENTRY( getInfo, luaModelGetInfo )
|
||||
LROT_FUNCENTRY( setInfo, luaModelSetInfo )
|
||||
LROT_FUNCENTRY( getModule, luaModelGetModule )
|
||||
LROT_FUNCENTRY( setModule, luaModelSetModule )
|
||||
LROT_FUNCENTRY( getTimer, luaModelGetTimer )
|
||||
LROT_FUNCENTRY( setTimer, luaModelSetTimer )
|
||||
LROT_FUNCENTRY( resetTimer, luaModelResetTimer )
|
||||
LROT_FUNCENTRY( deleteFlightModes, luaModelDeleteFlightModes )
|
||||
LROT_FUNCENTRY( getFlightMode, luaModelGetFlightMode )
|
||||
LROT_FUNCENTRY( setFlightMode, luaModelSetFlightMode )
|
||||
LROT_FUNCENTRY( getInputsCount, luaModelGetInputsCount )
|
||||
LROT_FUNCENTRY( getInput, luaModelGetInput )
|
||||
LROT_FUNCENTRY( insertInput, luaModelInsertInput )
|
||||
LROT_FUNCENTRY( deleteInput, luaModelDeleteInput )
|
||||
LROT_FUNCENTRY( deleteInputs, luaModelDeleteInputs )
|
||||
LROT_FUNCENTRY( defaultInputs, luaModelDefaultInputs )
|
||||
LROT_FUNCENTRY( getMixesCount, luaModelGetMixesCount )
|
||||
LROT_FUNCENTRY( getMix, luaModelGetMix )
|
||||
LROT_FUNCENTRY( insertMix, luaModelInsertMix )
|
||||
LROT_FUNCENTRY( deleteMix, luaModelDeleteMix )
|
||||
LROT_FUNCENTRY( deleteMixes, luaModelDeleteMixes )
|
||||
LROT_FUNCENTRY( getLogicalSwitch, luaModelGetLogicalSwitch )
|
||||
LROT_FUNCENTRY( setLogicalSwitch, luaModelSetLogicalSwitch )
|
||||
LROT_FUNCENTRY( getCustomFunction, luaModelGetCustomFunction )
|
||||
LROT_FUNCENTRY( setCustomFunction, luaModelSetCustomFunction )
|
||||
LROT_FUNCENTRY( getCurve, luaModelGetCurve )
|
||||
LROT_FUNCENTRY( setCurve, luaModelSetCurve )
|
||||
LROT_FUNCENTRY( getOutput, luaModelGetOutput )
|
||||
LROT_FUNCENTRY( setOutput, luaModelSetOutput )
|
||||
#if defined (GVARS)
|
||||
{ "getGlobalVariable", luaModelGetGlobalVariable },
|
||||
{ "setGlobalVariable", luaModelSetGlobalVariable },
|
||||
LROT_FUNCENTRY( getGlobalVariable, luaModelGetGlobalVariable )
|
||||
LROT_FUNCENTRY( setGlobalVariable, luaModelSetGlobalVariable )
|
||||
#endif
|
||||
{ "getSensor", luaModelGetSensor },
|
||||
{ "resetSensor", luaModelResetSensor },
|
||||
LROT_FUNCENTRY( getSensor, luaModelGetSensor )
|
||||
LROT_FUNCENTRY( resetSensor, luaModelResetSensor )
|
||||
#if defined(HELI)
|
||||
{ "getSwashRing", luaModelGetSwashRing },
|
||||
{ "setSwashRing", luaModelSetSwashRing },
|
||||
LROT_FUNCENTRY( getSwashRing, luaModelGetSwashRing )
|
||||
LROT_FUNCENTRY( setSwashRing, luaModelSetSwashRing )
|
||||
#endif
|
||||
{ nullptr, nullptr } /* sentinel */
|
||||
};
|
||||
LROT_END(modellib, NULL, 0)
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#define LUA_LIB
|
||||
|
||||
#include <cctype>
|
||||
#include <cstdio>
|
||||
#include "opentx.h"
|
||||
@@ -620,26 +622,34 @@ static int luaLcdDrawCombobox(lua_State *L)
|
||||
return 0;
|
||||
}
|
||||
|
||||
const luaL_Reg lcdLib[] = {
|
||||
{ "refresh", luaLcdRefresh },
|
||||
{ "clear", luaLcdClear },
|
||||
{ "resetBacklightTimeout", luaLcdResetBacklightTimeout },
|
||||
{ "drawPoint", luaLcdDrawPoint },
|
||||
{ "drawLine", luaLcdDrawLine },
|
||||
{ "drawRectangle", luaLcdDrawRectangle },
|
||||
{ "drawFilledRectangle", luaLcdDrawFilledRectangle },
|
||||
{ "drawText", luaLcdDrawText },
|
||||
{ "drawTimer", luaLcdDrawTimer },
|
||||
{ "drawNumber", luaLcdDrawNumber },
|
||||
{ "drawChannel", luaLcdDrawChannel },
|
||||
{ "drawSwitch", luaLcdDrawSwitch },
|
||||
{ "drawSource", luaLcdDrawSource },
|
||||
{ "drawGauge", luaLcdDrawGauge },
|
||||
{ "getLastPos", luaLcdGetLastPos },
|
||||
{ "getLastRightPos", luaLcdGetLastPos },
|
||||
{ "getLastLeftPos", luaLcdGetLeftPos },
|
||||
{ "drawPixmap", luaLcdDrawPixmap },
|
||||
{ "drawScreenTitle", luaLcdDrawScreenTitle },
|
||||
{ "drawCombobox", luaLcdDrawCombobox },
|
||||
{ NULL, NULL } /* sentinel */
|
||||
};
|
||||
LROT_BEGIN(lcdlib, NULL, 0)
|
||||
LROT_FUNCENTRY( refresh, luaLcdRefresh )
|
||||
LROT_FUNCENTRY( clear, luaLcdClear )
|
||||
LROT_FUNCENTRY( resetBacklightTimeout, luaLcdResetBacklightTimeout )
|
||||
LROT_FUNCENTRY( drawPoint, luaLcdDrawPoint )
|
||||
LROT_FUNCENTRY( drawLine, luaLcdDrawLine )
|
||||
LROT_FUNCENTRY( drawRectangle, luaLcdDrawRectangle )
|
||||
LROT_FUNCENTRY( drawFilledRectangle, luaLcdDrawFilledRectangle )
|
||||
LROT_FUNCENTRY( drawText, luaLcdDrawText )
|
||||
LROT_FUNCENTRY( drawTimer, luaLcdDrawTimer )
|
||||
LROT_FUNCENTRY( drawNumber, luaLcdDrawNumber )
|
||||
LROT_FUNCENTRY( drawChannel, luaLcdDrawChannel )
|
||||
LROT_FUNCENTRY( drawSwitch, luaLcdDrawSwitch )
|
||||
LROT_FUNCENTRY( drawSource, luaLcdDrawSource )
|
||||
LROT_FUNCENTRY( drawGauge, luaLcdDrawGauge )
|
||||
LROT_FUNCENTRY( getLastPos, luaLcdGetLastPos )
|
||||
LROT_FUNCENTRY( getLastRightPos, luaLcdGetLastPos )
|
||||
LROT_FUNCENTRY( getLastLeftPos, luaLcdGetLeftPos )
|
||||
LROT_FUNCENTRY( drawPixmap, luaLcdDrawPixmap )
|
||||
LROT_FUNCENTRY( drawScreenTitle, luaLcdDrawScreenTitle )
|
||||
LROT_FUNCENTRY( drawCombobox, luaLcdDrawCombobox )
|
||||
LROT_END(lcdlib, NULL, 0)
|
||||
|
||||
LROT_BEGIN(bitmaplib, NULL, 0)
|
||||
LROT_END(bitmaplib, NULL, 0)
|
||||
|
||||
extern "C" {
|
||||
LUALIB_API int luaopen_bitmap(lua_State * L) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
#include "api_filesystem.h"
|
||||
|
||||
#if defined(LIBOPENUI)
|
||||
#include "api_colorlcd.h"
|
||||
#include "libopenui.h"
|
||||
#else
|
||||
#include "libopenui/src/libopenui_file.h"
|
||||
@@ -272,14 +271,11 @@ void luaClose(lua_State ** L)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void luaRegisterLibraries(lua_State * L)
|
||||
{
|
||||
luaL_openlibs(L);
|
||||
registerDirIter(L);
|
||||
|
||||
#if defined(COLORLCD)
|
||||
registerBitmapClass(L);
|
||||
#endif
|
||||
lua_settop(L, 0);
|
||||
}
|
||||
|
||||
#define GC_REPORT_TRESHOLD (2*1024)
|
||||
@@ -780,6 +776,39 @@ void luaError(lua_State * L, uint8_t error)
|
||||
TRACE_ERROR("%s\n", lua_warning_info);
|
||||
}
|
||||
|
||||
// static void luaDumpStack (lua_State *L) {
|
||||
// int top=lua_gettop(L);
|
||||
// for (int i=1; i <= top; i++) {
|
||||
// printf("%d\t%s\t", i, luaL_typename(L,i));
|
||||
// switch (lua_type(L, i)) {
|
||||
// case LUA_TNUMBER:
|
||||
// printf("%g\n",lua_tonumber(L,i));
|
||||
// break;
|
||||
// case LUA_TSTRING:
|
||||
// printf("%s\n",lua_tostring(L,i));
|
||||
// break;
|
||||
// case LUA_TBOOLEAN:
|
||||
// printf("%s\n", (lua_toboolean(L, i) ? "true" : "false"));
|
||||
// break;
|
||||
// case LUA_TNIL:
|
||||
// printf("%s\n", "nil");
|
||||
// break;
|
||||
// case LUA_TTABLE: {
|
||||
// lua_pushnil(L);
|
||||
// while(lua_next(L,i)) {
|
||||
// const char* key = lua_tostring(L,-2);
|
||||
// const char* val = lua_tostring(L,-1);
|
||||
// printf("\t%s = %s\n", key, val);
|
||||
// lua_pop(L,1);
|
||||
// }
|
||||
// } break;
|
||||
// default:
|
||||
// printf("%p\n",lua_topointer(L,i));
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// Register a function from a table on the top of the stack
|
||||
static int luaRegisterFunction(const char * key)
|
||||
{
|
||||
|
||||
+25
-2
@@ -31,7 +31,6 @@ extern "C" {
|
||||
#include <lua.h>
|
||||
#include <lauxlib.h>
|
||||
#include <lualib.h>
|
||||
#include <lrotable.h>
|
||||
#include <lgc.h>
|
||||
}
|
||||
|
||||
@@ -62,7 +61,31 @@ extern lua_State * lsScripts;
|
||||
extern bool luaLcdAllowed;
|
||||
|
||||
#if defined(COLORLCD)
|
||||
extern lua_State * lsWidgets;
|
||||
//
|
||||
// Obsoleted definitions:
|
||||
// -> please check against libopenui_defines.h for conflicts
|
||||
// -> here we use the 4 most significant bits for our flags (32 bit unsigned)
|
||||
//
|
||||
// INVERS & BLINK are used in most scripts, let's offer a compatibility mode.
|
||||
//
|
||||
#undef INVERS
|
||||
#undef BLINK
|
||||
|
||||
#define INVERS 0x01u
|
||||
#define BLINK 0x1000u
|
||||
#define RGB_FLAG 0x8000u
|
||||
|
||||
extern bool luaLcdAllowed;
|
||||
|
||||
class BitmapBuffer;
|
||||
extern BitmapBuffer* luaLcdBuffer;
|
||||
|
||||
class Widget;
|
||||
extern Widget* runningFS;
|
||||
|
||||
LcdFlags flagsRGB(LcdFlags flags);
|
||||
|
||||
extern lua_State* lsWidgets;
|
||||
extern uint32_t luaExtraMemoryUsage;
|
||||
void luaInitThemesAndWidgets();
|
||||
#endif
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
#include "lua_api.h"
|
||||
#include "lua_event.h"
|
||||
#include "api_colorlcd.h"
|
||||
#include "draw_functions.h"
|
||||
|
||||
#define MAX_INSTRUCTIONS (20000/100)
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include "lua_widget.h"
|
||||
|
||||
#include "lua_api.h"
|
||||
#include "api_colorlcd.h"
|
||||
|
||||
#define MAX_INSTRUCTIONS (20000/100)
|
||||
|
||||
|
||||
@@ -21,12 +21,12 @@
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "opentx.h"
|
||||
#include "bin_allocator.h"
|
||||
#include "lua_api.h"
|
||||
|
||||
#include "widget.h"
|
||||
#include "libopenui_file.h"
|
||||
#include "api_colorlcd.h"
|
||||
#include "view_main.h"
|
||||
|
||||
#include "lua_widget.h"
|
||||
@@ -35,13 +35,6 @@
|
||||
#define MAX_INSTRUCTIONS (20000/100)
|
||||
#define LUA_WARNING_INFO_LEN 64
|
||||
|
||||
// #if defined(HARDWARE_TOUCH)
|
||||
// #include "touch.h"
|
||||
// #define EVT_TOUCH_SWIPE_LOCK 4
|
||||
// #define EVT_TOUCH_SWIPE_SPEED 60
|
||||
// #define EVT_TOUCH_SWIPE_TIMEOUT 50
|
||||
// #endif
|
||||
|
||||
lua_State * lsWidgets = NULL;
|
||||
|
||||
extern int custom_lua_atpanic(lua_State *L);
|
||||
@@ -49,8 +42,7 @@ extern int custom_lua_atpanic(lua_State *L);
|
||||
#define LUA_WIDGET_FILENAME "/main.lua"
|
||||
#define LUA_FULLPATH_MAXLEN \
|
||||
(LEN_FILE_PATH_MAX + LEN_SCRIPT_FILENAME + \
|
||||
LEN_FILE_EXTENSION_MAX) // max length (example:
|
||||
// /SCRIPTS/THEMES/mytheme.lua)
|
||||
LEN_FILE_EXTENSION_MAX)
|
||||
|
||||
static void luaHook(lua_State *L, lua_Debug *ar)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user