diff --git a/radio/src/dataconstants.h b/radio/src/dataconstants.h index b5945c819..e09bb81eb 100644 --- a/radio/src/dataconstants.h +++ b/radio/src/dataconstants.h @@ -572,15 +572,19 @@ enum SwitchSources { SWSRC_SD0, SWSRC_SD1, SWSRC_SD2, +#if !defined(PCBX7D) SWSRC_SE0, SWSRC_SE1, SWSRC_SE2, +#endif SWSRC_SF0, SWSRC_SF1, SWSRC_SF2, +#if !defined(PCBX7D) SWSRC_SG0, SWSRC_SG1, SWSRC_SG2, +#endif SWSRC_SH0, SWSRC_SH1, SWSRC_SH2, diff --git a/radio/src/gui/128x64/model_logical_switches.cpp b/radio/src/gui/128x64/model_logical_switches.cpp index 27f275517..cfd82c05d 100644 --- a/radio/src/gui/128x64/model_logical_switches.cpp +++ b/radio/src/gui/128x64/model_logical_switches.cpp @@ -63,10 +63,13 @@ void menuModelLogicalSwitchOne(event_t event) TITLE(STR_MENULOGICALSWITCH); LogicalSwitchData * cs = lswAddress(s_currIdx); + uint8_t sw = SWSRC_SW1+s_currIdx; + uint8_t cstate = lswFamily(cs->func); + drawSwitch(14*FW, 0, sw, (getSwitch(sw) ? BOLD : 0)); - SUBMENU_NOTITLE(LS_FIELD_COUNT, { 0, 0, 1, 0 /*, 0...*/ }); + SUBMENU_NOTITLE(LS_FIELD_COUNT, { 0, 0, uint8_t(cstate == LS_FAMILY_EDGE ? 1 : 0), 0 /*, 0...*/ }); int8_t sub = menuVerticalPosition; @@ -78,7 +81,6 @@ void menuModelLogicalSwitchOne(event_t event) coord_t y = MENU_HEADER_HEIGHT + 1 + k*FH; uint8_t i = k + menuVerticalOffset; uint8_t attr = (sub==i ? (s_editMode>0 ? BLINK|INVERS : INVERS) : 0); - uint8_t cstate = lswFamily(cs->func); switch (i) { case LS_FIELD_FUNCTION: @@ -108,6 +110,8 @@ void menuModelLogicalSwitchOne(event_t event) if (cstate == LS_FAMILY_BOOL || cstate == LS_FAMILY_STICKY || cstate == LS_FAMILY_EDGE) { drawSwitch(CSWONE_2ND_COLUMN, y, v1_val, attr); v1_min = SWSRC_OFF+1; v1_max = SWSRC_ON-1; + INCDEC_SET_FLAG(EE_MODEL | INCDEC_SWITCH); + INCDEC_ENABLE_CHECK(isSwitchAvailableInLogicalSwitches); } else if (cstate == LS_FAMILY_TIMER) { lcdDrawNumber(CSWONE_2ND_COLUMN, y, lswTimerValue(cs->v1), LEFT|PREC1|attr); @@ -133,6 +137,8 @@ void menuModelLogicalSwitchOne(event_t event) if (cstate == LS_FAMILY_BOOL || cstate == LS_FAMILY_STICKY) { drawSwitch(CSWONE_2ND_COLUMN, y, cs->v2, attr); v2_min = SWSRC_OFF+1; v2_max = SWSRC_ON-1; + INCDEC_SET_FLAG(EE_MODEL | INCDEC_SWITCH); + INCDEC_ENABLE_CHECK(isSwitchAvailableInLogicalSwitches); } else if (cstate == LS_FAMILY_TIMER) { lcdDrawNumber(CSWONE_2ND_COLUMN, y, lswTimerValue(cs->v2), LEFT|PREC1|attr); @@ -183,7 +189,7 @@ void menuModelLogicalSwitchOne(event_t event) } if (attr) { - CHECK_INCDEC_MODELVAR(event, cs->v2, v2_min, v2_max); + cs->v2 = CHECK_INCDEC_PARAM(event, cs->v2, v2_min, v2_max); } break; } @@ -191,7 +197,7 @@ void menuModelLogicalSwitchOne(event_t event) case LS_FIELD_ANDSW: lcdDrawTextAlignedLeft(y, STR_AND_SWITCH); drawSwitch(CSWONE_2ND_COLUMN, y, cs->andsw, attr); - if (attr) CHECK_INCDEC_MODELVAR(event, cs->andsw, -MAX_LS_ANDSW, MAX_LS_ANDSW); + if (attr) CHECK_INCDEC_MODELVAR_CHECK(event, cs->andsw, -MAX_LS_ANDSW, MAX_LS_ANDSW, isSwitchAvailableInLogicalSwitches); break; case LS_FIELD_DURATION: diff --git a/radio/src/opentx.cpp b/radio/src/opentx.cpp index 92628f25c..90e4718fd 100644 --- a/radio/src/opentx.cpp +++ b/radio/src/opentx.cpp @@ -250,8 +250,10 @@ void generalDefault() g_eeGeneral.potsConfig = 0x05; // S1 and S2 = pots with detent g_eeGeneral.slidersConfig = 0x03; // LS and RS = sliders with detent #endif - -#if defined(PCBTARANIS) || defined(PCBHORUS) + +#if defined(PCBX7D) + g_eeGeneral.switchConfig = 0x000006ff; // 4x3POS, 1x2POS, 1xTOGGLE +#elif defined(PCBTARANIS) || defined(PCBHORUS) g_eeGeneral.switchConfig = 0x00007bff; // 6x3POS, 1x2POS, 1xTOGGLE #endif