mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-20 14:55:21 +03:00
Moving constrain to the include file and making it static inline
This commit is contained in:
parent
5ffb3b5068
commit
8310c6f050
2 changed files with 20 additions and 23 deletions
|
@ -111,26 +111,6 @@ int32_t applyDeadband(int32_t value, int32_t deadband)
|
|||
return value;
|
||||
}
|
||||
|
||||
inline int constrain(int amt, int low, int high)
|
||||
{
|
||||
if (amt < low)
|
||||
return low;
|
||||
else if (amt > high)
|
||||
return high;
|
||||
else
|
||||
return amt;
|
||||
}
|
||||
|
||||
inline float constrainf(float amt, float low, float high)
|
||||
{
|
||||
if (amt < low)
|
||||
return low;
|
||||
else if (amt > high)
|
||||
return high;
|
||||
else
|
||||
return amt;
|
||||
}
|
||||
|
||||
void devClear(stdev_t *dev)
|
||||
{
|
||||
dev->m_n = 0;
|
||||
|
|
|
@ -71,9 +71,6 @@ typedef union {
|
|||
|
||||
int32_t applyDeadband(int32_t value, int32_t deadband);
|
||||
|
||||
int constrain(int amt, int low, int high);
|
||||
float constrainf(float amt, float low, float high);
|
||||
|
||||
void devClear(stdev_t *dev);
|
||||
void devPush(stdev_t *dev, float x);
|
||||
float devVariance(stdev_t *dev);
|
||||
|
@ -116,3 +113,23 @@ void arraySubInt32(int32_t *dest, int32_t *array1, int32_t *array2, int count);
|
|||
int16_t qPercent(fix12_t q);
|
||||
int16_t qMultiply(fix12_t q, int16_t input);
|
||||
fix12_t qConstruct(int16_t num, int16_t den);
|
||||
|
||||
static inline int constrain(int amt, int low, int high)
|
||||
{
|
||||
if (amt < low)
|
||||
return low;
|
||||
else if (amt > high)
|
||||
return high;
|
||||
else
|
||||
return amt;
|
||||
}
|
||||
|
||||
static inline float constrainf(float amt, float low, float high)
|
||||
{
|
||||
if (amt < low)
|
||||
return low;
|
||||
else if (amt > high)
|
||||
return high;
|
||||
else
|
||||
return amt;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue