diff --git a/src/main/config/config_master.h b/src/main/config/config_master.h index a0aec3753..de325232a 100644 --- a/src/main/config/config_master.h +++ b/src/main/config/config_master.h @@ -109,8 +109,8 @@ typedef struct master_s { barometerConfig_t barometerConfig; uint8_t acc_unarmedcal; // turn automatic acc compensation on/off - uint16_t throttle_correction_angle; // the angle when the throttle correction is maximal. in 0.1 degres, ex 225 = 22.5 ,30.0, 450 = 45.0 deg - uint8_t throttle_correction_value; // the correction that will be applied at throttle_correction_angle. + throttleCorrectionConfig_t throttleCorrectionConfig; + batteryConfig_t batteryConfig; // Radio/ESC-related configuration diff --git a/src/main/fc/config.c b/src/main/fc/config.c index 92cddade9..0fecf379e 100755 --- a/src/main/fc/config.c +++ b/src/main/fc/config.c @@ -719,8 +719,8 @@ void createDefaultConfig(master_t *config) resetRcControlsConfig(&config->rcControlsConfig); - config->throttle_correction_value = 0; // could 10 with althold or 40 for fpv - config->throttle_correction_angle = 800; // could be 80.0 deg with atlhold or 45.0 for fpv + config->throttleCorrectionConfig.throttle_correction_value = 0; // could 10 with althold or 40 for fpv + config->throttleCorrectionConfig.throttle_correction_angle = 800; // could be 80.0 deg with atlhold or 45.0 for fpv // Failsafe Variables config->failsafeConfig.failsafe_delay = 10; // 1sec @@ -867,7 +867,7 @@ void activateConfig(void) &imuRuntimeConfig, ¤tProfile->pidProfile, &masterConfig.accDeadband, - masterConfig.throttle_correction_angle + masterConfig.throttleCorrectionConfig.throttle_correction_angle ); configureAltitudeHold( diff --git a/src/main/fc/mw.c b/src/main/fc/mw.c index aab4497f7..957a2dfed 100644 --- a/src/main/fc/mw.c +++ b/src/main/fc/mw.c @@ -745,8 +745,8 @@ void subTaskMainSubprocesses(void) setpointRate[YAW] = 0; } - if (masterConfig.throttle_correction_value && (FLIGHT_MODE(ANGLE_MODE) || FLIGHT_MODE(HORIZON_MODE))) { - rcCommand[THROTTLE] += calculateThrottleAngleCorrection(masterConfig.throttle_correction_value); + if (masterConfig.throttleCorrectionConfig.throttle_correction_value && (FLIGHT_MODE(ANGLE_MODE) || FLIGHT_MODE(HORIZON_MODE))) { + rcCommand[THROTTLE] += calculateThrottleAngleCorrection(masterConfig.throttleCorrectionConfig.throttle_correction_value); } processRcCommand(); diff --git a/src/main/flight/imu.h b/src/main/flight/imu.h index 28751a86f..304f5d5de 100644 --- a/src/main/flight/imu.h +++ b/src/main/flight/imu.h @@ -51,6 +51,11 @@ typedef struct accDeadband_s { uint8_t z; // set the acc deadband for z-Axis, this ignores small accelerations } accDeadband_t; +typedef struct throttleCorrectionConfig_s { + uint16_t throttle_correction_angle; // the angle when the throttle correction is maximal. in 0.1 degres, ex 225 = 22.5 ,30.0, 450 = 45.0 deg + uint8_t throttle_correction_value; // the correction that will be applied at throttle_correction_angle. +} throttleCorrectionConfig_t; + typedef struct imuRuntimeConfig_s { uint8_t acc_cut_hz; uint8_t acc_unarmedcal; diff --git a/src/main/io/serial_cli.c b/src/main/io/serial_cli.c index 4fedfec5e..7526eb2ea 100755 --- a/src/main/io/serial_cli.c +++ b/src/main/io/serial_cli.c @@ -827,8 +827,8 @@ const clivalue_t valueTable[] = { { "deadband", VAR_UINT8 | MASTER_VALUE, &masterConfig.rcControlsConfig.deadband, .config.minmax = { 0, 32 } }, { "yaw_deadband", VAR_UINT8 | MASTER_VALUE, &masterConfig.rcControlsConfig.yaw_deadband, .config.minmax = { 0, 100 } }, - { "throttle_correction_value", VAR_UINT8 | MASTER_VALUE, &masterConfig.throttle_correction_value, .config.minmax = { 0, 150 } }, - { "throttle_correction_angle", VAR_UINT16 | MASTER_VALUE, &masterConfig.throttle_correction_angle, .config.minmax = { 1, 900 } }, + { "throttle_correction_value", VAR_UINT8 | MASTER_VALUE, &masterConfig.throttleCorrectionConfig.throttle_correction_value, .config.minmax = { 0, 150 } }, + { "throttle_correction_angle", VAR_UINT16 | MASTER_VALUE, &masterConfig.throttleCorrectionConfig.throttle_correction_angle, .config.minmax = { 1, 900 } }, { "yaw_control_direction", VAR_INT8 | MASTER_VALUE, &masterConfig.yaw_control_direction, .config.minmax = { -1, 1 } },