5
5
6
6
from wpilib .iterativerobotpy import IterativeRobotPy
7
7
8
- _getFPGATime = RobotController .getFPGATime ()
8
+ _getFPGATime = RobotController .getFPGATime
9
9
_kResourceType_Framework = tResourceType .kResourceType_Framework
10
10
_kFramework_Timed = tInstances .kFramework_Timed
11
11
12
12
class _Callback :
13
13
def __init__ (self , func , periodUs : int , expirationUs : int ):
14
14
self .func = func
15
15
self ._periodUs = periodUs
16
- self ._expirationUs = expirationUs
16
+ self .expirationUs = expirationUs
17
17
18
18
@classmethod
19
19
def makeCallBack (cls ,
@@ -29,7 +29,7 @@ def makeCallBack(cls,
29
29
)
30
30
31
31
currentTimeUs = _getFPGATime ()
32
- callback ._expirationUs = offsetUs + callback .calcFutureExpirationUs (currentTimeUs )
32
+ callback .expirationUs = offsetUs + callback .calcFutureExpirationUs (currentTimeUs )
33
33
return callback
34
34
35
35
def calcFutureExpirationUs (self , currentTimeUs : int ) -> int :
@@ -39,14 +39,14 @@ def calcFutureExpirationUs(self, currentTimeUs: int) -> int:
39
39
# callback wouldn't be running otherwise.
40
40
# todo does this math work?
41
41
# todo does the "// periodUs * periodUs" do the correct integer math?
42
- return self ._expirationUs + self ._periodUs + \
43
- ((currentTimeUs - self ._expirationUs ) // self ._periodUs ) * self ._periodUs
42
+ return self .expirationUs + self ._periodUs + \
43
+ ((currentTimeUs - self .expirationUs ) // self ._periodUs ) * self ._periodUs
44
44
45
45
def setNextStartTimeUs (self , currentTimeUs : int ):
46
- self ._expirationUs = self .calcFutureExpirationUs (currentTimeUs )
46
+ self .expirationUs = self .calcFutureExpirationUs (currentTimeUs )
47
47
48
48
def __lt__ (self , other ):
49
- return self ._expirationUs < other ._expirationUs
49
+ return self .expirationUs < other .expirationUs
50
50
51
51
def __bool__ (self ):
52
52
return True
0 commit comments