onTrue doesn't allow command to stop when button is released

So I have this code here to control a mechanism:

m_Controller.a().onTrue(
            CommandUtililty.balanceCommand()
        );

but the problem is that when I release the button, It doens’t stop the command, it just continues. Is there a method that I can call instead of onTrue that will have the functionality i need? Thanks!!

Here is the command code:

public static Command balanceCommand() {
        return new RunCommand(
            () -> m_DriveSubsystem.tankDrive(
                m_DriveSubsystem.getPitchController().calculate(
                    -m_DriveSubsystem.getRobotPitch(),
                    0
                )
            )
        ).until(
            () -> m_DriveSubsystem.getPitchController().atSetpoint()
        );

Thanks!!

Have you tried whileTrue()

For some reason when I read documentation, the exact thing I need just seems to go in one eye and out the other :sweat_smile:. Thanks so much I didn’t even see that!