Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix C++ Export of XboxControllerButton #369

Merged
merged 1 commit into from
Jan 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/resources/export/cpp/ExportDescription.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ Instructions:
Xbox Button:
Defaults: "Button,OI,None"
ClassName: "JoystickButton"
Construction: "frc2::${ClassName} #variable($Name){&#variable($Joystick), ${Button}};"
Construction: "frc2::${ClassName} #variable($Name){&#variable($Joystick), (int)frc::XboxController::Button::${Button}};"
Import: "\\#include <frc2/command/button/${ClassName}.h>"

Command:
Expand Down
27 changes: 23 additions & 4 deletions src/main/resources/help/Xbox Button.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,24 @@ <h3>Conditions to run a command</h3>
<p>The conditions under which to run the selected commands can be
one of the three following options:</p>
<dl>
<dt>While Held</dt>
<dd>Repeatedly run the command while the button is held then
interrupt it when the user releases the button.</dd>
<dt>When Pressed</dt>
<dd>Start running the command when the button is pressed.</dd>
<dd>Start running the command when the button is initially
pressed.</dd>
<dt>When Released</dt>
<dd>Start running the command when the button is released.</dd>
<dt>While Held</dt>
<dd>Repeatedly run the command while the button is held then
cancels it when the user releases the button.</dd>
<dt>When Held</dt>
<dd>Run the command when the button is pressed then cancels it
when the user releases the button. Unlike While Held, the
command is not re-run while the button is held if it finishes
early.</dd>
<dt>Toggle When Pressed</dt>
<dd>Run the command when the button is pressed if it isn't
running or cancels it when tit isn't running</dd>
<dt>Cancel When Pressed</dt>
<dd>Cancel command when the button is pressed.</dd>
</dl>
<h2>Properties</h2>
<dl>
Expand All @@ -39,8 +50,16 @@ <h2>Properties</h2>
<dd>The button number on the joystick.</dd>
<dt>Command</dt>
<dd>The command to run.</dd>
<dt>Parameters</dt>
<dd>Parameters for the command.</dd>
<dt>When to Run</dt>
<dd>The conditions of when to run the command</dd>
<dt>Add Timeout</dt>
<dd>Whether to add a timeout for the command</dd>
<dt>Timeout</dt>
<dd>The timeout for the command</dd>
<dt>Interruptible</dt>
<dd>Whether or not the command should be interruptible.</dd>
</dl>
<h2>See Also</h2>
<ul>
Expand Down
3 changes: 2 additions & 1 deletion src/test/java/robotbuilder/TestUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@ public static RobotTree generateTestTree() {
oi.add(xbox);
RobotComponent xboxButton = new RobotComponent("Arm Up Xbox Button", "Xbox Button", tree);
xbox.add(armUpButton);
autoButton.getProperty("When to Run").setValueAndUpdate("whenPressed");
xboxButton.getProperty("When to Run").setValueAndUpdate("whenPressed");
xboxButton.getProperty("Button").setValueAndUpdate("A");

// Create some commands
RobotComponent tankDrive = new RobotComponent("Tank Drive", "Command", tree);
Expand Down