[hal,wpilib] Switch to new game data (#8584)

Game data is now limited to 8 bytes, and comes through the UDP packets.
This commit is contained in:
Thad House
2026-02-06 21:38:15 -08:00
committed by GitHub
parent ac45c694f3
commit 85adbf990e
45 changed files with 820 additions and 695 deletions

View File

@@ -47,6 +47,7 @@ struct JoystickDataCache {
HAL_AllianceStationID allianceStation;
double matchTime;
HAL_ControlWord controlWord;
HAL_GameData gameData;
};
static_assert(std::is_standard_layout_v<JoystickDataCache>);
// static_assert(std::is_trivial_v<JoystickDataCache>);
@@ -75,6 +76,7 @@ void JoystickDataCache::Update() {
SimDriverStationData->opMode, SimDriverStationData->robotMode,
SimDriverStationData->enabled, SimDriverStationData->eStop,
SimDriverStationData->fmsAttached, SimDriverStationData->dsAttached);
SimDriverStationData->GetGameData(&gameData);
}
#define CHECK_JOYSTICK_NUMBER(stickNum) \
@@ -345,6 +347,15 @@ int32_t HAL_GetJoystickGamepadType(int32_t joystickNum) {
}
}
int32_t HAL_GetGameData(HAL_GameData* gameData) {
if (gShutdown) {
return INCOMPATIBLE_STATE;
}
std::scoped_lock lock{driverStation->cacheMutex};
*gameData = currentRead->gameData;
return 0;
}
int32_t HAL_GetJoystickSupportedOutputs(int32_t joystickNum) {
HAL_JoystickDescriptor joystickDesc;
if (HAL_GetJoystickDescriptor(joystickNum, &joystickDesc) < 0) {