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)
|
if(LUA)
|
||||||
add_gui_src(standalone_lua.cpp)
|
add_gui_src(standalone_lua.cpp)
|
||||||
|
set(SRC ${SRC} lua/widgets.cpp)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(LUA STREQUAL YES)
|
||||||
add_gui_src(model_mixer_scripts.cpp)
|
add_gui_src(model_mixer_scripts.cpp)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -102,10 +106,6 @@ if(GHOST)
|
|||||||
add_gui_src(radio_ghost_module_config.cpp)
|
add_gui_src(radio_ghost_module_config.cpp)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(LUA STREQUAL YES)
|
|
||||||
set(SRC ${SRC} lua/widgets.cpp)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(SRC ${SRC} storage/modelslist.cpp)
|
set(SRC ${SRC} storage/modelslist.cpp)
|
||||||
|
|
||||||
option(WINDOWS_INSPECT_BORDERS "Draw bounding boxes around windows" OFF)
|
option(WINDOWS_INSPECT_BORDERS "Draw bounding boxes around windows" OFF)
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ ModelMenu::ModelMenu():
|
|||||||
addTab(new ModelGVarsPage());
|
addTab(new ModelGVarsPage());
|
||||||
addTab(new ModelLogicalSwitchesPage());
|
addTab(new ModelLogicalSwitchesPage());
|
||||||
addTab(new SpecialFunctionsPage(g_model.customFn));
|
addTab(new SpecialFunctionsPage(g_model.customFn));
|
||||||
#if defined(LUA) && defined(LUA_MODEL_SCRIPTS)
|
#if defined(LUA_MODEL_SCRIPTS)
|
||||||
addTab(new ModelMixerScriptsPage());
|
addTab(new ModelMixerScriptsPage());
|
||||||
#endif
|
#endif
|
||||||
addTab(new ModelTelemetryPage());
|
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.
|
// 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...
|
// 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();
|
window->setFocus();
|
||||||
|
|
||||||
FIL file;
|
FIL file;
|
||||||
@@ -194,7 +194,7 @@ void ViewTextWindow::buildBody(Window *window)
|
|||||||
|
|
||||||
// assume average characte is 10 pixels wide, round the string length to tens.
|
// 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...
|
// 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);
|
maxScreenLines = window->height() / (PAGE_LINE_HEIGHT + PAGE_LINE_SPACING);
|
||||||
window->setFocus();
|
window->setFocus();
|
||||||
readLinesCount = 0;
|
readLinesCount = 0;
|
||||||
|
|||||||
@@ -1499,11 +1499,12 @@ void opentxClose(uint8_t shutdown)
|
|||||||
|
|
||||||
//TODO: In fact we want only to empty the trash (private method)
|
//TODO: In fact we want only to empty the trash (private method)
|
||||||
MainWindow::instance()->run();
|
MainWindow::instance()->run();
|
||||||
|
#if defined(LUA)
|
||||||
luaUnregisterWidgets();
|
luaUnregisterWidgets();
|
||||||
luaClose(&lsWidgets);
|
luaClose(&lsWidgets);
|
||||||
lsWidgets = 0;
|
lsWidgets = 0;
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(SDCARD)
|
#if defined(SDCARD)
|
||||||
sdDone();
|
sdDone();
|
||||||
@@ -1516,7 +1517,7 @@ void opentxResume()
|
|||||||
TRACE("opentxResume");
|
TRACE("opentxResume");
|
||||||
|
|
||||||
sdMount();
|
sdMount();
|
||||||
#if defined(COLORLCD)
|
#if defined(COLORLCD) && defined(LUA)
|
||||||
// reload widgets
|
// reload widgets
|
||||||
luaInitThemesAndWidgets();
|
luaInitThemesAndWidgets();
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user