1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-15 04:15:26 +03:00

[Horus] No more errors in Lua interface compilation

This commit is contained in:
Bertrand Songis 2015-11-25 21:38:05 +01:00
parent 791b1173e3
commit 71f08998dd
5 changed files with 29 additions and 19 deletions

View file

@ -538,6 +538,7 @@ static int luaKillEvents(lua_State *L)
return 0;
}
#if !defined(COLORLCD)
/*luadoc
@function GREY()
@ -552,6 +553,7 @@ static int luaGrey(lua_State *L)
lua_pushunsigned(L, GREY(index));
return 1;
}
#endif
/*luadoc
@function getGeneralSettings()
@ -686,7 +688,9 @@ const luaL_Reg opentxLib[] = {
{ "defaultStick", luaDefaultStick },
{ "defaultChannel", luaDefaultChannel },
{ "killEvents", luaKillEvents },
#if !defined(COLORLCD)
{ "GREY", luaGrey },
#endif
{ NULL, NULL } /* sentinel */
};

View file

@ -123,6 +123,7 @@ static int luaLcdDrawLine(lua_State *L)
return 0;
}
#if !defined(COLORLCD)
/*luadoc
@function lcd.getLastPos()
@ -137,6 +138,7 @@ static int luaLcdGetLastPos(lua_State *L)
lua_pushinteger(L, lcdLastPos);
return 1;
}
#endif
/*luadoc
@function lcd.drawText(x, y, text [, flags])
@ -194,7 +196,7 @@ static int luaLcdDrawTimer(lua_State *L)
int y = luaL_checkinteger(L, 2);
int seconds = luaL_checkinteger(L, 3);
unsigned int att = luaL_optunsigned(L, 4, 0);
#if defined(PCBFLAMENCO)
#if defined(COLORLCD)
putsTimer(x, y, seconds, att|LEFT);
#else
putsTimer(x, y, seconds, att|LEFT, att);
@ -323,6 +325,7 @@ static int luaLcdDrawSource(lua_State *L)
return 0;
}
#if !defined(COLORLCD)
/*luadoc
@function lcd.drawPixmap(x, y, name)
@ -336,7 +339,6 @@ Draws a bitmap at (x,y)
@status current Introduced in 2.0.0
*/
#if !defined(COLORLCD)
static int luaLcdDrawPixmap(lua_State *L)
{
if (!luaLcdAllowed) return 0;
@ -406,6 +408,7 @@ static int luaLcdDrawFilledRectangle(lua_State *L)
return 0;
}
#if !defined(COLORLCD)
/*luadoc
@function lcd.drawGauge(x, y, w, h, fill, maxfill)
@ -437,12 +440,12 @@ static int luaLcdDrawGauge(lua_State *L)
// int flags = luaL_checkinteger(L, 7);
lcdDrawRect(x, y, w, h);
uint8_t len = limit((uint8_t)1, uint8_t(w*num/den), uint8_t(w));
for (int i=1; i<h-1; i++) {
lcdDrawSolidHorizontalLine(x+1, y+i, len);
}
lcdDrawSolidFilledRect(x+1, y+1, len, h-2);
return 0;
}
#endif
#if !defined(COLORLCD)
/*luadoc
@function lcd.drawScreenTitle(title, page, pages)
@ -459,7 +462,6 @@ the right side of title bar. (i.e. idx=2, cnt=5, display `2/5`)
@status current Introduced in 2.0.0
*/
#if !defined(COLORLCD)
static int luaLcdDrawScreenTitle(lua_State *L)
{
if (!luaLcdAllowed) return 0;
@ -475,8 +477,7 @@ static int luaLcdDrawScreenTitle(lua_State *L)
}
#endif
#if defined(PCBTARANIS)
#if !defined(COLORLCD)
/*luadoc
@function lcd.drawCombobox(x, y, w, list, idx [, flags])
@ -551,21 +552,21 @@ static int luaLcdDrawCombobox(lua_State *L)
const luaL_Reg lcdLib[] = {
{ "lock", luaLcdLock },
{ "clear", luaLcdClear },
{ "getLastPos", luaLcdGetLastPos },
{ "drawPoint", luaLcdDrawPoint },
{ "drawLine", luaLcdDrawLine },
{ "drawRectangle", luaLcdDrawRectangle },
{ "drawFilledRectangle", luaLcdDrawFilledRectangle },
{ "drawGauge", luaLcdDrawGauge },
{ "drawText", luaLcdDrawText },
{ "drawTimer", luaLcdDrawTimer },
{ "drawNumber", luaLcdDrawNumber },
{ "drawChannel", luaLcdDrawChannel },
{ "drawSwitch", luaLcdDrawSwitch },
{ "drawSource", luaLcdDrawSource },
#if !defined(COLORLCD)
{ "getLastPos", luaLcdGetLastPos },
{ "drawGauge", luaLcdDrawGauge },
{ "drawPixmap", luaLcdDrawPixmap },
{ "drawScreenTitle", luaLcdDrawScreenTitle },
#if defined(PCBTARANIS)
{ "drawCombobox", luaLcdDrawCombobox },
#endif
{ NULL, NULL } /* sentinel */

View file

@ -80,7 +80,9 @@ static int luaModelSetInfo(lua_State *L)
if (!strcmp(key, "name")) {
const char * name = luaL_checkstring(L, -1);
str2zchar(g_model.header.name, name, sizeof(g_model.header.name));
#if defined(EEPROM)
memcpy(modelHeaders[g_eeGeneral.currModel].name, g_model.header.name, sizeof(g_model.header.name));
#endif
}
else if (!strcmp(key, "bitmap")) {
const char * name = luaL_checkstring(L, -1);
@ -153,7 +155,10 @@ static int luaModelSetModule(lua_State *L)
module.rfProtocol = luaL_checkinteger(L, -1);
}
else if (!strcmp(key, "modelId")) {
g_model.header.modelId[idx] = modelHeaders[g_eeGeneral.currModel].modelId[idx] = luaL_checkinteger(L, -1);
g_model.header.modelId[idx] = luaL_checkinteger(L, -1);
#if defined(EEPROM)
modelHeaders[g_eeGeneral.currModel].modelId[idx] = g_model.header.modelId[idx];
#endif
}
else if (!strcmp(key, "firstChannel")) {
module.channelsStart = luaL_checkinteger(L, -1);

View file

@ -546,7 +546,7 @@ void luaExec(const char *filename)
}
}
void luaDoOneRunStandalone(uint8_t evt)
void luaDoOneRunStandalone(evt_t evt)
{
static uint8_t luaDisplayStatistics = false;
@ -663,7 +663,7 @@ bool luaDoOneRunPermanentScript(uint8_t evt, int i, uint32_t scriptType)
filename = script.file;
#endif
if ((scriptType & RUN_TELEM_FG_SCRIPT) &&
#if defined(PCBFLAMENCO)
#if defined(COLORLCD)
(g_menuStack[0]==menuMainView && sid.reference==SCRIPT_TELEMETRY_FIRST+g_eeGeneral.view-VIEW_TELEM1)) {
#else
(g_menuStack[0]==menuTelemetryFrsky && sid.reference==SCRIPT_TELEMETRY_FIRST+s_frsky_view)) {