Fix module and trainer subform resizing and show NV14 RF module version (#800)

* Fixes #792
* Add RF module FW version
* Clean(er) implementation
* Whitespace changes cleanup
* Cleanup
* Trainer module fix

Co-authored-by: Peter Feerick <peter.feerick@gmail.com>
This commit is contained in:
eshifri
2021-09-25 11:42:52 +10:00
committed by GitHub
co-authored by Peter Feerick
parent 0574f04bde
commit a4af85ef37
2 changed files with 31 additions and 19 deletions
+24 -17
View File
@@ -669,12 +669,13 @@ class TrainerModuleWindow : public FormGroup
GET_SET_DEFAULT(g_model.trainerData.pulsePol)); GET_SET_DEFAULT(g_model.trainerData.pulsePol));
grid.nextLine(); grid.nextLine();
} }
#if defined(HARDWARE_TOUCH)
new StaticText(this, grid.getLabelSlot(true));
#endif
getParent()->moveWindowsTop(top() + 1, adjustHeight());
} }
#if defined(HARDWARE_TOUCH)
new StaticText(this, grid.getLabelSlot(true));
#endif
auto par = getParent();
par->moveWindowsTop(top() + 1, adjustHeight());
par->adjustInnerHeight();
} }
protected: protected:
@@ -789,18 +790,22 @@ class ModuleWindow : public FormGroup {
clear(); clear();
// Module Type // Module Type
new StaticText(this, grid.getLabelSlot(true), STR_MODE, 0, COLOR_THEME_PRIMARY1); new StaticText(this, grid.getLabelSlot(true), STR_MODE, 0,
moduleChoice = new Choice(this, grid.getFieldSlot(2, 0), STR_INTERNAL_MODULE_PROTOCOLS, COLOR_THEME_PRIMARY1);
MODULE_TYPE_NONE, MODULE_TYPE_COUNT - 1, moduleChoice = new Choice(
GET_DEFAULT(g_model.moduleData[moduleIdx].type), this, grid.getFieldSlot(2, 0), STR_INTERNAL_MODULE_PROTOCOLS,
[=](int32_t newValue) { MODULE_TYPE_NONE, MODULE_TYPE_COUNT - 1,
setModuleType(moduleIdx, newValue); GET_DEFAULT(g_model.moduleData[moduleIdx].type),
update(); [=](int32_t newValue) {
moduleChoice->setFocus(SET_FOCUS_DEFAULT); setModuleType(moduleIdx, newValue);
SET_DIRTY(); update();
}); moduleChoice->setFocus(SET_FOCUS_DEFAULT);
SET_DIRTY();
});
moduleChoice->setAvailableHandler([=](int8_t moduleType) { moduleChoice->setAvailableHandler([=](int8_t moduleType) {
return moduleIdx == INTERNAL_MODULE ? isInternalModuleAvailable(moduleType) : isExternalModuleAvailable(moduleType); return moduleIdx == INTERNAL_MODULE
? isInternalModuleAvailable(moduleType)
: isExternalModuleAvailable(moduleType);
}); });
// Module parameters // Module parameters
@@ -1392,7 +1397,9 @@ class ModuleWindow : public FormGroup {
grid.nextLine(); grid.nextLine();
} }
getParent()->moveWindowsTop(top() + 1, adjustHeight()); auto par = getParent();
par->moveWindowsTop(top() + 1, adjustHeight());
par->adjustInnerHeight();
} }
void checkEvents() override void checkEvents() override
+7 -2
View File
@@ -205,6 +205,7 @@ RadioVersionPage::RadioVersionPage():
{ {
} }
extern uint32_t NV14internalModuleFwVersion;
void RadioVersionPage::build(FormWindow * window) void RadioVersionPage::build(FormWindow * window)
{ {
FormGridLayout grid; FormGridLayout grid;
@@ -236,8 +237,12 @@ void RadioVersionPage::build(FormWindow * window)
auto options = new OptionsText(window, grid.getFieldSlot(1,0)); auto options = new OptionsText(window, grid.getFieldSlot(1,0));
grid.nextLine(options->height() + 4); grid.nextLine(options->height() + 4);
//TODO: NV14 internal module version (NV14internalModuleFwVersion) #if defined(AFHDS2)
new StaticText(window, grid.getLabelSlot(), "RF FW:");
sprintf(reusableBuffer.moduleSetup.msg, "%d.%d.%d", (int)((NV14internalModuleFwVersion >> 16) & 0xFF), (int)((NV14internalModuleFwVersion >> 8) & 0xFF), (int)(NV14internalModuleFwVersion & 0xFF));
new StaticText(window, grid.getFieldSlot(), reusableBuffer.moduleSetup.msg);
grid.nextLine();
#endif
#if defined(PXX2) #if defined(PXX2)
// Module and receivers versions // Module and receivers versions
auto moduleVersions = new TextButton(window, grid.getLineSlot(), STR_MODULES_RX_VERSION); auto moduleVersions = new TextButton(window, grid.getLineSlot(), STR_MODULES_RX_VERSION);