From 7b617c1b502f46ee1cdf44c4da8fab4e98561668 Mon Sep 17 00:00:00 2001 From: Peter Feerick Date: Thu, 31 Mar 2022 11:52:17 +1000 Subject: [PATCH] fix: `LUA=N` compile fixes, radio hardware tab bottom padding (for touch) (#1755) * Fix `LUA=N` compile breakage and tidyup on NV14 * Alignment and padding Resolves #1751 but incomplete solution, as the real cuplrit appears to somehow be in `InternalModuleWindow` --- radio/src/cli.cpp | 2 +- radio/src/gui/colorlcd/model_select.cpp | 9 +++++++++ radio/src/gui/colorlcd/radio_hardware.cpp | 16 +++++++--------- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/radio/src/cli.cpp b/radio/src/cli.cpp index 2824c5ed3..1d2f7c445 100644 --- a/radio/src/cli.cpp +++ b/radio/src/cli.cpp @@ -28,7 +28,7 @@ #include #include #include - +#include #include "cli.h" #if defined(INTMODULE_USART) diff --git a/radio/src/gui/colorlcd/model_select.cpp b/radio/src/gui/colorlcd/model_select.cpp index 80cd739e9..43cb86f86 100644 --- a/radio/src/gui/colorlcd/model_select.cpp +++ b/radio/src/gui/colorlcd/model_select.cpp @@ -165,12 +165,14 @@ class SelectTemplate : public TemplatePage // Dismiss template pages deleteLater(); templateFolderPage->deleteLater(); +#if defined(LUA) // If there is a wizard Lua script, fire it up snprintf(buffer, LEN_BUFFER, "%s%c%s%s", path, '/', name.c_str(), SCRIPT_EXT); if (f_stat(buffer, 0) == FR_OK) { luaExec(buffer); StandaloneLuaWindow::instance()->attach(focusWindow); } +#endif return 0; }); tb->setFocusHandler([=](bool active) { @@ -269,6 +271,10 @@ class SelectTemplateFolder : public TemplatePage directories.sort(compare_nocase); for (auto name: directories) { +#if not defined(LUA) + // Don't show wizards dir if no lua + if (!strcasecmp(name.c_str(), "WIZARD") == 0) { +#endif auto tfb = new TemplateButton(&body, grid.getLabelSlot(), name, [=]() -> uint8_t { snprintf(path, LEN_PATH, "%s%c%s", TEMPLATES_PATH, '/', name.c_str()); @@ -285,6 +291,9 @@ class SelectTemplateFolder : public TemplatePage grid.spacer(tfb->height() + 5); } body.setInnerHeight(grid.getWindowHeight()); +#if not defined(LUA) + } +#endif } f_closedir(&dir); diff --git a/radio/src/gui/colorlcd/radio_hardware.cpp b/radio/src/gui/colorlcd/radio_hardware.cpp index 36412e4bd..ab03c8b7a 100644 --- a/radio/src/gui/colorlcd/radio_hardware.cpp +++ b/radio/src/gui/colorlcd/radio_hardware.cpp @@ -265,9 +265,9 @@ class InternalModuleWindow : public FormGroup { #endif clear(); - new StaticText(this, grid.getLabelSlot(), TR_INTERNAL_MODULE, 0, + new StaticText(this, grid.getLabelSlot(true), TR_INTERNAL_MODULE, 0, COLOR_THEME_PRIMARY1); - auto internalModule = new Choice(this, grid.getFieldSlot(1, 0),STR_INTERNAL_MODULE_PROTOCOLS, MODULE_TYPE_NONE, MODULE_TYPE_COUNT - 1, + auto internalModule = new Choice(this, grid.getFieldSlot(),STR_INTERNAL_MODULE_PROTOCOLS, MODULE_TYPE_NONE, MODULE_TYPE_COUNT - 1, GET_DEFAULT(g_eeGeneral.internalModule), [=](int moduleType) { if (g_model.moduleData[INTERNAL_MODULE].type != moduleType) { @@ -281,12 +281,12 @@ class InternalModuleWindow : public FormGroup { internalModule->setAvailableHandler([](int module){ return isInternalModuleSupported(module); }); + grid.nextLine(); #if defined(CROSSFIRE) if (isInternalModuleCrossfire()) { - grid.nextLine(); - new StaticText(this, grid.getLabelSlot(), STR_BAUDRATE, 0,COLOR_THEME_PRIMARY1); - new Choice(this, grid.getFieldSlot(1, 0), STR_CRSF_BAUDRATE, 0,CROSSFIRE_MAX_INTERNAL_BAUDRATE, + new StaticText(this, grid.getLabelSlot(true), STR_BAUDRATE, 0,COLOR_THEME_PRIMARY1); + new Choice(this, grid.getFieldSlot(), STR_CRSF_BAUDRATE, 0,CROSSFIRE_MAX_INTERNAL_BAUDRATE, [=]() -> int { return CROSSFIRE_STORE_TO_INDEX(g_eeGeneral.internalModuleBaudrate); }, @@ -297,10 +297,8 @@ class InternalModuleWindow : public FormGroup { }); grid.nextLine(); } - auto par = getParent(); - par->moveWindowsTop(top() + 1, adjustHeight()); - par->adjustInnerHeight(); #endif + getParent()->moveWindowsTop(top() + 1, adjustHeight()); } void checkEvents() override @@ -481,7 +479,7 @@ void RadioHardwarePage::build(FormWindow * window) // extra bottom padding if touchscreen #if defined HARDWARE_TOUCH - grid.nextLine(); + new StaticText(window, grid.getLabelSlot()); #endif window->setInnerHeight(grid.getWindowHeight());