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
-2
View File
@@ -108,7 +108,6 @@ end
-- Redraw the current page
local function redrawFieldsPage(event)
lcd.clear()
lcd.drawFilledRectangle(0, 0, LCD_W, LCD_H, TEXT_BGCOLOR)
drawScreenTitle("S6R", page, #pages)
if refreshIndex < #fields then
@@ -276,7 +275,6 @@ local function runCalibrationPage(event)
refreshIndex = 0
end
lcd.clear()
lcd.drawFilledRectangle(0, 0, LCD_W, LCD_H, TEXT_BGCOLOR)
drawScreenTitle("S6R", page, #pages)
if(calibrationStep < 6) then
local position = calibrationPositions[1 + calibrationStep]
+11 -3
View File
@@ -39,21 +39,29 @@ static int luaLcdRefresh(lua_State *L)
}
/*luadoc
@function lcd.clear()
@function lcd.clear([color])
Clear the LCD screen
@param color (optionnal, only on color screens)
@status current Introduced in 2.0.0
@notice This function only works in stand-alone and telemetry scripts.
*/
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;
}
/*luadoc
@function lcd.drawPoint(x, y)