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`
This commit is contained in:
Peter Feerick
2022-03-31 11:52:17 +10:00
committed by GitHub
parent ed7be53565
commit 7b617c1b50
3 changed files with 17 additions and 10 deletions
+1 -1
View File
@@ -28,7 +28,7 @@
#include <ctype.h> #include <ctype.h>
#include <malloc.h> #include <malloc.h>
#include <new> #include <new>
#include <stdarg.h>
#include "cli.h" #include "cli.h"
#if defined(INTMODULE_USART) #if defined(INTMODULE_USART)
+9
View File
@@ -165,12 +165,14 @@ class SelectTemplate : public TemplatePage
// Dismiss template pages // Dismiss template pages
deleteLater(); deleteLater();
templateFolderPage->deleteLater(); templateFolderPage->deleteLater();
#if defined(LUA)
// If there is a wizard Lua script, fire it up // If there is a wizard Lua script, fire it up
snprintf(buffer, LEN_BUFFER, "%s%c%s%s", path, '/', name.c_str(), SCRIPT_EXT); snprintf(buffer, LEN_BUFFER, "%s%c%s%s", path, '/', name.c_str(), SCRIPT_EXT);
if (f_stat(buffer, 0) == FR_OK) { if (f_stat(buffer, 0) == FR_OK) {
luaExec(buffer); luaExec(buffer);
StandaloneLuaWindow::instance()->attach(focusWindow); StandaloneLuaWindow::instance()->attach(focusWindow);
} }
#endif
return 0; return 0;
}); });
tb->setFocusHandler([=](bool active) { tb->setFocusHandler([=](bool active) {
@@ -269,6 +271,10 @@ class SelectTemplateFolder : public TemplatePage
directories.sort(compare_nocase); directories.sort(compare_nocase);
for (auto name: directories) { 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, auto tfb = new TemplateButton(&body, grid.getLabelSlot(), name,
[=]() -> uint8_t { [=]() -> uint8_t {
snprintf(path, LEN_PATH, "%s%c%s", TEMPLATES_PATH, '/', name.c_str()); 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); grid.spacer(tfb->height() + 5);
} }
body.setInnerHeight(grid.getWindowHeight()); body.setInnerHeight(grid.getWindowHeight());
#if not defined(LUA)
}
#endif
} }
f_closedir(&dir); f_closedir(&dir);
+7 -9
View File
@@ -265,9 +265,9 @@ class InternalModuleWindow : public FormGroup {
#endif #endif
clear(); clear();
new StaticText(this, grid.getLabelSlot(), TR_INTERNAL_MODULE, 0, new StaticText(this, grid.getLabelSlot(true), TR_INTERNAL_MODULE, 0,
COLOR_THEME_PRIMARY1); 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), GET_DEFAULT(g_eeGeneral.internalModule),
[=](int moduleType) { [=](int moduleType) {
if (g_model.moduleData[INTERNAL_MODULE].type != moduleType) { if (g_model.moduleData[INTERNAL_MODULE].type != moduleType) {
@@ -281,12 +281,12 @@ class InternalModuleWindow : public FormGroup {
internalModule->setAvailableHandler([](int module){ internalModule->setAvailableHandler([](int module){
return isInternalModuleSupported(module); return isInternalModuleSupported(module);
}); });
grid.nextLine();
#if defined(CROSSFIRE) #if defined(CROSSFIRE)
if (isInternalModuleCrossfire()) { if (isInternalModuleCrossfire()) {
grid.nextLine(); new StaticText(this, grid.getLabelSlot(true), STR_BAUDRATE, 0,COLOR_THEME_PRIMARY1);
new StaticText(this, grid.getLabelSlot(), STR_BAUDRATE, 0,COLOR_THEME_PRIMARY1); new Choice(this, grid.getFieldSlot(), STR_CRSF_BAUDRATE, 0,CROSSFIRE_MAX_INTERNAL_BAUDRATE,
new Choice(this, grid.getFieldSlot(1, 0), STR_CRSF_BAUDRATE, 0,CROSSFIRE_MAX_INTERNAL_BAUDRATE,
[=]() -> int { [=]() -> int {
return CROSSFIRE_STORE_TO_INDEX(g_eeGeneral.internalModuleBaudrate); return CROSSFIRE_STORE_TO_INDEX(g_eeGeneral.internalModuleBaudrate);
}, },
@@ -297,10 +297,8 @@ class InternalModuleWindow : public FormGroup {
}); });
grid.nextLine(); grid.nextLine();
} }
auto par = getParent();
par->moveWindowsTop(top() + 1, adjustHeight());
par->adjustInnerHeight();
#endif #endif
getParent()->moveWindowsTop(top() + 1, adjustHeight());
} }
void checkEvents() override void checkEvents() override
@@ -481,7 +479,7 @@ void RadioHardwarePage::build(FormWindow * window)
// extra bottom padding if touchscreen // extra bottom padding if touchscreen
#if defined HARDWARE_TOUCH #if defined HARDWARE_TOUCH
grid.nextLine(); new StaticText(window, grid.getLabelSlot());
#endif #endif
window->setInnerHeight(grid.getWindowHeight()); window->setInnerHeight(grid.getWindowHeight());