diff --git a/radio/src/dataconstants.h b/radio/src/dataconstants.h index 97efbf1368d..499ab6db7b4 100644 --- a/radio/src/dataconstants.h +++ b/radio/src/dataconstants.h @@ -486,8 +486,10 @@ enum MixSources { MIXSRC_FIRST_POT SKIP, MIXSRC_LAST_POT SKIP = MIXSRC_FIRST_POT + MAX_POTS - 1, +#if MAX_AXIS > 0 MIXSRC_FIRST_AXIS SKIP, MIXSRC_LAST_AXIS SKIP = MIXSRC_FIRST_AXIS + MAX_AXIS - 1, +#endif #if defined(IMU) MIXSRC_TILT_X, diff --git a/radio/src/gui/gui_common.cpp b/radio/src/gui/gui_common.cpp index 3eb28f8593b..48836fc42aa 100644 --- a/radio/src/gui/gui_common.cpp +++ b/radio/src/gui/gui_common.cpp @@ -186,8 +186,10 @@ bool isSourceAvailable(int source) return IS_POT_SLIDER_AVAILABLE(source - MIXSRC_FIRST_POT); } +#if MAX_AXIS > 0 if (source >= MIXSRC_FIRST_AXIS && source <= MIXSRC_LAST_AXIS) return source - MIXSRC_FIRST_AXIS < adcGetMaxInputs(ADC_INPUT_AXIS); +#endif #if defined(PCBHORUS) && !defined(SPACEMOUSE) if (source >= MIXSRC_FIRST_SPACEMOUSE && source <= MIXSRC_LAST_SPACEMOUSE) @@ -260,8 +262,10 @@ bool isSourceAvailableInInputs(int source) if (source >= MIXSRC_FIRST_POT && source <= MIXSRC_LAST_POT) return IS_POT_SLIDER_AVAILABLE(source - MIXSRC_FIRST_POT); +#if MAX_AXIS > 0 if (source >= MIXSRC_FIRST_AXIS && source <= MIXSRC_LAST_AXIS) return source - MIXSRC_FIRST_AXIS < adcGetMaxInputs(ADC_INPUT_AXIS); +#endif if (source >= MIXSRC_FIRST_STICK && source <= MIXSRC_MAX) return true; diff --git a/radio/src/mixer.cpp b/radio/src/mixer.cpp index efa50257413..4f2d002b1b9 100644 --- a/radio/src/mixer.cpp +++ b/radio/src/mixer.cpp @@ -337,7 +337,9 @@ getvalue_t getValue(mixsrc_t i, bool* valid) } return calibratedAnalogs[i + adcGetInputOffset(ADC_INPUT_POT)]; } - else if (i <= MIXSRC_FIRST_AXIS) { + +#if MAX_AXIS > 0 + else if (i <= MIXSRC_LAST_AXIS) { i -= MIXSRC_FIRST_AXIS; if (i >= adcGetMaxInputs(ADC_INPUT_AXIS)) { if (valid != nullptr) *valid = false; @@ -345,6 +347,7 @@ getvalue_t getValue(mixsrc_t i, bool* valid) } return calibratedAnalogs[i + adcGetInputOffset(ADC_INPUT_AXIS)]; } +#endif #if defined(IMU) else if (i == MIXSRC_TILT_X) {