Fix for minthrottle when feature 3D and PWM enabled (#5102)

* Fix for minthrottle when feature 3d and pwm enabled

* add parameters for min and max 3d output

* bug fix

* remove new parameters from msp

* remove new parameters again

* fixed indentation
This commit is contained in:
Austin 2018-03-08 12:44:17 -05:00 committed by Michael Keller
parent 18b857de65
commit 4d3666b77b
4 changed files with 11 additions and 5 deletions

View File

@ -92,6 +92,8 @@ PG_RESET_TEMPLATE(flight3DConfig_t, flight3DConfig,
.deadband3d_high = 1514, .deadband3d_high = 1514,
.neutral3d = 1460, .neutral3d = 1460,
.deadband3d_throttle = 50, .deadband3d_throttle = 50,
.limit3d_low = 1000,
.limit3d_high = 2000,
.switched_mode3d = false .switched_mode3d = false
); );

View File

@ -94,6 +94,8 @@ typedef struct flight3DConfig_s {
uint16_t deadband3d_high; // max 3d value uint16_t deadband3d_high; // max 3d value
uint16_t neutral3d; // center 3d value uint16_t neutral3d; // center 3d value
uint16_t deadband3d_throttle; // default throttle deadband from MIDRC uint16_t deadband3d_throttle; // default throttle deadband from MIDRC
uint16_t limit3d_low; // pwm output value for max negative thrust
uint16_t limit3d_high; // pwm output value for max positive thrust
uint8_t switched_mode3d; // enable '3D Switched Mode' uint8_t switched_mode3d; // enable '3D Switched Mode'
} flight3DConfig_t; } flight3DConfig_t;

View File

@ -389,15 +389,15 @@ void initEscEndpoints(void)
default: default:
if (feature(FEATURE_3D)) { if (feature(FEATURE_3D)) {
disarmMotorOutput = flight3DConfig()->neutral3d; disarmMotorOutput = flight3DConfig()->neutral3d;
motorOutputLow = PWM_RANGE_MIN; motorOutputLow = flight3DConfig()->limit3d_low;
motorOutputHigh = flight3DConfig()->limit3d_high;
deadbandMotor3dHigh = flight3DConfig()->deadband3d_high;
deadbandMotor3dLow = flight3DConfig()->deadband3d_low;
} else { } else {
disarmMotorOutput = motorConfig()->mincommand; disarmMotorOutput = motorConfig()->mincommand;
motorOutputLow = motorConfig()->minthrottle; motorOutputLow = motorConfig()->minthrottle;
}
motorOutputHigh = motorConfig()->maxthrottle; motorOutputHigh = motorConfig()->maxthrottle;
deadbandMotor3dHigh = flight3DConfig()->deadband3d_high; }
deadbandMotor3dLow = flight3DConfig()->deadband3d_low;
break; break;
} }

View File

@ -563,6 +563,8 @@ const clivalue_t valueTable[] = {
{ "3d_deadband_high", VAR_UINT16 | MASTER_VALUE, .config.minmax = { PWM_RANGE_MIDDLE, PWM_PULSE_MAX }, PG_MOTOR_3D_CONFIG, offsetof(flight3DConfig_t, deadband3d_high) }, { "3d_deadband_high", VAR_UINT16 | MASTER_VALUE, .config.minmax = { PWM_RANGE_MIDDLE, PWM_PULSE_MAX }, PG_MOTOR_3D_CONFIG, offsetof(flight3DConfig_t, deadband3d_high) },
{ "3d_neutral", VAR_UINT16 | MASTER_VALUE, .config.minmax = { PWM_PULSE_MIN, PWM_PULSE_MAX }, PG_MOTOR_3D_CONFIG, offsetof(flight3DConfig_t, neutral3d) }, { "3d_neutral", VAR_UINT16 | MASTER_VALUE, .config.minmax = { PWM_PULSE_MIN, PWM_PULSE_MAX }, PG_MOTOR_3D_CONFIG, offsetof(flight3DConfig_t, neutral3d) },
{ "3d_deadband_throttle", VAR_UINT16 | MASTER_VALUE, .config.minmax = { PWM_PULSE_MIN, PWM_PULSE_MAX }, PG_MOTOR_3D_CONFIG, offsetof(flight3DConfig_t, deadband3d_throttle) }, { "3d_deadband_throttle", VAR_UINT16 | MASTER_VALUE, .config.minmax = { PWM_PULSE_MIN, PWM_PULSE_MAX }, PG_MOTOR_3D_CONFIG, offsetof(flight3DConfig_t, deadband3d_throttle) },
{ "3d_limit_low", VAR_UINT16 | MASTER_VALUE, .config.minmax = { PWM_PULSE_MIN, PWM_RANGE_MIDDLE }, PG_MOTOR_3D_CONFIG, offsetof(flight3DConfig_t, limit3d_low) },
{ "3d_limit_high", VAR_UINT16 | MASTER_VALUE, .config.minmax = { PWM_RANGE_MIDDLE, PWM_PULSE_MAX }, PG_MOTOR_3D_CONFIG, offsetof(flight3DConfig_t, limit3d_high) },
{ "3d_switched_mode", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_MOTOR_3D_CONFIG, offsetof(flight3DConfig_t, switched_mode3d) }, { "3d_switched_mode", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_MOTOR_3D_CONFIG, offsetof(flight3DConfig_t, switched_mode3d) },
// PG_SERVO_CONFIG // PG_SERVO_CONFIG