[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:
Thad House
2023-07-22 15:19:28 -07:00
committed by GitHub
parent ef155438bd
commit fc56f8049a
17 changed files with 179 additions and 86 deletions

View File

@@ -84,6 +84,9 @@ void HALSimWSProviderDriverStation::RegisterCallbacks() {
case HAL_AllianceStationID_kBlue3:
station = "blue3";
break;
case HAL_AllianceStationID_kUnknown:
station = "unknown";
break;
}
static_cast<HALSimWSProviderDriverStation*>(param)->ProcessHalCallback(
{{">station", station}});