mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-25 01:05:27 +03:00
optimize math (#5287)
* optimize math Results in considerable flash saving * log_approx, exp_approx, pow_approx Taken from https://github.com/jhjourdan/SIMD-math-prims/blob/master/simd_math_prims.h * Fix pow in rangefinder * Use approximate function in baro calculation Maximum error is < 20cm * fixup! Fix pow in rangefinder
This commit is contained in:
parent
b64802d931
commit
c11d016bc7
7 changed files with 117 additions and 7 deletions
|
@ -728,7 +728,7 @@ static bool osdDrawSingleElement(uint8_t item)
|
|||
const float value = constrain(batteryConfig()->batteryCapacity - getMAhDrawn(), 0, batteryConfig()->batteryCapacity);
|
||||
|
||||
// Calculate mAh used progress
|
||||
const uint8_t mAhUsedProgress = ceil((value / (batteryConfig()->batteryCapacity / MAIN_BATT_USAGE_STEPS)));
|
||||
const uint8_t mAhUsedProgress = ceilf((value / (batteryConfig()->batteryCapacity / MAIN_BATT_USAGE_STEPS)));
|
||||
|
||||
// Create empty battery indicator bar
|
||||
buff[0] = SYM_PB_START;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue