initial commit of crashflip motor power percentage control
This commit is contained in:
parent
4c58889915
commit
73a280cc85
|
@ -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) },
|
||||
|
|
|
@ -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 =
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue