mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-17 21:35:44 +03:00
Some cleanups
Fix missing bracket
This commit is contained in:
parent
df159d195d
commit
127251cc99
5 changed files with 4 additions and 14 deletions
|
@ -334,7 +334,6 @@ void resetRcControlsConfig(rcControlsConfig_t *rcControlsConfig) {
|
||||||
|
|
||||||
void resetMixerConfig(mixerConfig_t *mixerConfig) {
|
void resetMixerConfig(mixerConfig_t *mixerConfig) {
|
||||||
mixerConfig->yaw_motor_direction = 1;
|
mixerConfig->yaw_motor_direction = 1;
|
||||||
mixerConfig->airmode_saturation_limit = 30;
|
|
||||||
mixerConfig->yaw_jump_prevention_limit = 200;
|
mixerConfig->yaw_jump_prevention_limit = 200;
|
||||||
#ifdef USE_SERVOS
|
#ifdef USE_SERVOS
|
||||||
mixerConfig->tri_unarmed_servo = 1;
|
mixerConfig->tri_unarmed_servo = 1;
|
||||||
|
|
|
@ -854,11 +854,10 @@ void mixTable(void)
|
||||||
for (i = 0; i < motorCount; i++) {
|
for (i = 0; i < motorCount; i++) {
|
||||||
rollPitchYawMix[i] = qMultiply(mixReduction,rollPitchYawMix[i]);
|
rollPitchYawMix[i] = qMultiply(mixReduction,rollPitchYawMix[i]);
|
||||||
}
|
}
|
||||||
// Get the maximum correction by setting offset to center. Only active below 50% of saturation levels to reduce spazzing out in crashes
|
// Get the maximum correction by setting offset to center
|
||||||
if ((qPercent(mixReduction) > mixerConfig->airmode_saturation_limit) && IS_RC_MODE_ACTIVE(BOXAIRMODE)) {
|
if (IS_RC_MODE_ACTIVE(BOXAIRMODE)) {
|
||||||
throttleMin = throttleMax = throttleMin + (throttleRange / 2);
|
throttleMin = throttleMax = throttleMin + (throttleRange / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
motorLimitReached = false;
|
motorLimitReached = false;
|
||||||
throttleMin = throttleMin + (rollPitchYawMixRange / 2);
|
throttleMin = throttleMin + (rollPitchYawMixRange / 2);
|
||||||
|
|
|
@ -71,7 +71,6 @@ typedef struct mixer_s {
|
||||||
|
|
||||||
typedef struct mixerConfig_s {
|
typedef struct mixerConfig_s {
|
||||||
int8_t yaw_motor_direction;
|
int8_t yaw_motor_direction;
|
||||||
uint8_t airmode_saturation_limit; // Percentage in airmode where the mixer stops trying to get maximum possible correction
|
|
||||||
uint16_t yaw_jump_prevention_limit; // make limit configurable (original fixed value was 100)
|
uint16_t yaw_jump_prevention_limit; // make limit configurable (original fixed value was 100)
|
||||||
#ifdef USE_SERVOS
|
#ifdef USE_SERVOS
|
||||||
uint8_t tri_unarmed_servo; // send tail servo correction pulses even when unarmed
|
uint8_t tri_unarmed_servo; // send tail servo correction pulses even when unarmed
|
||||||
|
|
|
@ -630,7 +630,6 @@ const clivalue_t valueTable[] = {
|
||||||
{ "yaw_control_direction", VAR_INT8 | MASTER_VALUE, &masterConfig.yaw_control_direction, .config.minmax = { -1, 1 } },
|
{ "yaw_control_direction", VAR_INT8 | MASTER_VALUE, &masterConfig.yaw_control_direction, .config.minmax = { -1, 1 } },
|
||||||
|
|
||||||
{ "yaw_motor_direction", VAR_INT8 | MASTER_VALUE, &masterConfig.mixerConfig.yaw_motor_direction, .config.minmax = { -1, 1 } },
|
{ "yaw_motor_direction", VAR_INT8 | MASTER_VALUE, &masterConfig.mixerConfig.yaw_motor_direction, .config.minmax = { -1, 1 } },
|
||||||
{ "airmode_saturation_limit", VAR_UINT8 | MASTER_VALUE, &masterConfig.mixerConfig.airmode_saturation_limit, .config.minmax = { 0, 100 } },
|
|
||||||
{ "yaw_jump_prevention_limit", VAR_UINT16 | MASTER_VALUE, &masterConfig.mixerConfig.yaw_jump_prevention_limit, .config.minmax = { YAW_JUMP_PREVENTION_LIMIT_LOW, YAW_JUMP_PREVENTION_LIMIT_HIGH } },
|
{ "yaw_jump_prevention_limit", VAR_UINT16 | MASTER_VALUE, &masterConfig.mixerConfig.yaw_jump_prevention_limit, .config.minmax = { YAW_JUMP_PREVENTION_LIMIT_LOW, YAW_JUMP_PREVENTION_LIMIT_HIGH } },
|
||||||
{ "yaw_p_limit", VAR_UINT16 | PROFILE_VALUE, &masterConfig.profile[0].pidProfile.yaw_p_limit, .config.minmax = { YAW_P_LIMIT_MIN, YAW_P_LIMIT_MAX } },
|
{ "yaw_p_limit", VAR_UINT16 | PROFILE_VALUE, &masterConfig.profile[0].pidProfile.yaw_p_limit, .config.minmax = { YAW_P_LIMIT_MIN, YAW_P_LIMIT_MAX } },
|
||||||
#ifdef USE_SERVOS
|
#ifdef USE_SERVOS
|
||||||
|
|
|
@ -113,13 +113,12 @@ void setGyroSamplingSpeed(uint16_t looptime) {
|
||||||
masterConfig.gyro_lpf = 0;
|
masterConfig.gyro_lpf = 0;
|
||||||
gyroSampleRate = 125;
|
gyroSampleRate = 125;
|
||||||
maxDivider = 8;
|
maxDivider = 8;
|
||||||
|
masterConfig.pid_process_denom = 1;
|
||||||
if (looptime < 250) {
|
if (looptime < 250) {
|
||||||
masterConfig.acc_hardware = 1;
|
masterConfig.acc_hardware = 1;
|
||||||
masterConfig.baro_hardware = 1;
|
masterConfig.baro_hardware = 1;
|
||||||
masterConfig.mag_hardware = 1;
|
masterConfig.mag_hardware = 1;
|
||||||
masterConfig.pid_process_denom = 2;
|
masterConfig.pid_process_denom = 2;
|
||||||
} else if (looptime < 1000) {
|
|
||||||
masterConfig.pid_process_denom = 1;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
masterConfig.gyro_lpf = 1;
|
masterConfig.gyro_lpf = 1;
|
||||||
|
@ -133,6 +132,7 @@ void setGyroSamplingSpeed(uint16_t looptime) {
|
||||||
masterConfig.mag_hardware = 1;
|
masterConfig.mag_hardware = 1;
|
||||||
gyroSampleRate = 125;
|
gyroSampleRate = 125;
|
||||||
maxDivider = 8;
|
maxDivider = 8;
|
||||||
|
masterConfig.pid_process_denom = 1;
|
||||||
if (looptime < 250) {
|
if (looptime < 250) {
|
||||||
masterConfig.pid_process_denom = 3;
|
masterConfig.pid_process_denom = 3;
|
||||||
} else if (looptime < 500) {
|
} else if (looptime < 500) {
|
||||||
|
@ -141,12 +141,6 @@ void setGyroSamplingSpeed(uint16_t looptime) {
|
||||||
} else {
|
} else {
|
||||||
masterConfig.pid_process_denom = 2;
|
masterConfig.pid_process_denom = 2;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
if (currentProfile->pidProfile.pidController == 2) {
|
|
||||||
masterConfig.pid_process_denom = 2;
|
|
||||||
} else {
|
|
||||||
masterConfig.pid_process_denom = 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
masterConfig.gyro_lpf = 1;
|
masterConfig.gyro_lpf = 1;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue