From 499819191021085f48b17766eec8fb9da2a5680b Mon Sep 17 00:00:00 2001 From: 3djc Date: Tue, 18 Jun 2019 16:58:06 +0200 Subject: [PATCH] Fix X9E switches ((some cannot be configured or read) --- radio/src/gui/212x64/radio_hardware.cpp | 3 +-- radio/src/myeeprom.h | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/radio/src/gui/212x64/radio_hardware.cpp b/radio/src/gui/212x64/radio_hardware.cpp index a24c7df9c..6a92a126b 100644 --- a/radio/src/gui/212x64/radio_hardware.cpp +++ b/radio/src/gui/212x64/radio_hardware.cpp @@ -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(g_eeGeneral.switchConfig, config, 2*index, 2); } break; } diff --git a/radio/src/myeeprom.h b/radio/src/myeeprom.h index 200e66e63..977cc58c9 100644 --- a/radio/src/myeeprom.h +++ b/radio/src/myeeprom.h @@ -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(g_eeGeneral.switchConfig, 2*(x), 2)) + #define SWITCH_CONFIG(x) (bfGet(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)