Skip to content

Commit 725e79b

Browse files
authored
Change withInterrupt=>until() (#1719)
* Change withInterrupt=>until() Updates to match wpilibsuite/allwpilib#3981 * Fix lint
1 parent 5a013c8 commit 725e79b

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

source/docs/software/commandbased/convenience-features.rst

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -370,22 +370,24 @@ decorated command will be interrupted if the timeout expires:
370370
// Will time out 5 seconds after being scheduled, and be interrupted
371371
button.WhenPressed(command.WithTimeout(5.0_s));
372372

373-
withInterrupt
374-
^^^^^^^^^^^^^
373+
until/withInterrupt
374+
^^^^^^^^^^^^^^^^^^^
375375

376-
The ``withInterrupt()`` (`Java <https://first.wpi.edu/wpilib/allwpilib/docs/release/java/edu/wpi/first/wpilibj2/command/Command.html#withInterrupt(java.util.function.BooleanSupplier)>`__, `C++ <https://first.wpi.edu/wpilib/allwpilib/docs/release/cpp/classfrc2_1_1_command.html#ad5d6a753ec2790f274bc7b884e9e305b>`__) decorator adds a condition on which the command will be interrupted:
376+
The ``until()`` (`Java <https://first.wpi.edu/wpilib/allwpilib/docs/release/java/edu/wpi/first/wpilibj2/command/Command.html#until(java.util.function.BooleanSupplier)>`__, `C++ <https://first.wpi.edu/wpilib/allwpilib/docs/release/cpp/classfrc2_1_1_command.html#a1617d60548cc8a75c12f5ddfe8e3c38c>`__) decorator adds a condition on which the command will be interrupted:
377377

378378
.. tabs::
379379

380380
.. code-tab:: java
381381

382382
// Will be interrupted if m_limitSwitch.get() returns true
383-
button.whenPressed(command.withInterrupt(m_limitSwitch::get));
383+
button.whenPressed(command.until(m_limitSwitch::get));
384384

385385
.. code-tab:: c++
386386

387387
// Will be interrupted if m_limitSwitch.get() returns true
388-
button.WhenPressed(command.WithInterrupt([&m_limitSwitch] { return m_limitSwitch.Get(); }));
388+
button.WhenPressed(command.Until([&m_limitSwitch] { return m_limitSwitch.Get(); }));
389+
390+
``withInterrupt()`` is an alias for ``until()``.
389391

390392
andThen
391393
^^^^^^^

0 commit comments

Comments
 (0)