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

Fix lcdLastPos (#4487)

* Fix lcdLastPos
Introduce lcdLeftPos

* Cosmetics

* Cosmetics

* Non ARM code cleanup

* Move telem screen to midsize

* Fine tune

* Renaming
This commit is contained in:
3djc 2017-03-04 10:16:45 +01:00 committed by Bertrand Songis
parent 4a2bbc665c
commit 80b44444ec
36 changed files with 279 additions and 242 deletions

View file

@ -136,20 +136,55 @@ static int luaLcdDrawLine(lua_State *L)
/*luadoc
@function lcd.getLastPos()
Returns the last x position from previous output
Returns the rightmost x position from previous output
@retval number (integer) x position
@notice Only available on Taranis
@notice For added clarity, it is recommended to use lcd.getLastRightPos()
@status current Introduced in 2.0.0
*/
/*luadoc
@function lcd.getLastRightPos()
Returns the rightest x position from previous drawtext or drawNumber output
@retval number (integer) x position
@notice Only available on Taranis
@notice This is strictly equivalent to former lcd.getLastPos()
@status current Introduced in 2.2.0
*/
static int luaLcdGetLastPos(lua_State *L)
{
lua_pushinteger(L, lcdLastPos);
lua_pushinteger(L, lcdLastRightPos);
return 1;
}
#endif
/*luadoc
@function lcd.getLastLeftPos()
Returns the leftmost x position from previous drawtext or drawNumber output
@retval number (integer) x position
@notice Only available on Taranis
@status current Introduced in 2.2.0
*/
static int luaLcdGetLeftPos(lua_State *L)
{
lua_pushinteger(L, lcdLastLeftPos);
return 1;
}
#endif // COLORLCD
/*luadoc
@function lcd.drawText(x, y, text [, flags])
@ -833,12 +868,16 @@ const luaL_Reg lcdLib[] = {
{ "RGB", luaRGB },
#elif LCD_DEPTH > 1
{ "getLastPos", luaLcdGetLastPos },
{ "getLastRightPos", luaLcdGetLastPos },
{ "getLastLeftPos", luaLcdGetLeftPos },
{ "drawPixmap", luaLcdDrawPixmap },
{ "drawScreenTitle", luaLcdDrawScreenTitle },
{ "drawCombobox", luaLcdDrawCombobox },
#else
{ "drawScreenTitle", luaLcdDrawScreenTitle },
{ "getLastPos", luaLcdGetLastPos },
{ "getLastRightPos", luaLcdGetLastPos },
{ "getLastLeftPos", luaLcdGetLeftPos },
{ "drawCombobox", luaLcdDrawCombobox },
#endif
{ NULL, NULL } /* sentinel */

View file

@ -776,12 +776,12 @@ void luaDoOneRunStandalone(event_t evt)
else if (luaDisplayStatistics) {
#if defined(COLORLCD)
#else
lcdDrawSolidHorizontalLine(0, 7*FH-1, lcdLastPos+6, ERASE);
lcdDrawSolidHorizontalLine(0, 7*FH-1, lcdLastRightPos+6, ERASE);
lcdDrawText(0, 7*FH, "GV Use: ");
lcdDrawNumber(lcdLastPos, 7*FH, luaGetMemUsed(lsScripts), LEFT);
lcdDrawChar(lcdLastPos, 7*FH, 'b');
lcdDrawSolidHorizontalLine(0, 7*FH-2, lcdLastPos+6, FORCE);
lcdDrawVerticalLine(lcdLastPos+6, 7*FH-2, FH+2, SOLID, FORCE);
lcdDrawNumber(lcdLastRightPos, 7*FH, luaGetMemUsed(lsScripts), LEFT);
lcdDrawChar(lcdLastRightPos, 7*FH, 'b');
lcdDrawSolidHorizontalLine(0, 7*FH-2, lcdLastRightPos+6, FORCE);
lcdDrawVerticalLine(lcdLastRightPos+6, 7*FH-2, FH+2, SOLID, FORCE);
#endif
}
}