mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-26 01:51:41 +00:00
[wpilib] DriverStation: Change alliance station to use optional (#5229)
Many teams have issues trying to read the DS too early. By switching to an optional, we cause teams to check 2 things. Either 1) they explicitly check, and their code is correct, or 2) they just read .value() and their code reboots in a loop. However, because the DS will eventually connect, this 2nd case is ok, and should theoretically be undetectable on the field.
This commit is contained in:
@@ -15,7 +15,27 @@
|
||||
#include "hal/FRCUsageReporting.h"
|
||||
#include "hal/HALBase.h"
|
||||
|
||||
// TODO Static asserts
|
||||
static_assert(edu_wpi_first_hal_DriverStationJNI_kUnknownAllianceStation ==
|
||||
HAL_AllianceStationID_kUnknown);
|
||||
static_assert(edu_wpi_first_hal_DriverStationJNI_kRed1AllianceStation ==
|
||||
HAL_AllianceStationID_kRed1);
|
||||
static_assert(edu_wpi_first_hal_DriverStationJNI_kRed2AllianceStation ==
|
||||
HAL_AllianceStationID_kRed2);
|
||||
static_assert(edu_wpi_first_hal_DriverStationJNI_kRed3AllianceStation ==
|
||||
HAL_AllianceStationID_kRed3);
|
||||
static_assert(edu_wpi_first_hal_DriverStationJNI_kBlue1AllianceStation ==
|
||||
HAL_AllianceStationID_kBlue1);
|
||||
static_assert(edu_wpi_first_hal_DriverStationJNI_kBlue2AllianceStation ==
|
||||
HAL_AllianceStationID_kBlue2);
|
||||
static_assert(edu_wpi_first_hal_DriverStationJNI_kBlue3AllianceStation ==
|
||||
HAL_AllianceStationID_kBlue3);
|
||||
|
||||
static_assert(edu_wpi_first_hal_DriverStationJNI_kMaxJoystickAxes ==
|
||||
HAL_kMaxJoystickAxes);
|
||||
static_assert(edu_wpi_first_hal_DriverStationJNI_kMaxJoystickPOVs ==
|
||||
HAL_kMaxJoystickPOVs);
|
||||
static_assert(edu_wpi_first_hal_DriverStationJNI_kMaxJoysticks ==
|
||||
HAL_kMaxJoysticks);
|
||||
|
||||
using namespace hal;
|
||||
using namespace wpi::java;
|
||||
|
||||
@@ -42,6 +42,7 @@ typedef struct HAL_ControlWord HAL_ControlWord;
|
||||
|
||||
// clang-format off
|
||||
HAL_ENUM(HAL_AllianceStationID) {
|
||||
HAL_AllianceStationID_kUnknown = 0,
|
||||
HAL_AllianceStationID_kRed1,
|
||||
HAL_AllianceStationID_kRed2,
|
||||
HAL_AllianceStationID_kRed3,
|
||||
@@ -51,7 +52,7 @@ HAL_ENUM(HAL_AllianceStationID) {
|
||||
};
|
||||
|
||||
HAL_ENUM(HAL_MatchType) {
|
||||
HAL_kMatchType_none,
|
||||
HAL_kMatchType_none = 0,
|
||||
HAL_kMatchType_practice,
|
||||
HAL_kMatchType_qualification,
|
||||
HAL_kMatchType_elimination,
|
||||
|
||||
Reference in New Issue
Block a user