mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[hal,wpilib] Rename DriverStation constants to all caps
This commit is contained in:
@@ -120,9 +120,9 @@ void hal::InitializeDashboardOpMode() {
|
||||
|
||||
void hal::SetDashboardOpModeOptions(std::span<const HAL_OpModeOption> options) {
|
||||
std::scoped_lock lock{gInstance->mutex};
|
||||
gInstance->autoOpModes.SetOptions(options, HAL_ROBOTMODE_AUTONOMOUS);
|
||||
gInstance->teleopOpModes.SetOptions(options, HAL_ROBOTMODE_TELEOPERATED);
|
||||
gInstance->testOpModes.SetOptions(options, HAL_ROBOTMODE_TEST);
|
||||
gInstance->autoOpModes.SetOptions(options, HAL_ROBOT_MODE_AUTONOMOUS);
|
||||
gInstance->teleopOpModes.SetOptions(options, HAL_ROBOT_MODE_TELEOPERATED);
|
||||
gInstance->testOpModes.SetOptions(options, HAL_ROBOT_MODE_TEST);
|
||||
}
|
||||
|
||||
void hal::StartDashboardOpMode() {
|
||||
@@ -150,11 +150,11 @@ int64_t hal::GetDashboardSelectedOpMode(HAL_RobotMode robotMode) {
|
||||
}
|
||||
std::scoped_lock lock{gInstance->mutex};
|
||||
switch (robotMode) {
|
||||
case HAL_ROBOTMODE_AUTONOMOUS:
|
||||
case HAL_ROBOT_MODE_AUTONOMOUS:
|
||||
return gInstance->autoOpModes.GetSelected();
|
||||
case HAL_ROBOTMODE_TELEOPERATED:
|
||||
case HAL_ROBOT_MODE_TELEOPERATED:
|
||||
return gInstance->teleopOpModes.GetSelected();
|
||||
case HAL_ROBOTMODE_TEST:
|
||||
case HAL_ROBOT_MODE_TEST:
|
||||
return gInstance->testOpModes.GetSelected();
|
||||
default:
|
||||
return 0;
|
||||
|
||||
@@ -17,32 +17,35 @@
|
||||
#include "wpi/util/jni_util.hpp"
|
||||
|
||||
static_assert(
|
||||
org_wpilib_hardware_hal_DriverStationJNI_kUnknownAllianceStation ==
|
||||
HAL_AllianceStationID_kUnknown);
|
||||
static_assert(org_wpilib_hardware_hal_DriverStationJNI_kRed1AllianceStation ==
|
||||
HAL_AllianceStationID_kRed1);
|
||||
static_assert(org_wpilib_hardware_hal_DriverStationJNI_kRed2AllianceStation ==
|
||||
HAL_AllianceStationID_kRed2);
|
||||
static_assert(org_wpilib_hardware_hal_DriverStationJNI_kRed3AllianceStation ==
|
||||
HAL_AllianceStationID_kRed3);
|
||||
static_assert(org_wpilib_hardware_hal_DriverStationJNI_kBlue1AllianceStation ==
|
||||
HAL_AllianceStationID_kBlue1);
|
||||
static_assert(org_wpilib_hardware_hal_DriverStationJNI_kBlue2AllianceStation ==
|
||||
HAL_AllianceStationID_kBlue2);
|
||||
static_assert(org_wpilib_hardware_hal_DriverStationJNI_kBlue3AllianceStation ==
|
||||
HAL_AllianceStationID_kBlue3);
|
||||
|
||||
static_assert(org_wpilib_hardware_hal_DriverStationJNI_kMaxJoystickAxes ==
|
||||
HAL_kMaxJoystickAxes);
|
||||
static_assert(org_wpilib_hardware_hal_DriverStationJNI_kMaxJoystickPOVs ==
|
||||
HAL_kMaxJoystickPOVs);
|
||||
static_assert(org_wpilib_hardware_hal_DriverStationJNI_kMaxJoysticks ==
|
||||
HAL_kMaxJoysticks);
|
||||
static_assert(org_wpilib_hardware_hal_DriverStationJNI_kMaxJoystickTouchpads ==
|
||||
HAL_kMaxJoystickTouchpads);
|
||||
org_wpilib_hardware_hal_DriverStationJNI_ALLIANCE_STATION_UNKNOWN ==
|
||||
HAL_ALLIANCE_STATION_UNKNOWN);
|
||||
static_assert(org_wpilib_hardware_hal_DriverStationJNI_ALLIANCE_STATION_RED_1 ==
|
||||
HAL_ALLIANCE_STATION_RED_1);
|
||||
static_assert(org_wpilib_hardware_hal_DriverStationJNI_ALLIANCE_STATION_RED_2 ==
|
||||
HAL_ALLIANCE_STATION_RED_2);
|
||||
static_assert(org_wpilib_hardware_hal_DriverStationJNI_ALLIANCE_STATION_RED_3 ==
|
||||
HAL_ALLIANCE_STATION_RED_3);
|
||||
static_assert(
|
||||
org_wpilib_hardware_hal_DriverStationJNI_kMaxJoystickTouchpadFingers ==
|
||||
HAL_kMaxJoystickTouchpadFingers);
|
||||
org_wpilib_hardware_hal_DriverStationJNI_ALLIANCE_STATION_BLUE_1 ==
|
||||
HAL_ALLIANCE_STATION_BLUE_1);
|
||||
static_assert(
|
||||
org_wpilib_hardware_hal_DriverStationJNI_ALLIANCE_STATION_BLUE_2 ==
|
||||
HAL_ALLIANCE_STATION_BLUE_2);
|
||||
static_assert(
|
||||
org_wpilib_hardware_hal_DriverStationJNI_ALLIANCE_STATION_BLUE_3 ==
|
||||
HAL_ALLIANCE_STATION_BLUE_3);
|
||||
|
||||
static_assert(org_wpilib_hardware_hal_DriverStationJNI_MAX_JOYSTICK_AXES ==
|
||||
HAL_MAX_JOYSTICK_AXES);
|
||||
static_assert(org_wpilib_hardware_hal_DriverStationJNI_MAX_JOYSTICK_POVS ==
|
||||
HAL_MAX_JOYSTICK_POVS);
|
||||
static_assert(org_wpilib_hardware_hal_DriverStationJNI_MAX_JOYSTICKS ==
|
||||
HAL_MAX_JOYSTICKS);
|
||||
static_assert(org_wpilib_hardware_hal_DriverStationJNI_MAX_JOYSTICK_TOUCHPADS ==
|
||||
HAL_MAX_JOYSTICK_TOUCHPADS);
|
||||
static_assert(
|
||||
org_wpilib_hardware_hal_DriverStationJNI_MAX_JOYSTICK_TOUCHPAD_FINGERS ==
|
||||
HAL_MAX_JOYSTICK_TOUCHPAD_FINGERS);
|
||||
|
||||
using namespace wpi::hal;
|
||||
using namespace wpi::util::java;
|
||||
|
||||
@@ -485,7 +485,7 @@ Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_setJoystickAxes
|
||||
auto arrayRef = jArrayRef.array();
|
||||
auto arraySize = arrayRef.size();
|
||||
int maxCount =
|
||||
arraySize < HAL_kMaxJoystickAxes ? arraySize : HAL_kMaxJoystickAxes;
|
||||
arraySize < HAL_MAX_JOYSTICK_AXES ? arraySize : HAL_MAX_JOYSTICK_AXES;
|
||||
axes.available = availableAxes;
|
||||
for (int i = 0; i < maxCount; i++) {
|
||||
axes.axes[i] = arrayRef[i];
|
||||
@@ -511,7 +511,7 @@ Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_setJoystickPOVs
|
||||
auto arrayRef = jArrayRef.array();
|
||||
auto arraySize = arrayRef.size();
|
||||
int maxCount =
|
||||
arraySize < HAL_kMaxJoystickPOVs ? arraySize : HAL_kMaxJoystickPOVs;
|
||||
arraySize < HAL_MAX_JOYSTICK_POVS ? arraySize : HAL_MAX_JOYSTICK_POVS;
|
||||
povs.available = availablePovs;
|
||||
for (int i = 0; i < maxCount; i++) {
|
||||
povs.povs[i] = static_cast<HAL_JoystickPOV>(arrayRef[i]);
|
||||
|
||||
Reference in New Issue
Block a user