Fixed an overflow where the intermediate is greater than UINT16_MAX.

master
Michael Hope 9 years ago
parent ed899fe947
commit 657e04fdd4
  1. 2
      lib/timer.h

@ -40,7 +40,7 @@ class Timer {
static const uint8_t Reserved = 0xFE;
uint8_t to_ticks(int ms) {
return (HAL::TicksPerSecond * ms + 500) / 1000;
return ((uint32_t)HAL::TicksPerSecond * ms + 500) / 1000;
}
bool tick_internal(uint8_t reload = Stopped);

Loading…
Cancel
Save