1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-15 20:35:33 +03:00

Set actual rates in deg/s, independently of each other

Each parameter is independent.
Set actual centre sensitivity and actual max rates.
For:
Centre sensitivity of 200 = rcRate of 1.0; enter as 2.0 in Config, 200 CLI
Max Rate of 800, enter sRate as 0.8 in Config, 80 in CLI
Expo enter as usual, 0.5 approximates no expo, 0 is flatter, 1 is about the same as 0.5 expo usually, but won't change centre sensitivity.
This commit is contained in:
ctzsnooze 2020-02-18 10:04:25 +11:00
parent b55f37b730
commit b61d641bfc
3 changed files with 18 additions and 1 deletions

View file

@ -336,7 +336,7 @@ static const char * const lookupTableGyroOverflowCheck[] = {
#endif
static const char * const lookupTableRatesType[] = {
"BETAFLIGHT", "RACEFLIGHT", "KISS"
"BETAFLIGHT", "RACEFLIGHT", "KISS", "ACTUAL"
};
#ifdef USE_OVERCLOCK

View file

@ -28,6 +28,7 @@ typedef enum {
RATES_TYPE_BETAFLIGHT = 0,
RATES_TYPE_RACEFLIGHT,
RATES_TYPE_KISS,
RATES_TYPE_ACTUAL,
} ratesType_e;
typedef enum {

View file

@ -193,6 +193,18 @@ float applyKissRates(const int axis, float rcCommandf, const float rcCommandfAbs
return kissAngle;
}
float applyActualRates(const int axis, float rcCommandf, const float rcCommandfAbs)
{
float expof = currentControlRateProfile->rcExpo[axis] / 100.0f;
expof = rcCommandfAbs * (powerf(rcCommandf, 5) * expof + rcCommandf * (1 - expof));
const float centerSensitivity = currentControlRateProfile->rcRates[axis];
const float stickMovement = MAX(0, currentControlRateProfile->rates[axis] * 10.0f - centerSensitivity);
const float angleRate = rcCommandf * centerSensitivity + stickMovement * expof;
return angleRate;
}
float applyCurve(int axis, float deflection)
{
return applyRates(axis, deflection, fabsf(deflection));
@ -816,6 +828,10 @@ void initRcProcessing(void)
case RATES_TYPE_KISS:
applyRates = applyKissRates;
break;
case RATES_TYPE_ACTUAL:
applyRates = applyActualRates;
break;
}