Skip to content

Commit

Permalink
buzzer, remove not needed ARR register value limit
Browse files Browse the repository at this point in the history
  • Loading branch information
ajjjjjjjj committed Dec 19, 2024
1 parent 41791f3 commit bb3c68b
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions radio/src/targets/flysky/buzzer_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,7 @@ static void setVolume(int8_t volume)

static void setFrequency(uint32_t freq)
{
uint32_t autoReload = 1000000 / freq - 1;
PWM_TIMER->ARR = limit<uint32_t>(2, autoReload, 65535);
PWM_TIMER->ARR = 1000000 / freq - 1; // freq below 16Hz will overflow 16bit ARR (never happen)
if (PWM_TIMER->CNT > PWM_TIMER->ARR) // fixes vario noise on descent
PWM_TIMER->CNT = 0;
}
Expand Down

0 comments on commit bb3c68b

Please sign in to comment.