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:
@@ -51,7 +51,9 @@ void AnalogEncoder::Init() {
|
||||
}
|
||||
|
||||
units::turn_t AnalogEncoder::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
|
||||
@@ -73,7 +75,9 @@ units::turn_t AnalogEncoder::Get() const {
|
||||
return m_lastPosition;
|
||||
}
|
||||
|
||||
double AnalogEncoder::GetPositionOffset() const { return m_positionOffset; }
|
||||
double AnalogEncoder::GetPositionOffset() const {
|
||||
return m_positionOffset;
|
||||
}
|
||||
|
||||
void AnalogEncoder::SetDistancePerRotation(double distancePerRotation) {
|
||||
m_distancePerRotation = distancePerRotation;
|
||||
@@ -92,7 +96,9 @@ void AnalogEncoder::Reset() {
|
||||
m_positionOffset = m_analogInput->GetVoltage();
|
||||
}
|
||||
|
||||
int AnalogEncoder::GetChannel() const { return m_analogInput->GetChannel(); }
|
||||
int AnalogEncoder::GetChannel() const {
|
||||
return m_analogInput->GetChannel();
|
||||
}
|
||||
|
||||
void AnalogEncoder::InitSendable(SendableBuilder& builder) {
|
||||
builder.SetSmartDashboardType("AbsoluteEncoder");
|
||||
|
||||
Reference in New Issue
Block a user