Skip to content

Commit 8f5700c

Browse files
committed
Deprecate PreciseDelay in favour of NotifierDelay
1 parent 9a0191e commit 8f5700c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

robotpy_ext/misc/precise_delay.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import hal
22
import time
3+
import warnings
34
import wpilib
45

56

@@ -18,13 +19,21 @@ class PreciseDelay:
1819
while something:
1920
# do things here
2021
delay.wait()
22+
23+
.. deprecated:: 2019
24+
PreciseDelay is terribly inefficient. Use :class:`NotifierDelay` instead.
2125
"""
2226

2327
def __init__(self, delay_period):
2428
"""
2529
:param delay_period: The amount of time (in seconds) to do a delay
2630
:type delay_period: float
2731
"""
32+
warnings.warn(
33+
"PreciseDelay is deprecated, use NotifierDelay instead.",
34+
category=DeprecationWarning,
35+
stacklevel=2,
36+
)
2837

2938
# The WPILib sleep/etc functions are slightly less stable as
3039
# they have more overhead, so only use them in simulation mode

0 commit comments

Comments
 (0)