Fix X9E switches ((some cannot be configured or read)

This commit is contained in:
3djc
2019-06-18 16:58:06 +02:00
parent 0ec02f096c
commit 4998191910
2 changed files with 2 additions and 3 deletions
+1 -2
View File
@@ -204,8 +204,7 @@ void menuRadioHardware(event_t event)
lcdDrawMMM(HW_SETTINGS_COLUMN, y, menuHorizontalPosition == 0 ? attr : 0);
config = editChoice(HW_SETTINGS_COLUMN+5*FW, y, "", STR_SWTYPES, config, SWITCH_NONE, SWITCH_TYPE_MAX(index), menuHorizontalPosition == 1 ? attr : 0, event);
if (attr && checkIncDec_Ret) {
swconfig_t mask = (swconfig_t)0x03 << (2*index);
g_eeGeneral.switchConfig = (g_eeGeneral.switchConfig & ~mask) | ((swconfig_t(config) & 0x03) << (2*index));
g_eeGeneral.switchConfig = bfSet<swconfig_t >(g_eeGeneral.switchConfig, config, 2*index, 2);
}
break;
}
+1 -1
View File
@@ -80,7 +80,7 @@
#define MODEL_GVAR_MAX(idx) (CFN_GVAR_CST_MAX - g_model.gvars[idx].max)
#if defined(PCBTARANIS) || defined(PCBHORUS)
#define SWITCH_CONFIG(x) (bfGet<uint32_t>(g_eeGeneral.switchConfig, 2*(x), 2))
#define SWITCH_CONFIG(x) (bfGet<swconfig_t>(g_eeGeneral.switchConfig, 2*(x), 2))
#define SWITCH_EXISTS(x) (SWITCH_CONFIG(x) != SWITCH_NONE)
#define IS_CONFIG_3POS(x) (SWITCH_CONFIG(x) == SWITCH_3POS)
#define IS_CONFIG_TOGGLE(x) (SWITCH_CONFIG(x) == SWITCH_TOGGLE)