The .. operator didn't work well with integers on the real radio (while

it was ok on the simu). I will try to fix the issue later, for now I
introduce the lcd.drawSource(...) function. The Wizard pages are now ok
on the radio itself!
This commit is contained in:
bsongis
2014-05-22 19:36:56 +02:00
parent 1c54a30f01
commit b01a936b4d
2 changed files with 15 additions and 3 deletions
+12
View File
@@ -256,6 +256,16 @@ static int luaLcdDrawSwitch(lua_State *L)
return 0;
}
static int luaLcdDrawSource(lua_State *L)
{
int x = luaL_checkinteger(L, 1);
int y = luaL_checkinteger(L, 2);
int s = luaL_checkinteger(L, 3);
int att = luaL_checkinteger(L, 4);
putsMixerSource(x, y, s, att);
return 0;
}
static int luaLcdDrawPixmap(lua_State *L)
{
int x = luaL_checkinteger(L, 1);
@@ -952,6 +962,7 @@ static const luaL_Reg lcdLib[] = {
{ "drawRectangle", luaLcdDrawRectangle },
{ "drawText", luaLcdDrawText },
{ "drawSwitch", luaLcdDrawSwitch },
{ "drawSource", luaLcdDrawSource },
{ "drawRect", luaLcdDrawRect },
{ "drawPixmap", luaLcdDrawPixmap },
{ "drawScreenTitle", luaLcdDrawScreenTitle },
@@ -998,6 +1009,7 @@ void luaInit()
lua_registerint(L, "STICK_THROTTLE", MIXSRC_Thr);
lua_registerint(L, "STICK_AILERON", MIXSRC_Ail);
lua_registerint(L, "SWITCH_LAST", SWSRC_LAST_LOGICAL_SWITCH);
lua_registerint(L, "SOURCE_FIRST_CH", MIXSRC_FIRST_CH);
lua_registerint(L, "EVT_MENU_BREAK", EVT_KEY_BREAK(KEY_MENU));
lua_registerint(L, "EVT_PAGE_BREAK", EVT_KEY_BREAK(KEY_PAGE));
lua_registerint(L, "EVT_ENTER_BREAK", EVT_KEY_BREAK(KEY_ENTER));
+3 -3
View File
@@ -122,8 +122,8 @@ local function drawAileronsMenu()
lcd.drawPixmap(112, 8, "/TEMPLATES/ailerons-2.bmp")
lcd.drawText(20, LCD_H-16, "Assign channels", 0);
lcd.drawText(LCD_W/2-19, LCD_H-8, ">>>", 0);
lcd.drawText(116, LCD_H-8, "CH" .. (aileronsCH1+1), getFieldFlags(1))
lcd.drawText(175, LCD_H-8, "CH" .. (aileronsCH2+1), getFieldFlags(2))
lcd.drawSource(116, LCD_H-8, SOURCE_FIRST_CH+aileronsCH1, getFieldFlags(1))
lcd.drawSource(175, LCD_H-8, SOURCE_FIRST_CH+aileronsCH2, getFieldFlags(2))
fieldsMax = 2
elseif aileronsMode == 1 then
-- No ailerons
@@ -134,7 +134,7 @@ local function drawAileronsMenu()
lcd.drawPixmap(112, 8, "/TEMPLATES/ailerons-1.bmp")
lcd.drawText(25, LCD_H-16, "Assign channel", 0);
lcd.drawText(LCD_W/2-19, LCD_H-8, ">>>", 0);
lcd.drawText(151, LCD_H-8, "CH" .. (aileronsCH1+1), getFieldFlags(1))
lcd.drawSource(151, LCD_H-8, SOURCE_FIRST_CH+aileronsCH1, getFieldFlags(1))
fieldsMax = 1
end
end