Repository navigation
Commit 5f1f3fe
committed
Code review fixes for float math flash savings
Follow-up to the single-precision math change that saves ~17 KB of
flash on STM32F722 targets:
- maths.c: Replace powf(x, 2.0f) with explicit multiplies in
gaussian(). Clearer intent and avoids any dependency on libm
reducing integer-exponent powf to a multiply.
- vtx_smartaudio.c: Add roundf() before uint16_t cast in saDbiToMw().
powf(10.0f, 1.0f) may return 9.999...f on some libm implementations,
which would truncate to 9 mW instead of the correct 10 mW. roundf()
closes the hazard at the cost of one FPU instruction.1 parent 6c1d527 commit 5f1f3fe
2 files changed
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
526 | 526 | | |
527 | 527 | | |
528 | 528 | | |
529 | | - | |
| 529 | + | |
530 | 530 | | |
531 | 531 | | |
532 | 532 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
212 | 212 | | |
213 | 213 | | |
214 | 214 | | |
215 | | - | |
| 215 | + | |
216 | 216 | | |
217 | 217 | | |
218 | 218 | | |
| |||
0 commit comments