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

Enables lcd.drawGauge on Horus (#3487)

* Enables lcd.drawGauge on Horus

* cosmetic, unsigned, and add flags
This commit is contained in:
3djc 2016-05-13 03:34:59 -07:00 committed by Bertrand Songis
parent f46ff84845
commit e55a84d8b7

View file

@ -415,9 +415,9 @@ static int luaLcdDrawFilledRectangle(lua_State *L)
return 0; return 0;
} }
#if !defined(COLORLCD)
/*luadoc /*luadoc
@function lcd.drawGauge(x, y, w, h, fill, maxfill) @function lcd.drawGauge(x, y, w, h, fill, maxfill [, flags])
Draw a simple gauge that is filled based upon fill value Draw a simple gauge that is filled based upon fill value
@ -444,13 +444,13 @@ static int luaLcdDrawGauge(lua_State *L)
int h = luaL_checkinteger(L, 4); int h = luaL_checkinteger(L, 4);
int num = luaL_checkinteger(L, 5); int num = luaL_checkinteger(L, 5);
int den = luaL_checkinteger(L, 6); int den = luaL_checkinteger(L, 6);
// int flags = luaL_checkinteger(L, 7); unsigned int flags = luaL_optunsigned(L, 7, 0);
lcdDrawRect(x, y, w, h); lcdDrawRect(x, y, w, h);
uint8_t len = limit((uint8_t)1, uint8_t(w*num/den), uint8_t(w)); uint8_t len = limit((uint8_t)1, uint8_t(w*num/den), uint8_t(w));
lcdDrawSolidFilledRect(x+1, y+1, len, h-2); lcdDrawSolidFilledRect(x+1, y+1, len, h-2, flags);
return 0; return 0;
} }
#endif
#if !defined(COLORLCD) #if !defined(COLORLCD)
/*luadoc /*luadoc
@ -590,12 +590,12 @@ const luaL_Reg lcdLib[] = {
{ "drawChannel", luaLcdDrawChannel }, { "drawChannel", luaLcdDrawChannel },
{ "drawSwitch", luaLcdDrawSwitch }, { "drawSwitch", luaLcdDrawSwitch },
{ "drawSource", luaLcdDrawSource }, { "drawSource", luaLcdDrawSource },
{ "drawGauge", luaLcdDrawGauge },
#if defined(COLORLCD) #if defined(COLORLCD)
{ "setColor", luaLcdSetColor }, { "setColor", luaLcdSetColor },
{ "RGB", luaRGB }, { "RGB", luaRGB },
#else #else
{ "getLastPos", luaLcdGetLastPos }, { "getLastPos", luaLcdGetLastPos },
{ "drawGauge", luaLcdDrawGauge },
{ "drawPixmap", luaLcdDrawPixmap }, { "drawPixmap", luaLcdDrawPixmap },
{ "drawScreenTitle", luaLcdDrawScreenTitle }, { "drawScreenTitle", luaLcdDrawScreenTitle },
{ "drawCombobox", luaLcdDrawCombobox }, { "drawCombobox", luaLcdDrawCombobox },