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:
@@ -76,7 +76,9 @@ void DutyCycleEncoder::Init() {
|
||||
}
|
||||
|
||||
units::turn_t DutyCycleEncoder::Get() const {
|
||||
if (m_simPosition) return units::turn_t{m_simPosition.Get()};
|
||||
if (m_simPosition) {
|
||||
return units::turn_t{m_simPosition.Get()};
|
||||
}
|
||||
|
||||
// As the values are not atomic, keep trying until we get 2 reads of the same
|
||||
// value If we don't within 10 attempts, error
|
||||
@@ -116,12 +118,16 @@ int DutyCycleEncoder::GetFrequency() const {
|
||||
}
|
||||
|
||||
void DutyCycleEncoder::Reset() {
|
||||
if (m_counter) m_counter->Reset();
|
||||
if (m_counter) {
|
||||
m_counter->Reset();
|
||||
}
|
||||
m_positionOffset = m_dutyCycle->GetOutput();
|
||||
}
|
||||
|
||||
bool DutyCycleEncoder::IsConnected() const {
|
||||
if (m_simIsConnected) return m_simIsConnected.Get();
|
||||
if (m_simIsConnected) {
|
||||
return m_simIsConnected.Get();
|
||||
}
|
||||
return GetFrequency() > m_frequencyThreshold;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user