Skip to content

Commit 5f793b7

Browse files
committed
Only call the inits on a transition.
Signed-off-by: Mike Stitt <[email protected]>
1 parent 3f1e12c commit 5f793b7

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

subprojects/robotpy-wpilib/wpilib/iterativerobotpy.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -163,22 +163,22 @@ def loopFunc(self):
163163
Shuffleboard.disableActuatorWidgets()
164164
self.testExit()
165165

166-
if self._mode == IterativeRobotMode.kDisabled:
167-
self.disabledInit()
168-
self._watchdog.addEpoch("DisabledInit()")
169-
elif self._mode == IterativeRobotMode.kAutonomous:
170-
self.autonomousInit()
171-
self._watchdog.addEpoch("AutonomousInit()")
172-
elif self._mode == IterativeRobotMode.kTeleop:
173-
self.teleopInit()
174-
self._watchdog.addEpoch("TeleopInit()")
175-
elif self._mode == IterativeRobotMode.kTest:
176-
if self._lwEnabledInTest:
177-
wpilib.LiveWindow.setEnabled(True)
178-
Shuffleboard.enableActuatorWidgets()
179-
self.testInit()
180-
self._watchdog.addEpoch("TestInit()")
181-
self._lastMode = self._mode
166+
if self._mode == IterativeRobotMode.kDisabled:
167+
self.disabledInit()
168+
self._watchdog.addEpoch("DisabledInit()")
169+
elif self._mode == IterativeRobotMode.kAutonomous:
170+
self.autonomousInit()
171+
self._watchdog.addEpoch("AutonomousInit()")
172+
elif self._mode == IterativeRobotMode.kTeleop:
173+
self.teleopInit()
174+
self._watchdog.addEpoch("TeleopInit()")
175+
elif self._mode == IterativeRobotMode.kTest:
176+
if self._lwEnabledInTest:
177+
wpilib.LiveWindow.setEnabled(True)
178+
Shuffleboard.enableActuatorWidgets()
179+
self.testInit()
180+
self._watchdog.addEpoch("TestInit()")
181+
self._lastMode = self._mode
182182

183183
# Call the appropriate function depending upon the current robot mode
184184
if self._mode == IterativeRobotMode.kDisabled:

0 commit comments

Comments
 (0)