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

Make lcd.drawScreenTitle and lcd.drawCombobox compatible with X7 (#4374)

This commit is contained in:
3djc 2017-02-02 01:33:42 -08:00 committed by Bertrand Songis
parent 8775550147
commit 0c550588bb
2 changed files with 11 additions and 7 deletions

View file

@ -2,7 +2,7 @@
* Copyright (C) OpenTX * Copyright (C) OpenTX
* *
* Based on code named * Based on code named
* th9x - http://code.google.com/p/th9x * th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x * er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x * gruvin9x - http://code.google.com/p/gruvin9x
* *
@ -236,7 +236,7 @@ void lcdDrawHorizontalLine(coord_t x, coord_t y, coord_t w, uint8_t pat, LcdFlag
void lcdDrawLine(coord_t x1, coord_t y1, coord_t x2, coord_t y2, uint8_t pat=SOLID, LcdFlags att=0); void lcdDrawLine(coord_t x1, coord_t y1, coord_t x2, coord_t y2, uint8_t pat=SOLID, LcdFlags att=0);
#endif #endif
void lcdDrawFilledRect(coord_t x, scoord_t y, coord_t w, coord_t h, uint8_t pat, LcdFlags att=0); void lcdDrawFilledRect(coord_t x, scoord_t y, coord_t w, coord_t h, uint8_t pat=SOLID, LcdFlags att=0);
inline void lcdDrawSolidFilledRect(coord_t x, scoord_t y, coord_t w, coord_t h, LcdFlags att=0) inline void lcdDrawSolidFilledRect(coord_t x, scoord_t y, coord_t w, coord_t h, LcdFlags att=0)
{ {
lcdDrawFilledRect(x, y, w, h, SOLID, att); lcdDrawFilledRect(x, y, w, h, SOLID, att);
@ -272,7 +272,7 @@ inline display_t getPixel(uint8_t x, uint8_t y)
if (x>=LCD_W || y>=LCD_H) { if (x>=LCD_W || y>=LCD_H) {
return 0; return 0;
} }
display_t pixel = displayBuf[(y / 8) * LCD_W + x]; display_t pixel = displayBuf[(y / 8) * LCD_W + x];
display_t mask = 1 << (y & 7); display_t mask = 1 << (y & 7);
return ((pixel & mask) ? 0xf : 0); return ((pixel & mask) ? 0xf : 0);

View file

@ -571,7 +571,7 @@ static int luaLcdDrawGauge(lua_State *L)
} }
#if LCD_DEPTH > 1 && !defined(COLORLCD) #if !defined(COLORLCD)
/*luadoc /*luadoc
@function lcd.drawScreenTitle(title, page, pages) @function lcd.drawScreenTitle(title, page, pages)
@ -584,7 +584,7 @@ Draw a title bar
@param pages (number) total number of pages. Only used as indicator on @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`) the right side of title bar. (i.e. idx=2, cnt=5, display `2/5`)
@notice Only available on Taranis X9 series @notice Only available on Taranis
@status current Introduced in 2.0.0 @status current Introduced in 2.0.0
*/ */
@ -596,14 +596,16 @@ static int luaLcdDrawScreenTitle(lua_State *L)
int cnt = luaL_checkinteger(L, 3); int cnt = luaL_checkinteger(L, 3);
if (cnt) drawScreenIndex(idx-1, cnt, 0); if (cnt) drawScreenIndex(idx-1, cnt, 0);
#if LCD_DEPTH > 1
lcdDrawFilledRect(0, 0, LCD_W, FH, SOLID, FILL_WHITE|GREY_DEFAULT); lcdDrawFilledRect(0, 0, LCD_W, FH, SOLID, FILL_WHITE|GREY_DEFAULT);
#endif
title(str); title(str);
return 0; return 0;
} }
#endif #endif
#if LCD_DEPTH > 1 && !defined(COLORLCD) #if !defined(COLORLCD)
/*luadoc /*luadoc
@function lcd.drawCombobox(x, y, w, list, idx [, flags]) @function lcd.drawCombobox(x, y, w, list, idx [, flags])
@ -624,7 +626,7 @@ Draw a combo box
* `INVERS` combo box collapsed, text inversed * `INVERS` combo box collapsed, text inversed
* `0 or not present` combo box collapsed, text normal * `0 or not present` combo box collapsed, text normal
@notice Only available on Taranis X9 series @notice Only available on Taranis
@status current Introduced in 2.0.0 @status current Introduced in 2.0.0
*/ */
@ -787,7 +789,9 @@ const luaL_Reg lcdLib[] = {
{ "drawScreenTitle", luaLcdDrawScreenTitle }, { "drawScreenTitle", luaLcdDrawScreenTitle },
{ "drawCombobox", luaLcdDrawCombobox }, { "drawCombobox", luaLcdDrawCombobox },
#else #else
{ "drawScreenTitle", luaLcdDrawScreenTitle },
{ "getLastPos", luaLcdGetLastPos }, { "getLastPos", luaLcdGetLastPos },
{ "drawCombobox", luaLcdDrawCombobox },
#endif #endif
{ NULL, NULL } /* sentinel */ { NULL, NULL } /* sentinel */
}; };