We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 527d90e + 892cca3 commit 26a51abCopy full SHA for 26a51ab
adafruit_ticks.py
@@ -122,7 +122,9 @@ def ticks_ms() -> int:
122
123
def ticks_add(ticks: int, delta: int) -> int:
124
"Add a delta to a base number of ticks, performing wraparound at 2**29ms."
125
- return (ticks + delta) % _TICKS_PERIOD
+ if -_TICKS_HALFPERIOD < delta < _TICKS_HALFPERIOD:
126
+ return (ticks + delta) % _TICKS_PERIOD
127
+ raise OverflowError("ticks interval overflow")
128
129
130
def ticks_diff(ticks1: int, ticks2: int) -> int:
0 commit comments