mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-30 15:52:12 +01:00
OP-1525 Made the Expo magic number a constant and changed it to 1.00695f.
Changed n the firmware code to match the GCS side.
This commit is contained in:
parent
4a6c25720e
commit
bb4d271799
@ -46,14 +46,14 @@ static float applyExpo(float value, float expo);
|
|||||||
static float applyExpo(float value, float expo)
|
static float applyExpo(float value, float expo)
|
||||||
{
|
{
|
||||||
// note: fastPow makes a small error, therefore result needs to be bound
|
// note: fastPow makes a small error, therefore result needs to be bound
|
||||||
float exp = boundf(fastPow(1.023293f, expo), 0.1f, 10.0f);
|
float exp = boundf(fastPow(1.00695f, expo), 0.1f, 10.0f);
|
||||||
|
|
||||||
// magic number scales expo
|
// magic number scales expo
|
||||||
// so that
|
// so that
|
||||||
// expo=100 yields value**10
|
// expo=100 yields value**10
|
||||||
// expo=0 yields value**1
|
// expo=0 yields value**1
|
||||||
// expo=-100 yields value**(1/10)
|
// expo=-100 yields value**(1/10)
|
||||||
// (pow(10,1/100)~=1.023293)
|
// (pow(10,1/100)~=1.00695)
|
||||||
if (value > 0.0f) {
|
if (value > 0.0f) {
|
||||||
return boundf(fastPow(value, exp), 0.0f, 1.0f);
|
return boundf(fastPow(value, exp), 0.0f, 1.0f);
|
||||||
} else if (value < -0.0f) {
|
} else if (value < -0.0f) {
|
||||||
|
@ -315,7 +315,7 @@ void ConfigStabilizationWidget::replotExpo(int value, QwtPlotCurve &curve)
|
|||||||
{
|
{
|
||||||
double x[EXPO_CURVE_POINTS_COUNT] = { 0 };
|
double x[EXPO_CURVE_POINTS_COUNT] = { 0 };
|
||||||
double y[EXPO_CURVE_POINTS_COUNT] = { 0 };
|
double y[EXPO_CURVE_POINTS_COUNT] = { 0 };
|
||||||
double factor = pow(1.03293, value);
|
double factor = pow(EXPO_CURVE_CONSTANT, value);
|
||||||
double step = 1.0 / (EXPO_CURVE_POINTS_COUNT - 1);
|
double step = 1.0 / (EXPO_CURVE_POINTS_COUNT - 1);
|
||||||
|
|
||||||
for (int i = 0; i < EXPO_CURVE_POINTS_COUNT; i++) {
|
for (int i = 0; i < EXPO_CURVE_POINTS_COUNT; i++) {
|
||||||
|
@ -56,6 +56,7 @@ private:
|
|||||||
static const int AUTOMATIC_UPDATE_RATE = 500;
|
static const int AUTOMATIC_UPDATE_RATE = 500;
|
||||||
|
|
||||||
static const int EXPO_CURVE_POINTS_COUNT = 100;
|
static const int EXPO_CURVE_POINTS_COUNT = 100;
|
||||||
|
static const double EXPO_CURVE_CONSTANT = 1.00695;
|
||||||
|
|
||||||
int boardModel;
|
int boardModel;
|
||||||
int m_pidBankCount;
|
int m_pidBankCount;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user