mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
SCRIPT: wpiformat
This commit is contained in:
committed by
Peter Johnson
parent
ae6bdc9d25
commit
2109161534
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user