diff --git a/src/main/config/config.c b/src/main/config/config.c index a830ad496a4..c7d9dbb7ddb 100755 --- a/src/main/config/config.c +++ b/src/main/config/config.c @@ -137,7 +137,7 @@ static uint32_t activeFeaturesLatch = 0; static uint8_t currentControlRateProfileIndex = 0; controlRateConfig_t *currentControlRateProfile; -static const uint8_t EEPROM_CONF_VERSION = 113; +static const uint8_t EEPROM_CONF_VERSION = 114; void resetPidProfile(pidProfile_t *pidProfile) { @@ -325,7 +325,6 @@ static void resetMixerConfig(mixerConfig_t *mixerConfig) { #ifdef USE_SERVOS mixerConfig->tri_unarmed_servo = 1; mixerConfig->servo_lowpass_freq = 400.0f; - mixerConfig->tri_servo_angle_at_max = 400; mixerConfig->tri_tail_motor_thrustfactor = 138; mixerConfig->tri_tail_servo_speed = 300; // Default for BMS-210DMH at 5V mixerConfig->tri_servo_min_adc = 0; @@ -514,6 +513,10 @@ STATIC_UNIT_TESTED void resetConf(void) currentProfile->servoConf[i].angleAtMax = DEFAULT_SERVO_MAX_ANGLE; currentProfile->servoConf[i].forwardFromChannel = CHANNEL_FORWARDING_DISABLED; } + if (masterConfig.mixerMode == MIXER_TRI) { + currentProfile->servoConf[5].angleAtMin = 40; + currentProfile->servoConf[5].angleAtMax = 40; + } // gimbal currentProfile->gimbalConfig.mode = GIMBAL_MODE_NORMAL; diff --git a/src/main/flight/mixer.h b/src/main/flight/mixer.h index 2aebd50c17d..71756e3cbb5 100644 --- a/src/main/flight/mixer.h +++ b/src/main/flight/mixer.h @@ -82,7 +82,6 @@ typedef struct mixerConfig_s { uint8_t tri_unarmed_servo; // send tail servo correction pulses even when unarmed float servo_lowpass_freq; // lowpass servo filter frequency selection; 1/1000ths of loop freq int8_t servo_lowpass_enable; // enable/disable lowpass filter - int16_t tri_servo_angle_at_max; int16_t tri_tail_motor_thrustfactor; int16_t tri_tail_servo_speed; uint8_t tri_servo_feedback; diff --git a/src/main/flight/mixer_tricopter.c b/src/main/flight/mixer_tricopter.c index ca596f23b98..706d2871681 100644 --- a/src/main/flight/mixer_tricopter.c +++ b/src/main/flight/mixer_tricopter.c @@ -164,7 +164,7 @@ void triInitMixer(servoParam_t *pTailServoConfig, gpTailServoConf = pTailServoConfig; gpTailServo = pTailServo; tailServoThrustFactor = pMixerConfig->tri_tail_motor_thrustfactor / 10.0f; - tailServoMaxAngle = pMixerConfig->tri_servo_angle_at_max; + tailServoMaxAngle = gpTailServoConf->angleAtMax *10; tailServoSpeed = pMixerConfig->tri_tail_servo_speed; gpMixerConfig = pMixerConfig; @@ -409,7 +409,7 @@ static uint16_t feedbackServoStep(mixerConfig_t *mixerConf, uint16_t tailServoAD const int32_t ADCFeedback = tailServoADC; const int16_t midValue = mixerConf->tri_servo_mid_adc; const int16_t endValue = ADCFeedback < midValue ? mixerConf->tri_servo_min_adc : mixerConf->tri_servo_max_adc; - const int16_t tailServoMaxAngle = mixerConf->tri_servo_angle_at_max; + const int16_t tailServoMaxAngle = gpTailServoConf->angleAtMax *10; const int16_t endAngle = ADCFeedback < midValue ? TRI_TAIL_SERVO_ANGLE_MID - tailServoMaxAngle : TRI_TAIL_SERVO_ANGLE_MID + tailServoMaxAngle; return ((endAngle - TRI_TAIL_SERVO_ANGLE_MID) * (ADCFeedback - midValue) / (endValue - midValue) + TRI_TAIL_SERVO_ANGLE_MID); } diff --git a/src/main/io/serial_cli.c b/src/main/io/serial_cli.c index 38ae23834bd..122fe387102 100644 --- a/src/main/io/serial_cli.c +++ b/src/main/io/serial_cli.c @@ -604,7 +604,6 @@ const clivalue_t valueTable[] = { { "tri_unarmed_servo", VAR_INT8 | MASTER_VALUE | MODE_LOOKUP, &masterConfig.mixerConfig.tri_unarmed_servo, .config.lookup = { TABLE_OFF_ON } }, { "servo_lowpass_freq", VAR_FLOAT | MASTER_VALUE, &masterConfig.mixerConfig.servo_lowpass_freq, .config.minmax = { 10, 400} }, { "servo_lowpass_enable", VAR_INT8 | MASTER_VALUE | MODE_LOOKUP, &masterConfig.mixerConfig.servo_lowpass_enable, .config.lookup = { TABLE_OFF_ON } }, - { "tri_servo_angle_at_max", VAR_INT16 | MASTER_VALUE, &masterConfig.mixerConfig.tri_servo_angle_at_max, .config.minmax = { 0, 500 } }, { "tri_tail_motor_thrustfactor",VAR_INT16 | MASTER_VALUE, &masterConfig.mixerConfig.tri_tail_motor_thrustfactor, .config.minmax = { TAIL_THRUST_FACTOR_MIN, TAIL_THRUST_FACTOR_MAX } }, { "tri_tail_servo_speed", VAR_INT16 | MASTER_VALUE, &masterConfig.mixerConfig.tri_tail_servo_speed, .config.minmax = { 0, 1000 } }, { "tri_servo_feedback", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, &masterConfig.mixerConfig.tri_servo_feedback, .config.lookup = { TABLE_SERVO_FEEDBACK } },