Skip to content

Commit

Permalink
Clear LCD for CMS script at startup
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
klutvott123 committed Dec 28, 2021
1 parent f6f3e89 commit 6ee2031
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/SCRIPTS/BF/CMS/common.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand All @@ -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
}

Expand All @@ -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,
Expand Down

0 comments on commit 6ee2031

Please sign in to comment.