1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-17 13:25:20 +03:00

Bsongis/lua interpreter added on x7d (#3999)

* [X7D] Lua option added (only standalone scripts)

* [X7D] Compilation fix

* [X7D] Compilation fix

* [X7D] Compilation fix

* [X7D] Compilation fix
This commit is contained in:
Bertrand Songis 2016-11-10 21:41:16 +01:00 committed by GitHub
parent 35571ad4d1
commit d58244ebde
23 changed files with 174 additions and 120 deletions

View file

@ -38,6 +38,7 @@ set(LUA_INCLUDES_STM32F4
-I${RADIO_SRC_DIRECTORY}/${STM32LIB_DIR}/CMSIS/Device/ST/STM32F4xx/Include
)
add_lua_export_target(taranis ${LUA_INCLUDES_STM32F2} -DPCBTARANIS)
add_lua_export_target(taranis_x9e ${LUA_INCLUDES_STM32F4} -DPCBTARANIS -DPCBX9E -DSTM32F40_41xxx)
add_lua_export_target(horus ${LUA_INCLUDES_STM32F4} -DPCBHORUS -DSTM32F40_41xxx)
add_lua_export_target(x7d ${LUA_INCLUDES_STM32F2} -DPCBTARANIS -DPCBX7D)
add_lua_export_target(x9d ${LUA_INCLUDES_STM32F2} -DPCBTARANIS -DPCBX9D)
add_lua_export_target(x9e ${LUA_INCLUDES_STM32F4} -DPCBTARANIS -DPCBX9E -DSTM32F40_41xxx)
add_lua_export_target(horus ${LUA_INCLUDES_STM32F4} -DPCBHORUS -DSTM32F40_41xxx)

View file

@ -30,9 +30,11 @@
#elif defined(PCBFLAMENCO)
#include "lua/lua_exports_flamenco.inc"
#elif defined(PCBX9E)
#include "lua/lua_exports_taranis_x9e.inc"
#include "lua/lua_exports_x9e.inc"
#elif defined(PCBX7D)
#include "lua/lua_exports_x7d.inc"
#elif defined(PCBTARANIS)
#include "lua/lua_exports_taranis.inc"
#include "lua/lua_exports_x9d.inc"
#endif
#if defined(SIMU)
@ -832,7 +834,7 @@ static int luaKillEvents(lua_State * L)
return 0;
}
#if !defined(COLORLCD)
#if LCD_DEPTH > 1 && !defined(COLORLCD)
/*luadoc
@function GREY()
@ -1141,7 +1143,7 @@ const luaL_Reg opentxLib[] = {
{ "defaultChannel", luaDefaultChannel },
{ "getRSSI", luaGetRSSI },
{ "killEvents", luaKillEvents },
#if !defined(COLORLCD)
#if LCD_DEPTH > 1 && !defined(COLORLCD)
{ "GREY", luaGrey },
#endif
{ "sportTelemetryPop", luaSportTelemetryPop },
@ -1243,8 +1245,10 @@ const luaR_value_entry opentxConstants[] = {
{ "EVT_MINUS_FIRST", EVT_KEY_FIRST(KEY_MINUS) },
{ "EVT_PLUS_REPT", EVT_KEY_REPT(KEY_PLUS) },
{ "EVT_MINUS_REPT", EVT_KEY_REPT(KEY_MINUS) },
#if LCD_DEPTH > 1
{ "FILL_WHITE", FILL_WHITE },
{ "GREY_DEFAULT", GREY_DEFAULT },
#endif
{ "FORCE", FORCE },
{ "ERASE", ERASE },
{ "ROUND", ROUND },

View file

@ -423,7 +423,7 @@ static int luaLcdDrawBitmap(lua_State *L)
return 0;
}
#else
#elif LCD_DEPTH > 1
/*luadoc
@function lcd.drawPixmap(x, y, name)
@ -555,7 +555,7 @@ static int luaLcdDrawGauge(lua_State *L)
}
#if !defined(COLORLCD)
#if LCD_DEPTH > 1 && !defined(COLORLCD)
/*luadoc
@function lcd.drawScreenTitle(title, page, pages)
@ -587,7 +587,7 @@ static int luaLcdDrawScreenTitle(lua_State *L)
}
#endif
#if !defined(COLORLCD)
#if LCD_DEPTH > 1 && !defined(COLORLCD)
/*luadoc
@function lcd.drawCombobox(x, y, w, list, idx [, flags])
@ -761,7 +761,7 @@ const luaL_Reg lcdLib[] = {
{ "drawBitmap", luaLcdDrawBitmap },
{ "setColor", luaLcdSetColor },
{ "RGB", luaRGB },
#else
#elif LCD_DEPTH > 1
{ "getLastPos", luaLcdGetLastPos },
{ "drawPixmap", luaLcdDrawPixmap },
{ "drawScreenTitle", luaLcdDrawScreenTitle },

View file

@ -39,7 +39,9 @@ static int luaModelGetInfo(lua_State *L)
{
lua_newtable(L);
lua_pushtablezstring(L, "name", g_model.header.name);
#if LCD_DEPTH > 1
lua_pushtablenzstring(L, "bitmap", g_model.header.bitmap);
#endif
return 1;
}
@ -68,10 +70,12 @@ static int luaModelSetInfo(lua_State *L)
memcpy(modelHeaders[g_eeGeneral.currModel].name, g_model.header.name, sizeof(g_model.header.name));
#endif
}
#if LCD_DEPTH > 1
else if (!strcmp(key, "bitmap")) {
const char * name = luaL_checkstring(L, -1);
strncpy(g_model.header.bitmap, name, sizeof(g_model.header.bitmap));
}
#endif
}
storageDirty(EE_MODEL);
return 0;

View file

@ -426,7 +426,7 @@ void luaLoadPermanentScripts()
void displayLuaError(const char * title)
{
#if !defined(COLORLCD)
drawMessageBox(title);
DRAW_MESSAGE_BOX(title);
#endif
if (lua_warning_info[0]) {
char * split = strstr(lua_warning_info, ": ");