From 6ee203157bd51b57efff44153399721b8c32be81 Mon Sep 17 00:00:00 2001 From: Hans Christian Olaussen <41271048+klutvott123@users.noreply.github.com> Date: Tue, 28 Dec 2021 22:33:25 +0100 Subject: [PATCH] Clear LCD for CMS script at startup Clears the LCD and draws the "refresh[whateverbuttonrefreshis]" at the top row when the script is launched. The current behaviour is to not clear the screen when the script is launched. If it's not responding and a manual refresh is required, there's no way for the user to know this. By clearing the screen and showing the message, the user should get an idea of what has to be done. --- src/SCRIPTS/BF/CMS/common.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/SCRIPTS/BF/CMS/common.lua b/src/SCRIPTS/BF/CMS/common.lua index bfb1b11a..6c1f7033 100644 --- a/src/SCRIPTS/BF/CMS/common.lua +++ b/src/SCRIPTS/BF/CMS/common.lua @@ -49,7 +49,7 @@ screen = { end, draw = function() if (screen.buffer ~= nil and screen.config ~= nil and #screen.buffer > 0) then - lcd.clear() + screen.clear() for char = 1, #screen.buffer do if (screen.buffer[char] ~= 32) then -- skip spaces to avoid CPU spikes c = string.char(screen.buffer[char]) @@ -60,8 +60,11 @@ screen = { lcd.drawText(xPos, yPos, c, screen.config.textSize) end end - lcd.drawText(screen.config.refresh.left, screen.config.refresh.top, screen.config.refresh.text, screen.config.textSize) end + end, + clear = function() + lcd.clear() + lcd.drawText(screen.config.refresh.left, screen.config.refresh.top, screen.config.refresh.text, screen.config.textSize) end } @@ -70,6 +73,7 @@ cms = { init = function(cmsConfig) screen.config = assert(cmsConfig, "Resolution not supported") screen.reset() + screen.clear() protocol.cms.close() cms.menuOpen = false end,