mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-05 03:21:42 +00:00
[hal,wpilib] Rename DriverStation constants to all caps
This commit is contained in:
@@ -63,25 +63,25 @@ void HALSimWSProviderDriverStation::RegisterCallbacks() {
|
||||
[](const char* name, void* param, const struct HAL_Value* value) {
|
||||
std::string station;
|
||||
switch (static_cast<HAL_AllianceStationID>(value->data.v_enum)) {
|
||||
case HAL_AllianceStationID_kRed1:
|
||||
case HAL_ALLIANCE_STATION_RED_1:
|
||||
station = "red1";
|
||||
break;
|
||||
case HAL_AllianceStationID_kBlue1:
|
||||
case HAL_ALLIANCE_STATION_BLUE_1:
|
||||
station = "blue1";
|
||||
break;
|
||||
case HAL_AllianceStationID_kRed2:
|
||||
case HAL_ALLIANCE_STATION_RED_2:
|
||||
station = "red2";
|
||||
break;
|
||||
case HAL_AllianceStationID_kBlue2:
|
||||
case HAL_ALLIANCE_STATION_BLUE_2:
|
||||
station = "blue2";
|
||||
break;
|
||||
case HAL_AllianceStationID_kRed3:
|
||||
case HAL_ALLIANCE_STATION_RED_3:
|
||||
station = "red3";
|
||||
break;
|
||||
case HAL_AllianceStationID_kBlue3:
|
||||
case HAL_ALLIANCE_STATION_BLUE_3:
|
||||
station = "blue3";
|
||||
break;
|
||||
case HAL_AllianceStationID_kUnknown:
|
||||
case HAL_ALLIANCE_STATION_UNKNOWN:
|
||||
station = "unknown";
|
||||
break;
|
||||
}
|
||||
@@ -144,17 +144,17 @@ void HALSimWSProviderDriverStation::OnNetValueChanged(
|
||||
if ((it = json.find(">station")) != json.end()) {
|
||||
auto& station = it.value().get_ref<const std::string&>();
|
||||
if (station == "red1") {
|
||||
HALSIM_SetDriverStationAllianceStationId(HAL_AllianceStationID_kRed1);
|
||||
HALSIM_SetDriverStationAllianceStationId(HAL_ALLIANCE_STATION_RED_1);
|
||||
} else if (station == "red2") {
|
||||
HALSIM_SetDriverStationAllianceStationId(HAL_AllianceStationID_kRed2);
|
||||
HALSIM_SetDriverStationAllianceStationId(HAL_ALLIANCE_STATION_RED_2);
|
||||
} else if (station == "red3") {
|
||||
HALSIM_SetDriverStationAllianceStationId(HAL_AllianceStationID_kRed3);
|
||||
HALSIM_SetDriverStationAllianceStationId(HAL_ALLIANCE_STATION_RED_3);
|
||||
} else if (station == "blue1") {
|
||||
HALSIM_SetDriverStationAllianceStationId(HAL_AllianceStationID_kBlue1);
|
||||
HALSIM_SetDriverStationAllianceStationId(HAL_ALLIANCE_STATION_BLUE_1);
|
||||
} else if (station == "blue2") {
|
||||
HALSIM_SetDriverStationAllianceStationId(HAL_AllianceStationID_kBlue2);
|
||||
HALSIM_SetDriverStationAllianceStationId(HAL_ALLIANCE_STATION_BLUE_2);
|
||||
} else if (station == "blue3") {
|
||||
HALSIM_SetDriverStationAllianceStationId(HAL_AllianceStationID_kBlue3);
|
||||
HALSIM_SetDriverStationAllianceStationId(HAL_ALLIANCE_STATION_BLUE_3);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace wpilibws {
|
||||
extern std::atomic<bool>* gDSSocketConnected;
|
||||
|
||||
void HALSimWSProviderJoystick::Initialize(WSRegisterFunc webregisterFunc) {
|
||||
CreateProviders<HALSimWSProviderJoystick>("Joystick", HAL_kMaxJoysticks,
|
||||
CreateProviders<HALSimWSProviderJoystick>("Joystick", HAL_MAX_JOYSTICKS,
|
||||
webregisterFunc);
|
||||
}
|
||||
|
||||
@@ -106,9 +106,9 @@ void HALSimWSProviderJoystick::OnNetValueChanged(const wpi::util::json& json) {
|
||||
wpi::util::json::const_iterator it;
|
||||
if ((it = json.find(">axes")) != json.end()) {
|
||||
HAL_JoystickAxes axes{};
|
||||
wpi::util::json::size_type axesCount =
|
||||
std::min(it.value().size(),
|
||||
static_cast<wpi::util::json::size_type>(HAL_kMaxJoystickAxes));
|
||||
wpi::util::json::size_type axesCount = std::min(
|
||||
it.value().size(),
|
||||
static_cast<wpi::util::json::size_type>(HAL_MAX_JOYSTICK_AXES));
|
||||
axes.available = (1 << axesCount) - 1;
|
||||
for (wpi::util::json::size_type i = 0; i < axesCount; i++) {
|
||||
axes.axes[i] = it.value()[i];
|
||||
@@ -137,9 +137,9 @@ void HALSimWSProviderJoystick::OnNetValueChanged(const wpi::util::json& json) {
|
||||
|
||||
if ((it = json.find(">povs")) != json.end()) {
|
||||
HAL_JoystickPOVs povs{};
|
||||
wpi::util::json::size_type povsCount =
|
||||
std::min(it.value().size(),
|
||||
static_cast<wpi::util::json::size_type>(HAL_kMaxJoystickPOVs));
|
||||
wpi::util::json::size_type povsCount = std::min(
|
||||
it.value().size(),
|
||||
static_cast<wpi::util::json::size_type>(HAL_MAX_JOYSTICK_POVS));
|
||||
povs.available = (1 << povsCount) - 1;
|
||||
for (wpi::util::json::size_type i = 0; i < povsCount; i++) {
|
||||
povs.povs[i] = it.value()[i];
|
||||
|
||||
Reference in New Issue
Block a user