diff --git a/src/main/cli/settings.c b/src/main/cli/settings.c index f0759986c..43945d89c 100644 --- a/src/main/cli/settings.c +++ b/src/main/cli/settings.c @@ -873,6 +873,7 @@ const clivalue_t valueTable[] = { // PG_MIXER_CONFIG { "yaw_motors_reversed", VAR_INT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_MIXER_CONFIG, offsetof(mixerConfig_t, yaw_motors_reversed) }, { "crashflip_motor_percent", VAR_UINT8 | MASTER_VALUE, .config.minmaxUnsigned = { 0, 100 }, PG_MIXER_CONFIG, offsetof(mixerConfig_t, crashflip_motor_percent) }, + { "crashflip_power_percent", VAR_UINT8 | MASTER_VALUE, .config.minmaxUnsigned = { 0, 100 }, PG_MIXER_CONFIG, offsetof(mixerConfig_t, crashflip_power_percent) }, // PG_MOTOR_3D_CONFIG { "3d_deadband_low", VAR_UINT16 | MASTER_VALUE, .config.minmaxUnsigned = { PWM_PULSE_MIN, PWM_RANGE_MIDDLE }, PG_MOTOR_3D_CONFIG, offsetof(flight3DConfig_t, deadband3d_low) }, diff --git a/src/main/flight/mixer.c b/src/main/flight/mixer.c index 918a3eb0b..3f1fc1aa7 100644 --- a/src/main/flight/mixer.c +++ b/src/main/flight/mixer.c @@ -74,6 +74,7 @@ PG_RESET_TEMPLATE(mixerConfig_t, mixerConfig, .mixerMode = DEFAULT_MIXER, .yaw_motors_reversed = false, .crashflip_motor_percent = 0, + .crashflip_power_percent = 100, ); PG_REGISTER_ARRAY(motorMixer_t, MAX_SUPPORTED_MOTORS, customMotorMixer, PG_MOTOR_MIXER, 0); @@ -662,7 +663,7 @@ static void applyFlipOverAfterCrashModeToMotors(void) // Apply a reasonable amount of stick deadband const float flipStickRange = 1.0f - CRASH_FLIP_STICK_MINF; - float flipPower = MAX(0.0f, stickDeflectionLength - CRASH_FLIP_STICK_MINF) / flipStickRange; + float flipPower = MAX(0.0f, stickDeflectionLength - CRASH_FLIP_STICK_MINF) / (flipStickRange / ((float)mixerConfig()->crashflip_power_percent / 100.0f)); for (int i = 0; i < motorCount; ++i) { float motorOutputNormalised = diff --git a/src/main/flight/mixer.h b/src/main/flight/mixer.h index 01b0230cc..5fc13218b 100644 --- a/src/main/flight/mixer.h +++ b/src/main/flight/mixer.h @@ -81,6 +81,7 @@ typedef struct mixerConfig_s { uint8_t mixerMode; bool yaw_motors_reversed; uint8_t crashflip_motor_percent; + uint8_t crashflip_power_percent; } mixerConfig_t; PG_DECLARE(mixerConfig_t, mixerConfig);