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

Some more LCD functions renamed

This commit is contained in:
Bertrand Songis 2015-11-24 22:09:22 +01:00
parent f92b71c0b8
commit 01187e60c2
53 changed files with 318 additions and 333 deletions

View file

@ -54,7 +54,10 @@
#define RADIO "taranisplus"
#elif defined(PCBTARANIS)
#define RADIO "taranis"
#else
#elif defined(PCBHORUS)
#define RADIO "horus"
#elif defined(PCBFLAMENCO)
#define RADIO "flamenco"
#error "Unknown board"
#endif
@ -719,11 +722,9 @@ const luaR_value_entry opentxConstants[] = {
{ "MIXSRC_CH1", MIXSRC_CH1 },
{ "SWSRC_LAST", SWSRC_LAST_LOGICAL_SWITCH },
{ "EVT_MENU_BREAK", EVT_KEY_BREAK(KEY_MENU) },
#if defined(PCBTARANIS)
{ "EVT_PAGE_BREAK", EVT_KEY_BREAK(KEY_PAGE) },
{ "EVT_PAGE_LONG", EVT_KEY_LONG(KEY_PAGE) },
{ "EVT_ENTER_BREAK", EVT_KEY_BREAK(KEY_ENTER) },
{ "EVT_ENTER_LONG", EVT_KEY_LONG(KEY_ENTER) },
{ "EVT_EXIT_BREAK", EVT_KEY_BREAK(KEY_EXIT) },
{ "EVT_PLUS_BREAK", EVT_KEY_BREAK(KEY_PLUS) },
{ "EVT_MINUS_BREAK", EVT_KEY_BREAK(KEY_MINUS) },
{ "EVT_PLUS_FIRST", EVT_KEY_FIRST(KEY_PLUS) },
@ -732,11 +733,15 @@ const luaR_value_entry opentxConstants[] = {
{ "EVT_MINUS_REPT", EVT_KEY_REPT(KEY_MINUS) },
{ "FILL_WHITE", FILL_WHITE },
{ "GREY_DEFAULT", GREY_DEFAULT },
{ "SOLID", SOLID },
{ "DOTTED", DOTTED },
{ "FORCE", FORCE },
{ "ERASE", ERASE },
{ "ROUND", ROUND },
#endif
{ "EVT_ENTER_BREAK", EVT_KEY_BREAK(KEY_ENTER) },
{ "EVT_ENTER_LONG", EVT_KEY_LONG(KEY_ENTER) },
{ "EVT_EXIT_BREAK", EVT_KEY_BREAK(KEY_EXIT) },
{ "SOLID", SOLID },
{ "DOTTED", DOTTED },
{ "LCD_W", LCD_W },
{ "LCD_H", LCD_H },
{ "PLAY_NOW", PLAY_NOW },

View file

@ -88,7 +88,7 @@ static int luaLcdDrawPoint(lua_State *L)
if (!luaLcdAllowed) return 0;
int x = luaL_checkinteger(L, 1);
int y = luaL_checkinteger(L, 2);
lcd_plot(x, y);
lcdDrawPoint(x, y);
return 0;
}
@ -402,7 +402,7 @@ static int luaLcdDrawFilledRectangle(lua_State *L)
int w = luaL_checkinteger(L, 3);
int h = luaL_checkinteger(L, 4);
unsigned int flags = luaL_optunsigned(L, 5, 0);
drawFilledRect(x, y, w, h, SOLID, flags);
lcdDrawFilledRect(x, y, w, h, SOLID, flags);
return 0;
}
@ -438,7 +438,7 @@ static int luaLcdDrawGauge(lua_State *L)
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++) {
lcd_hline(x+1, y+i, len);
lcdDrawSolidHorizontalLine(x+1, y+i, len);
}
return 0;
}
@ -468,13 +468,15 @@ static int luaLcdDrawScreenTitle(lua_State *L)
int cnt = luaL_checkinteger(L, 3);
if (cnt) displayScreenIndex(idx-1, cnt, 0);
drawFilledRect(0, 0, LCD_W, FH, SOLID, FILL_WHITE|GREY_DEFAULT);
lcdDrawFilledRect(0, 0, LCD_W, FH, SOLID, FILL_WHITE|GREY_DEFAULT);
title(str);
return 0;
}
#endif
#if defined(PCBTARANIS)
/*luadoc
@function lcd.drawCombobox(x, y, w, list, idx [, flags])
@ -511,39 +513,40 @@ static int luaLcdDrawCombobox(lua_State *L)
// TODO error
}
if (flags & BLINK) {
drawFilledRect(x, y, w-9, count*9+2, SOLID, ERASE);
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);
}
drawFilledRect(x+1, y+1+9*idx, w-11, 9);
drawFilledRect(x+w-10, y, 10, 11, SOLID, ERASE);
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) {
drawFilledRect(x, y, w, 11);
drawFilledRect(x+w-9, y+1, 8, 9, SOLID, ERASE);
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 {
drawFilledRect(x, y, w, 11, SOLID, ERASE);
lcdDrawFilledRect(x, y, w, 11, SOLID, ERASE);
lcdDrawRect(x, y, w, 11);
drawFilledRect(x+w-10, y+1, 9, 9, SOLID);
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);
}
lcd_hline(x+w-8, y+3, 6);
lcd_hline(x+w-8, y+5, 6);
lcd_hline(x+w-8, y+7, 6);
lcdDrawSolidHorizontalLine(x+w-8, y+3, 6);
lcdDrawSolidHorizontalLine(x+w-8, y+5, 6);
lcdDrawSolidHorizontalLine(x+w-8, y+7, 6);
return 0;
}
#endif
const luaL_Reg lcdLib[] = {
{ "lock", luaLcdLock },
@ -562,6 +565,8 @@ const luaL_Reg lcdLib[] = {
{ "drawSource", luaLcdDrawSource },
{ "drawPixmap", luaLcdDrawPixmap },
{ "drawScreenTitle", luaLcdDrawScreenTitle },
#if defined(PCBTARANIS)
{ "drawCombobox", luaLcdDrawCombobox },
#endif
{ NULL, NULL } /* sentinel */
};

View file

@ -479,7 +479,7 @@ void displayLuaError(const char * title)
}
}
void displayAcknowledgeLuaError(uint8_t event)
void displayAcknowledgeLuaError(evt_t event)
{
s_warning_result = false;
displayLuaError(s_warning);
@ -583,12 +583,15 @@ void luaDoOneRunStandalone(uint8_t evt)
return;
}
else if (luaDisplayStatistics) {
lcd_hline(0, 7*FH-1, lcdLastPos+6, ERASE);
#if defined(COLORLCD)
#else
lcdDrawSolidHorizontalLine(0, 7*FH-1, lcdLastPos+6, ERASE);
lcd_puts(0, 7*FH, "GV Use: ");
lcd_outdezAtt(lcdLastPos, 7*FH, luaGetMemUsed(), LEFT);
lcd_putc(lcdLastPos, 7*FH, 'b');
lcd_hline(0, 7*FH-2, lcdLastPos+6, FORCE);
lcdDrawSolidHorizontalLine(0, 7*FH-2, lcdLastPos+6, FORCE);
lcdDrawVerticalLine(lcdLastPos+6, 7*FH-2, FH+2, SOLID, FORCE);
#endif
}
}
}