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

Make lcd.clear() color aware on color screens (#4504)

* Make lcd.clear() color aware on color screens

* Compilation fix
This commit is contained in:
3djc 2017-02-26 11:46:23 +01:00 committed by Bertrand Songis
parent 86d897b23f
commit 1910af51b6
2 changed files with 11 additions and 5 deletions

View file

@ -108,7 +108,6 @@ end
-- Redraw the current page -- Redraw the current page
local function redrawFieldsPage(event) local function redrawFieldsPage(event)
lcd.clear() lcd.clear()
lcd.drawFilledRectangle(0, 0, LCD_W, LCD_H, TEXT_BGCOLOR)
drawScreenTitle("S6R", page, #pages) drawScreenTitle("S6R", page, #pages)
if refreshIndex < #fields then if refreshIndex < #fields then
@ -276,7 +275,6 @@ local function runCalibrationPage(event)
refreshIndex = 0 refreshIndex = 0
end end
lcd.clear() lcd.clear()
lcd.drawFilledRectangle(0, 0, LCD_W, LCD_H, TEXT_BGCOLOR)
drawScreenTitle("S6R", page, #pages) drawScreenTitle("S6R", page, #pages)
if(calibrationStep < 6) then if(calibrationStep < 6) then
local position = calibrationPositions[1 + calibrationStep] local position = calibrationPositions[1 + calibrationStep]

View file

@ -39,21 +39,29 @@ static int luaLcdRefresh(lua_State *L)
} }
/*luadoc /*luadoc
@function lcd.clear() @function lcd.clear([color])
Clear the LCD screen Clear the LCD screen
@param color (optionnal, only on color screens)
@status current Introduced in 2.0.0 @status current Introduced in 2.0.0
@notice This function only works in stand-alone and telemetry scripts. @notice This function only works in stand-alone and telemetry scripts.
*/ */
static int luaLcdClear(lua_State *L) static int luaLcdClear(lua_State *L)
{ {
if (luaLcdAllowed) lcdClear(); if (luaLcdAllowed) {
#if defined(COLORLCD)
LcdFlags color = luaL_optunsigned(L, 1, TEXT_BGCOLOR);
lcd->clear(color);
#else
lcdClear();
#endif
}
return 0; return 0;
} }
/*luadoc /*luadoc
@function lcd.drawPoint(x, y) @function lcd.drawPoint(x, y)