diff --git a/companion/src/simulation/simulateduiwidgetTX12.cpp b/companion/src/simulation/simulateduiwidgetTX12.cpp index 8e7c518f0..1f3e34774 100644 --- a/companion/src/simulation/simulateduiwidgetTX12.cpp +++ b/companion/src/simulation/simulateduiwidgetTX12.cpp @@ -34,8 +34,8 @@ SimulatedUIWidgetTX12::SimulatedUIWidgetTX12(SimulatorInterface *simulator, QWid act = new RadioUiAction(0, QList() << Qt::Key_Down << Qt::Key_Delete << Qt::Key_Escape << Qt::Key_Backspace, SIMU_STR_HLP_KEYS_EXIT, SIMU_STR_HLP_ACT_EXIT); addRadioWidget(ui->leftbuttons->addArea(QRect(70, 85, 80, 35), "TX12/left-rtn.png", act)); - m_scrollUpAction = new RadioUiAction(-1, QList() << Qt::Key_Minus << Qt::Key_Equal << Qt::Key_Left, SIMU_STR_HLP_KEYS_GO_LFT, SIMU_STR_HLP_ACT_ROT_LFT); - m_scrollDnAction = new RadioUiAction(-1, QList() << Qt::Key_Plus << Qt::Key_Right, SIMU_STR_HLP_KEYS_GO_RGT, SIMU_STR_HLP_ACT_ROT_RGT); + m_scrollUpAction = new RadioUiAction(-1, QList() << Qt::Key_Minus << Qt::Key_Left, SIMU_STR_HLP_KEYS_GO_LFT, SIMU_STR_HLP_ACT_ROT_LFT); + m_scrollDnAction = new RadioUiAction(-1, QList() << Qt::Key_Plus << Qt::Key_Equal, SIMU_STR_HLP_KEYS_GO_RGT, SIMU_STR_HLP_ACT_ROT_RGT); connectScrollActions(); m_backlightColors << QColor(215, 243, 255); // X7 Blue diff --git a/radio/src/gui/colorlcd/radio_sdmanager.cpp b/radio/src/gui/colorlcd/radio_sdmanager.cpp index e2000328d..e7ea62289 100644 --- a/radio/src/gui/colorlcd/radio_sdmanager.cpp +++ b/radio/src/gui/colorlcd/radio_sdmanager.cpp @@ -334,8 +334,8 @@ void RadioSdManagerPage::build(FormWindow * window) std::string fullpath = currentPath + "/" + name; menu->addLine(STR_EXECUTE_FILE, [=]() { luaExec(fullpath.c_str()); - //TODO: check 'luaState' - StandaloneLuaWindow::instance()->attach(window); + if (luaState != INTERPRETER_RELOAD_PERMANENT_SCRIPTS) + StandaloneLuaWindow::instance()->attach(window); }); } #endif diff --git a/radio/src/gui/colorlcd/radio_tools.cpp b/radio/src/gui/colorlcd/radio_tools.cpp index 093aa462b..85d103fc7 100644 --- a/radio/src/gui/colorlcd/radio_tools.cpp +++ b/radio/src/gui/colorlcd/radio_tools.cpp @@ -126,8 +126,10 @@ void RadioToolsPage::rebuild(FormWindow * window) *((char *)getBasename(toolPath)-1) = '\0'; f_chdir(toolPath); - StandaloneLuaWindow::instance()->attach(window); luaExec(path_str.c_str()); + if (luaState != INTERPRETER_RELOAD_PERMANENT_SCRIPTS) + StandaloneLuaWindow::instance()->attach(window); + return 0; }, OPAQUE); diff --git a/radio/src/lua/interface.cpp b/radio/src/lua/interface.cpp index 636ecbaf5..b7a6d4dba 100644 --- a/radio/src/lua/interface.cpp +++ b/radio/src/lua/interface.cpp @@ -891,6 +891,7 @@ static void luaLoadScripts(bool init, const char * filename = nullptr) if (sid.run == LUA_NOREF) { TRACE_ERROR("luaLoadScripts(%s): No run function\n", getScriptName(idx)); sid.state = SCRIPT_SYNTAX_ERROR; + initFunction = LUA_NOREF; } #if defined(LUA_MODEL_SCRIPTS) // Get input/output tables for mixer scripts @@ -908,6 +909,7 @@ static void luaLoadScripts(bool init, const char * filename = nullptr) else { TRACE_ERROR("luaLoadScripts(%s): The script did not return a table\n", getScriptName(idx)); sid.state = SCRIPT_SYNTAX_ERROR; + initFunction = LUA_NOREF; } // Pop the table off the stack @@ -929,11 +931,7 @@ static void luaLoadScripts(bool init, const char * filename = nullptr) else TRACE_ERROR("luaLoadScripts(%s): %s\n", getScriptName(idx), lua_tostring(lsScripts, -1)); - if (ref == SCRIPT_STANDALONE) { - luaState = INTERPRETER_RELOAD_PERMANENT_SCRIPTS; - luaError(lsScripts, sid.state, true); - return; - } + initFunction = LUA_NOREF; // Replace the dead coroutine with a new one lua_pop(L, 1); // Pop the dead coroutine off the main stack @@ -944,6 +942,12 @@ static void luaLoadScripts(bool init, const char * filename = nullptr) } while(initFunction != LUA_NOREF); + if (ref == SCRIPT_STANDALONE && sid.state != SCRIPT_OK) { + luaState = INTERPRETER_RELOAD_PERMANENT_SCRIPTS; + luaError(lsScripts, sid.state, true); + return; + } + } while(++ref < SCRIPT_STANDALONE); // Loading has finished - start running scripts @@ -981,7 +985,7 @@ static bool resumeLua(bool init, bool allowLcdUsage) luaLcdAllowed = allowLcdUsage; } - do { + for (; idx < luaScriptsCount; idx++) { ScriptInternalData & sid = scriptInternalData[idx]; if (sid.state != SCRIPT_OK) continue; @@ -1155,7 +1159,7 @@ static bool resumeLua(bool init, bool allowLcdUsage) } else luaFree(lsScripts, sid); } - } while (++idx < luaScriptsCount); + } // for // Toggle between background and foreground scripts luaLcdAllowed = !luaLcdAllowed;