1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-29 14: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:
m_thread 2014-10-10 12:26:22 +02:00
parent 4a6c25720e
commit bb4d271799
3 changed files with 4 additions and 3 deletions

View File

@ -46,14 +46,14 @@ 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
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
// so that
// expo=100 yields value**10
// expo=0 yields value**1
// expo=-100 yields value**(1/10)
// (pow(10,1/100)~=1.023293)
// (pow(10,1/100)~=1.00695)
if (value > 0.0f) {
return boundf(fastPow(value, exp), 0.0f, 1.0f);
} else if (value < -0.0f) {

View File

@ -315,7 +315,7 @@ void ConfigStabilizationWidget::replotExpo(int value, QwtPlotCurve &curve)
{
double x[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);
for (int i = 0; i < EXPO_CURVE_POINTS_COUNT; i++) {

View File

@ -56,6 +56,7 @@ private:
static const int AUTOMATIC_UPDATE_RATE = 500;
static const int EXPO_CURVE_POINTS_COUNT = 100;
static const double EXPO_CURVE_CONSTANT = 1.00695;
int boardModel;
int m_pidBankCount;