mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
Add braces to C++ single-line loops and conditionals (NFC) (#2973)
This makes code easier to read and more consistent between C++ and Java. Also update clang-format settings to always add a line break (even if no braces are used).
This commit is contained in:
@@ -421,7 +421,9 @@ bool DriverStation::IsNewControlData() const {
|
||||
std::unique_lock lock(m_waitForDataMutex);
|
||||
int& lastCount = GetDSLastCount();
|
||||
int currentCount = m_waitForDataCounter;
|
||||
if (lastCount == currentCount) return false;
|
||||
if (lastCount == currentCount) {
|
||||
return false;
|
||||
}
|
||||
lastCount = currentCount;
|
||||
return true;
|
||||
}
|
||||
@@ -498,7 +500,9 @@ int DriverStation::GetLocation() const {
|
||||
}
|
||||
}
|
||||
|
||||
void DriverStation::WaitForData() { WaitForData(0); }
|
||||
void DriverStation::WaitForData() {
|
||||
WaitForData(0);
|
||||
}
|
||||
|
||||
bool DriverStation::WaitForData(double timeout) {
|
||||
auto timeoutTime =
|
||||
@@ -621,16 +625,26 @@ void DriverStation::Run() {
|
||||
HAL_WaitForDSData();
|
||||
GetData();
|
||||
|
||||
if (IsDisabled()) safetyCounter = 0;
|
||||
if (IsDisabled()) {
|
||||
safetyCounter = 0;
|
||||
}
|
||||
|
||||
if (++safetyCounter >= 4) {
|
||||
MotorSafety::CheckMotors();
|
||||
safetyCounter = 0;
|
||||
}
|
||||
if (m_userInDisabled) HAL_ObserveUserProgramDisabled();
|
||||
if (m_userInAutonomous) HAL_ObserveUserProgramAutonomous();
|
||||
if (m_userInTeleop) HAL_ObserveUserProgramTeleop();
|
||||
if (m_userInTest) HAL_ObserveUserProgramTest();
|
||||
if (m_userInDisabled) {
|
||||
HAL_ObserveUserProgramDisabled();
|
||||
}
|
||||
if (m_userInAutonomous) {
|
||||
HAL_ObserveUserProgramAutonomous();
|
||||
}
|
||||
if (m_userInTeleop) {
|
||||
HAL_ObserveUserProgramTeleop();
|
||||
}
|
||||
if (m_userInTest) {
|
||||
HAL_ObserveUserProgramTest();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user