vedderb / bldc

The VESC motor control firmware
2.16k stars 1.35k forks source link

FOC minor optimizations #467

Open kubark42 opened 2 years ago

kubark42 commented 2 years ago
  1. Several precalculations
  2. Replace some divisions by multiplication
  3. Fix some ;; typos
  4. Abstract out a magic number
  5. Eliminate some instances of volatile keyword.

Saves a bit of flash as well:

Before

   text    data     bss     dec     hex filename
 396140    3828  160256  560224   88c60 /Users/kenz/Documents/vesc/build/100_250/100_250.elf

After

   text    data     bss     dec     hex filename
 396076    3828  160256  560160   88c20 /Users/kenz/Documents/vesc/build/100_250/100_250.elf

Tested and returns sane sys ident. Runs well in