Fix LUA=NO, remove ModelMixerScriptsPage when support not enabled (#869)
* Trying to align LUA options with radio/src/CMakeLists.txt -DLUA=NO: no Lua of any kind -DLUA=ON: everything but mixer scripts -DLUA=YES: also mixer scripts * Color LCD with -DLUA=NO is probably a rare combination, so it needed a little help with #defines. * Some strange error using floor function w/o <math> - probably because -DLUA=NO is not normally used w/ color.
This commit is contained in:
@@ -79,6 +79,10 @@ endmacro(add_gui_src)
|
||||
|
||||
if(LUA)
|
||||
add_gui_src(standalone_lua.cpp)
|
||||
set(SRC ${SRC} lua/widgets.cpp)
|
||||
endif()
|
||||
|
||||
if(LUA STREQUAL YES)
|
||||
add_gui_src(model_mixer_scripts.cpp)
|
||||
endif()
|
||||
|
||||
@@ -102,10 +106,6 @@ if(GHOST)
|
||||
add_gui_src(radio_ghost_module_config.cpp)
|
||||
endif()
|
||||
|
||||
if(LUA STREQUAL YES)
|
||||
set(SRC ${SRC} lua/widgets.cpp)
|
||||
endif()
|
||||
|
||||
set(SRC ${SRC} storage/modelslist.cpp)
|
||||
|
||||
option(WINDOWS_INSPECT_BORDERS "Draw bounding boxes around windows" OFF)
|
||||
|
||||
@@ -49,7 +49,7 @@ ModelMenu::ModelMenu():
|
||||
addTab(new ModelGVarsPage());
|
||||
addTab(new ModelLogicalSwitchesPage());
|
||||
addTab(new SpecialFunctionsPage(g_model.customFn));
|
||||
#if defined(LUA) && defined(LUA_MODEL_SCRIPTS)
|
||||
#if defined(LUA_MODEL_SCRIPTS)
|
||||
addTab(new ModelMixerScriptsPage());
|
||||
#endif
|
||||
addTab(new ModelTelemetryPage());
|
||||
|
||||
@@ -63,7 +63,7 @@ void ViewTextWindow::buildBody(Window *window)
|
||||
|
||||
// assume average characte is 10 pixels wide, round the string length to tens.
|
||||
// Font is not fixed width, so this is for the worst case...
|
||||
const int maxLineLength = int(floor(window->width() / 10 / 10)) * 10 - 2;
|
||||
const int maxLineLength = static_cast<int>(window->width() / 10 / 10) * 10 - 2;
|
||||
window->setFocus();
|
||||
|
||||
FIL file;
|
||||
@@ -194,7 +194,7 @@ void ViewTextWindow::buildBody(Window *window)
|
||||
|
||||
// assume average characte is 10 pixels wide, round the string length to tens.
|
||||
// Font is not fixed width, so this is for the worst case...
|
||||
maxLineLength = int(floor(window->width() / 10 / 10)) * 10 - 2;
|
||||
maxLineLength = static_cast<int>(window->width() / 10 / 10) * 10 - 2;
|
||||
maxScreenLines = window->height() / (PAGE_LINE_HEIGHT + PAGE_LINE_SPACING);
|
||||
window->setFocus();
|
||||
readLinesCount = 0;
|
||||
|
||||
@@ -1499,11 +1499,12 @@ void opentxClose(uint8_t shutdown)
|
||||
|
||||
//TODO: In fact we want only to empty the trash (private method)
|
||||
MainWindow::instance()->run();
|
||||
|
||||
#if defined(LUA)
|
||||
luaUnregisterWidgets();
|
||||
luaClose(&lsWidgets);
|
||||
lsWidgets = 0;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(SDCARD)
|
||||
sdDone();
|
||||
@@ -1516,7 +1517,7 @@ void opentxResume()
|
||||
TRACE("opentxResume");
|
||||
|
||||
sdMount();
|
||||
#if defined(COLORLCD)
|
||||
#if defined(COLORLCD) && defined(LUA)
|
||||
// reload widgets
|
||||
luaInitThemesAndWidgets();
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user