From 1910af51b6eb91326470c231ab4b9665e1a948d6 Mon Sep 17 00:00:00 2001 From: 3djc Date: Sun, 26 Feb 2017 11:46:23 +0100 Subject: [PATCH] Make lcd.clear() color aware on color screens (#4504) * Make lcd.clear() color aware on color screens * Compilation fix --- radio/sdcard/horus/S6R/S6R.lua | 2 -- radio/src/lua/api_lcd.cpp | 14 +++++++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/radio/sdcard/horus/S6R/S6R.lua b/radio/sdcard/horus/S6R/S6R.lua index 45abd6a84..16d2a4d35 100755 --- a/radio/sdcard/horus/S6R/S6R.lua +++ b/radio/sdcard/horus/S6R/S6R.lua @@ -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] diff --git a/radio/src/lua/api_lcd.cpp b/radio/src/lua/api_lcd.cpp index 30cd56193..8fb1b177c 100644 --- a/radio/src/lua/api_lcd.cpp +++ b/radio/src/lua/api_lcd.cpp @@ -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)