Working Fix for increased Expo precision by factor 5
This commit is contained in:
parent
7dbab96d99
commit
0af66353a4
|
@ -34,17 +34,23 @@ int16_t lookupThrottleRC[THROTTLE_LOOKUP_LENGTH]; // lookup table for expo & m
|
|||
void generatePitchRollCurve(controlRateConfig_t *controlRateConfig)
|
||||
{
|
||||
uint8_t i;
|
||||
float j = 0;
|
||||
|
||||
for (i = 0; i < PITCH_LOOKUP_LENGTH; i++)
|
||||
lookupPitchRollRC[i] = (2500 + controlRateConfig->rcExpo8 * (i * i - 25)) * i * (int32_t) controlRateConfig->rcRate8 / 2500;
|
||||
for (i = 0; i < PITCH_LOOKUP_LENGTH; i++) {
|
||||
lookupPitchRollRC[i] = (2500 + controlRateConfig->rcExpo8 * (j * j - 25)) * j * (int32_t) controlRateConfig->rcRate8 / 2500;
|
||||
j += 0.2f;
|
||||
}
|
||||
}
|
||||
|
||||
void generateYawCurve(controlRateConfig_t *controlRateConfig)
|
||||
{
|
||||
uint8_t i;
|
||||
float j = 0;
|
||||
|
||||
for (i = 0; i < YAW_LOOKUP_LENGTH; i++)
|
||||
lookupYawRC[i] = (2500 + controlRateConfig->rcYawExpo8 * (i * i - 25)) * i / 25;
|
||||
for (i = 0; i < YAW_LOOKUP_LENGTH; i++) {
|
||||
lookupYawRC[i] = (2500 + controlRateConfig->rcYawExpo8 * (j * j - 25)) * j / 25;
|
||||
j += 0.2f;
|
||||
}
|
||||
}
|
||||
|
||||
void generateThrottleCurve(controlRateConfig_t *controlRateConfig, escAndServoConfig_t *escAndServoConfig)
|
||||
|
|
|
@ -17,9 +17,9 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#define PITCH_LOOKUP_LENGTH 25
|
||||
#define YAW_LOOKUP_LENGTH 25
|
||||
#define THROTTLE_LOOKUP_LENGTH 16
|
||||
#define PITCH_LOOKUP_LENGTH 31
|
||||
#define YAW_LOOKUP_LENGTH 31
|
||||
#define THROTTLE_LOOKUP_LENGTH 12
|
||||
extern int16_t lookupPitchRollRC[PITCH_LOOKUP_LENGTH]; // lookup table for expo & RC rate PITCH+ROLL
|
||||
extern int16_t lookupYawRC[YAW_LOOKUP_LENGTH]; // lookup table for expo & RC rate YAW
|
||||
extern int16_t lookupThrottleRC[THROTTLE_LOOKUP_LENGTH]; // lookup table for expo & mid THROTTLE
|
||||
|
|
|
@ -247,8 +247,8 @@ void annexCode(void)
|
|||
}
|
||||
}
|
||||
|
||||
tmp2 = tmp / 100;
|
||||
rcCommand[axis] = lookupPitchRollRC[tmp2] + (tmp - tmp2 * 100) * (lookupPitchRollRC[tmp2 + 1] - lookupPitchRollRC[tmp2]) / 100;
|
||||
tmp2 = tmp / 20;
|
||||
rcCommand[axis] = lookupPitchRollRC[tmp2] + (tmp - tmp2 * 20) * (lookupPitchRollRC[tmp2 + 1] - lookupPitchRollRC[tmp2]) / 20;
|
||||
} else if (axis == YAW) {
|
||||
if (masterConfig.rcControlsConfig.yaw_deadband) {
|
||||
if (tmp > masterConfig.rcControlsConfig.yaw_deadband) {
|
||||
|
@ -257,8 +257,8 @@ void annexCode(void)
|
|||
tmp = 0;
|
||||
}
|
||||
}
|
||||
tmp2 = tmp / 100;
|
||||
rcCommand[axis] = (lookupYawRC[tmp2] + (tmp - tmp2 * 100) * (lookupYawRC[tmp2 + 1] - lookupYawRC[tmp2]) / 100) * -masterConfig.yaw_control_direction;
|
||||
tmp2 = tmp / 20;
|
||||
rcCommand[axis] = (lookupYawRC[tmp2] + (tmp - tmp2 * 20) * (lookupYawRC[tmp2 + 1] - lookupYawRC[tmp2]) / 20) * -masterConfig.yaw_control_direction;
|
||||
}
|
||||
|
||||
// non coupled PID reduction scaler used in PID controller 1 and PID controller 2.
|
||||
|
|
Loading…
Reference in New Issue