SCRIPT: wpiformat

This commit is contained in:
PJ Reiniger
2025-11-07 20:01:58 -05:00
committed by Peter Johnson
parent ae6bdc9d25
commit 2109161534
749 changed files with 5504 additions and 3936 deletions

View File

@@ -45,10 +45,10 @@ namespace {
template <typename Topic>
class MatchDataSenderEntry {
public:
MatchDataSenderEntry(const std::shared_ptr<wpi::nt::NetworkTable>& table,
std::string_view key,
typename Topic::ParamType initialVal,
wpi::util::json topicProperties = wpi::util::json::object())
MatchDataSenderEntry(
const std::shared_ptr<wpi::nt::NetworkTable>& table, std::string_view key,
typename Topic::ParamType initialVal,
wpi::util::json topicProperties = wpi::util::json::object())
: publisher{Topic{table->GetTopic(key)}.PublishEx(Topic::kTypeString,
topicProperties)},
prevVal{initialVal} {
@@ -80,13 +80,17 @@ struct MatchDataSender {
MatchDataSenderEntry<wpi::nt::StringTopic> gameSpecificMessage{
table, "GameSpecificMessage", ""};
MatchDataSenderEntry<wpi::nt::StringTopic> eventName{table, "EventName", ""};
MatchDataSenderEntry<wpi::nt::IntegerTopic> matchNumber{table, "MatchNumber", 0};
MatchDataSenderEntry<wpi::nt::IntegerTopic> replayNumber{table, "ReplayNumber", 0};
MatchDataSenderEntry<wpi::nt::IntegerTopic> matchNumber{table, "MatchNumber",
0};
MatchDataSenderEntry<wpi::nt::IntegerTopic> replayNumber{table,
"ReplayNumber", 0};
MatchDataSenderEntry<wpi::nt::IntegerTopic> matchType{table, "MatchType", 0};
MatchDataSenderEntry<wpi::nt::BooleanTopic> alliance{table, "IsRedAlliance", true};
MatchDataSenderEntry<wpi::nt::IntegerTopic> station{table, "StationNumber", 1};
MatchDataSenderEntry<wpi::nt::IntegerTopic> controlWord{table, "FMSControlData",
0};
MatchDataSenderEntry<wpi::nt::BooleanTopic> alliance{table, "IsRedAlliance",
true};
MatchDataSenderEntry<wpi::nt::IntegerTopic> station{table, "StationNumber",
1};
MatchDataSenderEntry<wpi::nt::IntegerTopic> controlWord{table,
"FMSControlData", 0};
};
class JoystickLogSender {
@@ -206,7 +210,8 @@ bool DriverStation::GetStickButton(int stick, int button) {
return false;
}
if (button < 0 || button >= 64) {
WPILIB_ReportError(warn::BadJoystickIndex, "button {} out of range", button);
WPILIB_ReportError(warn::BadJoystickIndex, "button {} out of range",
button);
return false;
}
@@ -234,7 +239,8 @@ std::optional<bool> DriverStation::GetStickButtonIfAvailable(int stick,
return false;
}
if (button < 0 || button >= 64) {
WPILIB_ReportError(warn::BadJoystickIndex, "button {} out of range", button);
WPILIB_ReportError(warn::BadJoystickIndex, "button {} out of range",
button);
return false;
}
@@ -256,7 +262,8 @@ bool DriverStation::GetStickButtonPressed(int stick, int button) {
return false;
}
if (button < 0 || button >= 64) {
WPILIB_ReportError(warn::BadJoystickIndex, "button {} out of range", button);
WPILIB_ReportError(warn::BadJoystickIndex, "button {} out of range",
button);
return false;
}
@@ -289,7 +296,8 @@ bool DriverStation::GetStickButtonReleased(int stick, int button) {
return false;
}
if (button < 0 || button >= 64) {
WPILIB_ReportError(warn::BadJoystickIndex, "button {} out of range", button);
WPILIB_ReportError(warn::BadJoystickIndex, "button {} out of range",
button);
return false;
}