diff --git a/src/main/flight/mixer.c b/src/main/flight/mixer.c index 6f3847c02..96b0505e9 100755 --- a/src/main/flight/mixer.c +++ b/src/main/flight/mixer.c @@ -92,18 +92,41 @@ static const motorMixer_t mixerQuadP[] = { { 1.0f, 0.0f, -1.0f, -1.0f }, // FRONT }; +#if defined(USE_UNCOMMON_MIXERS) static const motorMixer_t mixerBicopter[] = { { 1.0f, 1.0f, 0.0f, 0.0f }, // LEFT { 1.0f, -1.0f, 0.0f, 0.0f }, // RIGHT }; +#else +#define mixerBicopter NULL +#endif -static const motorMixer_t mixerY6[] = { - { 1.0f, 0.0f, 1.333333f, 1.0f }, // REAR - { 1.0f, -1.0f, -0.666667f, -1.0f }, // RIGHT - { 1.0f, 1.0f, -0.666667f, -1.0f }, // LEFT - { 1.0f, 0.0f, 1.333333f, -1.0f }, // UNDER_REAR - { 1.0f, -1.0f, -0.666667f, 1.0f }, // UNDER_RIGHT - { 1.0f, 1.0f, -0.666667f, 1.0f }, // UNDER_LEFT +static const motorMixer_t mixerY4[] = { + { 1.0f, 0.0f, 1.0f, -1.0f }, // REAR_TOP CW + { 1.0f, -1.0f, -1.0f, 0.0f }, // FRONT_R CCW + { 1.0f, 0.0f, 1.0f, 1.0f }, // REAR_BOTTOM CCW + { 1.0f, 1.0f, -1.0f, 0.0f }, // FRONT_L CW +}; + + +#if (MAX_SUPPORTED_MOTORS >= 6) +static const motorMixer_t mixerHex6X[] = { + { 1.0f, -0.5f, 0.866025f, 1.0f }, // REAR_R + { 1.0f, -0.5f, -0.866025f, 1.0f }, // FRONT_R + { 1.0f, 0.5f, 0.866025f, -1.0f }, // REAR_L + { 1.0f, 0.5f, -0.866025f, -1.0f }, // FRONT_L + { 1.0f, -1.0f, 0.0f, -1.0f }, // RIGHT + { 1.0f, 1.0f, 0.0f, 1.0f }, // LEFT +}; + +#if defined(USE_UNCOMMON_MIXERS) +static const motorMixer_t mixerHex6H[] = { + { 1.0f, -1.0f, 1.0f, -1.0f }, // REAR_R + { 1.0f, -1.0f, -1.0f, 1.0f }, // FRONT_R + { 1.0f, 1.0f, 1.0f, 1.0f }, // REAR_L + { 1.0f, 1.0f, -1.0f, -1.0f }, // FRONT_L + { 1.0f, 0.0f, 0.0f, 0.0f }, // RIGHT + { 1.0f, 0.0f, 0.0f, 0.0f }, // LEFT }; static const motorMixer_t mixerHex6P[] = { @@ -114,23 +137,24 @@ static const motorMixer_t mixerHex6P[] = { { 1.0f, 0.0f, -1.0f, 1.0f }, // FRONT { 1.0f, 0.0f, 1.0f, -1.0f }, // REAR }; - -static const motorMixer_t mixerY4[] = { - { 1.0f, 0.0f, 1.0f, -1.0f }, // REAR_TOP CW - { 1.0f, -1.0f, -1.0f, 0.0f }, // FRONT_R CCW - { 1.0f, 0.0f, 1.0f, 1.0f }, // REAR_BOTTOM CCW - { 1.0f, 1.0f, -1.0f, 0.0f }, // FRONT_L CW -}; - -static const motorMixer_t mixerHex6X[] = { - { 1.0f, -0.5f, 0.866025f, 1.0f }, // REAR_R - { 1.0f, -0.5f, -0.866025f, 1.0f }, // FRONT_R - { 1.0f, 0.5f, 0.866025f, -1.0f }, // REAR_L - { 1.0f, 0.5f, -0.866025f, -1.0f }, // FRONT_L - { 1.0f, -1.0f, 0.0f, -1.0f }, // RIGHT - { 1.0f, 1.0f, 0.0f, 1.0f }, // LEFT +static const motorMixer_t mixerY6[] = { + { 1.0f, 0.0f, 1.333333f, 1.0f }, // REAR + { 1.0f, -1.0f, -0.666667f, -1.0f }, // RIGHT + { 1.0f, 1.0f, -0.666667f, -1.0f }, // LEFT + { 1.0f, 0.0f, 1.333333f, -1.0f }, // UNDER_REAR + { 1.0f, -1.0f, -0.666667f, 1.0f }, // UNDER_RIGHT + { 1.0f, 1.0f, -0.666667f, 1.0f }, // UNDER_LEFT }; +#else +#define mixerHex6H NULL +#define mixerHex6P NULL +#define mixerY6 NULL +#endif // USE_UNCOMMON_MIXERS +#else +#define mixerHex6X NULL +#endif // MAX_SUPPORTED_MOTORS >= 6 +#if defined(USE_UNCOMMON_MIXERS) && (MAX_SUPPORTED_MOTORS >= 8) static const motorMixer_t mixerOctoX8[] = { { 1.0f, -1.0f, 1.0f, -1.0f }, // REAR_R { 1.0f, -1.0f, -1.0f, 1.0f }, // FRONT_R @@ -163,6 +187,11 @@ static const motorMixer_t mixerOctoFlatX[] = { { 1.0f, -0.414178f, 1.0f, -1.0f }, // REAR_R { 1.0f, 1.0f, 0.414178f, -1.0f }, // MIDREAR_L }; +#else +#define mixerOctoX8 NULL +#define mixerOctoFlatP NULL +#define mixerOctoFlatX NULL +#endif static const motorMixer_t mixerVtail4[] = { { 1.0f, -0.58f, 0.58f, 1.0f }, // REAR_R @@ -178,19 +207,14 @@ static const motorMixer_t mixerAtail4[] = { { 1.0f, 1.0f, -1.0f, -0.0f }, // FRONT_L }; -static const motorMixer_t mixerHex6H[] = { - { 1.0f, -1.0f, 1.0f, -1.0f }, // REAR_R - { 1.0f, -1.0f, -1.0f, 1.0f }, // FRONT_R - { 1.0f, 1.0f, 1.0f, 1.0f }, // REAR_L - { 1.0f, 1.0f, -1.0f, -1.0f }, // FRONT_L - { 1.0f, 0.0f, 0.0f, 0.0f }, // RIGHT - { 1.0f, 0.0f, 0.0f, 0.0f }, // LEFT -}; - +#if defined(USE_UNCOMMON_MIXERS) static const motorMixer_t mixerDualcopter[] = { { 1.0f, 0.0f, 0.0f, -1.0f }, // LEFT { 1.0f, 0.0f, 0.0f, 1.0f }, // RIGHT }; +#else +#define mixerDualcopter NULL +#endif static const motorMixer_t mixerSingleProp[] = { { 1.0f, 0.0f, 0.0f, 0.0f }, diff --git a/src/main/target/common.h b/src/main/target/common.h index 65eb2bd9d..faafa5432 100644 --- a/src/main/target/common.h +++ b/src/main/target/common.h @@ -114,3 +114,6 @@ #define USE_SENSOR_NAMES #endif +#if (FLASH_SIZE > 256) +#define USE_UNCOMMON_MIXERS +#endif