From 5fb12915e5fe8d7bd6816f5ec147f44c57bbfa7c Mon Sep 17 00:00:00 2001 From: bsongis Date: Mon, 13 Jul 2015 14:13:49 +0200 Subject: [PATCH] Fixes #2463 - Code review needed, thanks! --- radio/src/main_arm.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/radio/src/main_arm.cpp b/radio/src/main_arm.cpp index 2792c325c..bfff0b24f 100644 --- a/radio/src/main_arm.cpp +++ b/radio/src/main_arm.cpp @@ -139,24 +139,31 @@ void perMain() lcdRefreshWait(); // draw LCD from menus or from Lua script - // run Lua scripts that use LCD - bool scriptWasRun = luaTask(evt, RUN_TELEM_FG_SCRIPT | RUN_STNDAL_SCRIPT, true); + // run Lua scripts that use LCD + + bool standaloneScriptWasRun = luaTask(evt, RUN_STNDAL_SCRIPT, true); + bool refreshScreen = true; + if (!standaloneScriptWasRun) { + refreshScreen = !luaTask(evt, RUN_TELEM_FG_SCRIPT, true); + } t0 = get_tmr10ms() - t0; if (t0 > maxLuaDuration) { maxLuaDuration = t0; } - if (!scriptWasRun) - { + if (!standaloneScriptWasRun) #else lcdRefreshWait(); // WARNING: make sure no code above this line does any change to the LCD display buffer! - { + const bool refreshScreen = true; #endif + { // normal GUI from menus const char *warn = s_warning; uint8_t menu = s_menu_count; - lcd_clear(); + if (refreshScreen) { + lcd_clear(); + } if (menuEvent) { m_posVert = menuEvent == EVT_ENTRY_UP ? g_menuPos[g_menuStackPtr] : 0; m_posHorz = 0;