Skip to content

Commit 2c59aff

Browse files
committed
add on enable and on disable to test
1 parent 07fde9f commit 2c59aff

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

magicbot/magiccomponent.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def setup(self) -> None:
4949

5050
def on_enable(self) -> None:
5151
"""
52-
Called when the robot enters autonomous or teleoperated mode. This
52+
Called when the robot enters autonomous, teleoperated or test mode mode. This
5353
function should initialize your component to a "safe" state so
5454
that unexpected things don't happen when enabling the robot.
5555
@@ -60,7 +60,7 @@ def on_enable(self) -> None:
6060

6161
def on_disable(self) -> None:
6262
"""
63-
Called when the robot leaves autonomous or teleoperated
63+
Called when the robot leaves autonomous, teleoperated or test mode
6464
"""
6565

6666
def execute(self) -> None:

magicbot/magicrobot.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,9 @@ def _test(self) -> None:
526526
wpilib.LiveWindow.setEnabled(True)
527527
# Shuffleboard.enableActuatorWidgets()
528528

529+
# initialize things
530+
self._on_mode_enable_components()
531+
529532
try:
530533
self.testInit()
531534
except:
@@ -559,6 +562,8 @@ def _test(self) -> None:
559562
wpilib.LiveWindow.setEnabled(False)
560563
# Shuffleboard.disableActuatorWidgets()
561564

565+
self._on_mode_disable_components()
566+
562567
def _on_mode_enable_components(self) -> None:
563568
# initialize things
564569
for _, component in self._components:

0 commit comments

Comments
 (0)