mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[hal,wpilib] Use new DS available API from mrccomm (#8302)
Instead of just having a max count for joystick values, there's an available mask of values. This is because in the future we're expecting there to be holes in the list of available buttons and axes. This updates everything to support that scenario. Also, Joystick buttons, axes, and POVs all now start at 0 instead of 1.
This commit is contained in:
@@ -16,10 +16,12 @@ class IsJoystickConnectedParametersTest
|
||||
: public ::testing::TestWithParam<std::tuple<int, int, int, bool>> {};
|
||||
|
||||
TEST_P(IsJoystickConnectedParametersTest, IsJoystickConnected) {
|
||||
frc::sim::DriverStationSim::SetJoystickAxisCount(1, std::get<0>(GetParam()));
|
||||
frc::sim::DriverStationSim::SetJoystickButtonCount(1,
|
||||
std::get<1>(GetParam()));
|
||||
frc::sim::DriverStationSim::SetJoystickPOVCount(1, std::get<2>(GetParam()));
|
||||
frc::sim::DriverStationSim::SetJoystickAxesMaximumIndex(
|
||||
1, std::get<0>(GetParam()));
|
||||
frc::sim::DriverStationSim::SetJoystickButtonsMaximumIndex(
|
||||
1, std::get<1>(GetParam()));
|
||||
frc::sim::DriverStationSim::SetJoystickPOVsMaximumIndex(
|
||||
1, std::get<2>(GetParam()));
|
||||
frc::sim::DriverStationSim::NotifyNewData();
|
||||
|
||||
ASSERT_EQ(std::get<3>(GetParam()),
|
||||
@@ -64,13 +66,13 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
std::make_tuple(false, true, true, ""),
|
||||
std::make_tuple(
|
||||
false, false, false,
|
||||
"Warning: Joystick Button 1 missing (max 0), check if all "
|
||||
"Warning: Joystick Button 1 missing (available 0), check if all "
|
||||
"controllers are plugged in\n"),
|
||||
std::make_tuple(
|
||||
true, true, false,
|
||||
"Warning: Joystick Button 1 missing (max 0), check if all "
|
||||
"Warning: Joystick Button 1 missing (available 0), check if all "
|
||||
"controllers are plugged in\n"),
|
||||
std::make_tuple(
|
||||
true, false, false,
|
||||
"Warning: Joystick Button 1 missing (max 0), check if all "
|
||||
"Warning: Joystick Button 1 missing (available 0), check if all "
|
||||
"controllers are plugged in\n")));
|
||||
|
||||
Reference in New Issue
Block a user