Skip to content
  • Philippe Gerum's avatar
    drivers/autotune: fix calibration with low frequency timers · 262cdf25
    Philippe Gerum authored
    When a single timer tick last less than the adjustment step time
    (i.e. < 500 ns), we end up with a zero adjustment value which either
    leads to a spurious early shot detection due to a rounding error, or a
    null gravity value at the end of a lengthy but useless calibration
    process.
    
    Make sure to adjust by at least one timer tick, and mitigate rounding
    errors when checking for early shots when the timer frequency is lower
    than 1e9 / ADJUSTMENT_STEP.
    262cdf25