Clear active model internal module settings if radio level setting changed (#1316)

* [colorlcd] Ensure active internalModule is reset if different to radio level setting

* [B&W] Ensure active internalModule is reset if different to radio level setting

* storageDirty only when model setting cleared

* [b&w] Remove reusablebuffer, code re-order

* [colorlcd] More direct moduleType comparision
Consistent with B&W test
This commit is contained in:
Peter Feerick
2022-01-03 20:55:49 +10:00
committed by GitHub
parent d1f56d6dfe
commit 351643b652
2 changed files with 19 additions and 6 deletions
+11 -4
View File
@@ -330,10 +330,17 @@ void RadioHardwarePage::build(FormWindow * window)
#if defined(HARDWARE_INTERNAL_MODULE)
new StaticText(window, grid.getLabelSlot(), TR_INTERNAL_MODULE, 0,
COLOR_THEME_PRIMARY1);
auto internalModule =
new Choice(window, grid.getFieldSlot(1, 0), STR_INTERNAL_MODULE_PROTOCOLS,
MODULE_TYPE_NONE, MODULE_TYPE_COUNT - 1,
GET_SET_DEFAULT(g_eeGeneral.internalModule));
auto internalModule = new Choice(window, grid.getFieldSlot(1, 0),
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) {
memclear(&g_model.moduleData[INTERNAL_MODULE], sizeof(ModuleData));
storageDirty(EE_MODEL);
}
g_eeGeneral.internalModule = moduleType;
SET_DIRTY();
});
internalModule->setAvailableHandler([](int module){
return isInternalModuleSupported(module);
@@ -528,13 +528,19 @@ void menuRadioHardware(event_t event)
#endif
#if !defined(PCBX9D) && !defined(PCBX9DP) && !defined(PCBX9E)
case ITEM_RADIO_HARDWARE_INTERNAL_MODULE:
case ITEM_RADIO_HARDWARE_INTERNAL_MODULE: {
g_eeGeneral.internalModule =
editChoice(HW_SETTINGS_COLUMN2, y, STR_INTERNAL_MODULE,
STR_INTERNAL_MODULE_PROTOCOLS,
g_eeGeneral.internalModule, MODULE_TYPE_NONE,
MODULE_TYPE_MAX, attr, event, isInternalModuleSupported);
break;
if (g_model.moduleData[INTERNAL_MODULE].type !=
g_eeGeneral.internalModule) {
memclear(&g_model.moduleData[INTERNAL_MODULE], sizeof(ModuleData));
storageDirty(EE_MODEL);
storageDirty(EE_GENERAL);
}
} break;
#endif
#if (defined(CROSSFIRE) || defined(GHOST))