mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[wpilib,cmd] Rename gamepad face-button trigger APIs to directional names (faceUp/Down/Left/Right) (#8896)
This updates gamepad trigger naming from cardinal-style face buttons
(`northFace/southFace/eastFace/westFace` and
`NorthFace/SouthFace/EastFace/WestFace`) to directional naming
(`faceUp/faceDown/faceRight/faceLeft` and
`FaceUp/FaceDown/FaceRight/FaceLeft`) to match the requested API shape.
The change is applied across Java and C++ HID/command layers, along with
related examples and binding metadata.
- **API surface updates (Java)**
- Renamed trigger/event methods in:
- `wpilibj` `Gamepad`
- `commandsv2` `CommandGamepad`
- `commandsv3` `CommandGamepad`
- Mapping preserved:
- `southFace` → `faceDown`
- `eastFace` → `faceRight`
- `westFace` → `faceLeft`
- `northFace` → `faceUp`
- **API surface updates (C++)**
- Renamed trigger/event methods in:
- `wpilibc` `Gamepad`
- `commandsv2` `CommandGamepad`
- Mapping preserved:
- `SouthFace` → `FaceDown`
- `EastFace` → `FaceRight`
- `WestFace` → `FaceLeft`
- `NorthFace` → `FaceUp`
- **Python semiwrap updates**
- Updated `wpilibc/src/main/python/semiwrap/Gamepad.yml` method mappings
to the renamed C++ method names (`FaceDown/FaceRight/FaceLeft/FaceUp`).
- **Callsite migration**
- Updated Java examples/template code and C++ examples/template code to
use the new method names so samples remain aligned with the API rename.
- **Docs/comments alignment**
- Updated related Javadoc/reference text and example comments to use
directional terminology.
```java
// Before
driverController.southFace().onTrue(command);
driverController.eastFace().onTrue(command);
// After
driverController.faceDown().onTrue(command);
driverController.faceRight().onTrue(command);
```
```cpp
// Before
driverController.SouthFace().OnTrue(command);
driverController.EastFace().OnTrue(command);
// After
driverController.FaceDown().OnTrue(command);
driverController.FaceRight().OnTrue(command);
```
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: ThadHouse <7727148+ThadHouse@users.noreply.github.com>
This commit is contained in:
@@ -70,7 +70,7 @@ bool Gamepad::GetSouthFaceButtonReleased() {
|
||||
return GetButtonReleased(Button::SOUTH_FACE);
|
||||
}
|
||||
|
||||
BooleanEvent Gamepad::SouthFace(EventLoop* loop) const {
|
||||
BooleanEvent Gamepad::FaceDown(EventLoop* loop) const {
|
||||
return BooleanEvent(loop, [this]() { return this->GetSouthFaceButton(); });
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ bool Gamepad::GetEastFaceButtonReleased() {
|
||||
return GetButtonReleased(Button::EAST_FACE);
|
||||
}
|
||||
|
||||
BooleanEvent Gamepad::EastFace(EventLoop* loop) const {
|
||||
BooleanEvent Gamepad::FaceRight(EventLoop* loop) const {
|
||||
return BooleanEvent(loop, [this]() { return this->GetEastFaceButton(); });
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ bool Gamepad::GetWestFaceButtonReleased() {
|
||||
return GetButtonReleased(Button::WEST_FACE);
|
||||
}
|
||||
|
||||
BooleanEvent Gamepad::WestFace(EventLoop* loop) const {
|
||||
BooleanEvent Gamepad::FaceLeft(EventLoop* loop) const {
|
||||
return BooleanEvent(loop, [this]() { return this->GetWestFaceButton(); });
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ bool Gamepad::GetNorthFaceButtonReleased() {
|
||||
return GetButtonReleased(Button::NORTH_FACE);
|
||||
}
|
||||
|
||||
BooleanEvent Gamepad::NorthFace(EventLoop* loop) const {
|
||||
BooleanEvent Gamepad::FaceUp(EventLoop* loop) const {
|
||||
return BooleanEvent(loop, [this]() { return this->GetNorthFaceButton(); });
|
||||
}
|
||||
|
||||
|
||||
@@ -223,14 +223,14 @@ class Gamepad : public GenericHID,
|
||||
bool GetSouthFaceButtonReleased();
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the South Face button's
|
||||
* Constructs an event instance around the Face Down button's
|
||||
* digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the South Face button's
|
||||
* @return an event instance representing the Face Down button's
|
||||
* digital signal attached to the given loop.
|
||||
*/
|
||||
BooleanEvent SouthFace(EventLoop* loop) const;
|
||||
BooleanEvent FaceDown(EventLoop* loop) const;
|
||||
|
||||
/**
|
||||
* Read the value of the East Face button on the controller.
|
||||
@@ -254,14 +254,14 @@ class Gamepad : public GenericHID,
|
||||
bool GetEastFaceButtonReleased();
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the East Face button's
|
||||
* Constructs an event instance around the Face Right button's
|
||||
* digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the East Face button's
|
||||
* @return an event instance representing the Face Right button's
|
||||
* digital signal attached to the given loop.
|
||||
*/
|
||||
BooleanEvent EastFace(EventLoop* loop) const;
|
||||
BooleanEvent FaceRight(EventLoop* loop) const;
|
||||
|
||||
/**
|
||||
* Read the value of the West Face button on the controller.
|
||||
@@ -285,14 +285,14 @@ class Gamepad : public GenericHID,
|
||||
bool GetWestFaceButtonReleased();
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the West Face button's
|
||||
* Constructs an event instance around the Face Left button's
|
||||
* digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the West Face button's
|
||||
* @return an event instance representing the Face Left button's
|
||||
* digital signal attached to the given loop.
|
||||
*/
|
||||
BooleanEvent WestFace(EventLoop* loop) const;
|
||||
BooleanEvent FaceLeft(EventLoop* loop) const;
|
||||
|
||||
/**
|
||||
* Read the value of the North Face button on the controller.
|
||||
@@ -316,14 +316,14 @@ class Gamepad : public GenericHID,
|
||||
bool GetNorthFaceButtonReleased();
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the North Face button's
|
||||
* Constructs an event instance around the Face Up button's
|
||||
* digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the North Face button's
|
||||
* @return an event instance representing the Face Up button's
|
||||
* digital signal attached to the given loop.
|
||||
*/
|
||||
BooleanEvent NorthFace(EventLoop* loop) const;
|
||||
BooleanEvent FaceUp(EventLoop* loop) const;
|
||||
|
||||
/**
|
||||
* Read the value of the Back button on the controller.
|
||||
|
||||
@@ -24,19 +24,19 @@ classes:
|
||||
GetSouthFaceButton:
|
||||
GetSouthFaceButtonPressed:
|
||||
GetSouthFaceButtonReleased:
|
||||
SouthFace:
|
||||
FaceDown:
|
||||
GetEastFaceButton:
|
||||
GetEastFaceButtonPressed:
|
||||
GetEastFaceButtonReleased:
|
||||
EastFace:
|
||||
FaceRight:
|
||||
GetWestFaceButton:
|
||||
GetWestFaceButtonPressed:
|
||||
GetWestFaceButtonReleased:
|
||||
WestFace:
|
||||
FaceLeft:
|
||||
GetNorthFaceButton:
|
||||
GetNorthFaceButtonPressed:
|
||||
GetNorthFaceButtonReleased:
|
||||
NorthFace:
|
||||
FaceUp:
|
||||
GetBackButton:
|
||||
GetBackButtonPressed:
|
||||
GetBackButtonReleased:
|
||||
|
||||
Reference in New Issue
Block a user