static const motorMixer_t mixerTri[] =
{
{ 1.0f, 0.0f, 1.333333f, 0.0f }, // REAR
{ 1.0f, -1.0f, -0.666667f, 0.0f }, // RIGHT
{ 1.0f, 1.0f, -0.666667f, 0.0f }, // LEFT
};
// motors for non-servo mixes
if (numberMotor > 1)
for (i = 0; i < numberMotor; i++)
motor[i] = (float)rcCommand[THROTTLE] * currentMixer[i].throttle + axisPID[PITCH] * currentMixer[i].pitch + axisPID[ROLL] * currentMixer[i].roll + cfg.tri_ydir * axisPID[YAW] * currentMixer[i].yaw;
// airplane / servo mixes
switch (cfg.mixerConfiguration)
{
case MULTITYPE_BI:
servo[4] = constrain(1500 + (cfg.tri_ydir * axisPID[YAW]) + axisPID[PITCH], 1020, 2000); //LEFT
servo[5] = constrain(1500 + (cfg.tri_ydir * axisPID[YAW]) - axisPID[PITCH], 1020, 2000); //RIGHT
break;
case MULTITYPE_TRI:
servo[5] = constrain(cfg.tri_ymid + cfg.tri_ydir * axisPID[YAW], cfg.tri_ymin, cfg.tri_ymax); //REAR
break;
maxMotor = motor[0];
for (i = 1; i < numberMotor; i++) if (motor[i] > maxMotor) maxMotor = motor[i];
for (i = 0; i < numberMotor; i++)
{
if (maxMotor > cfg.esc_max) motor[i] -= maxMotor - cfg.esc_max; // this is a way to still have good gyro corrections if at least one motor reaches its max.
motor[i] = constrain(motor[i], cfg.esc_min, cfg.esc_max);