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 @@ ADXL362::ADXL362(SPI::Port port, Range range)
|
||||
}
|
||||
|
||||
void ADXL362::SetRange(Range range) {
|
||||
if (m_gsPerLSB == 0.0) return;
|
||||
if (m_gsPerLSB == 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
uint8_t commands[3];
|
||||
|
||||
@@ -100,21 +102,37 @@ void ADXL362::SetRange(Range range) {
|
||||
kFilterCtl_ODR_100Hz | static_cast<uint8_t>((range & 0x03) << 6);
|
||||
m_spi.Write(commands, 3);
|
||||
|
||||
if (m_simRange) m_simRange.Set(range);
|
||||
if (m_simRange) {
|
||||
m_simRange.Set(range);
|
||||
}
|
||||
}
|
||||
|
||||
double ADXL362::GetX() { return GetAcceleration(kAxis_X); }
|
||||
double ADXL362::GetX() {
|
||||
return GetAcceleration(kAxis_X);
|
||||
}
|
||||
|
||||
double ADXL362::GetY() { return GetAcceleration(kAxis_Y); }
|
||||
double ADXL362::GetY() {
|
||||
return GetAcceleration(kAxis_Y);
|
||||
}
|
||||
|
||||
double ADXL362::GetZ() { return GetAcceleration(kAxis_Z); }
|
||||
double ADXL362::GetZ() {
|
||||
return GetAcceleration(kAxis_Z);
|
||||
}
|
||||
|
||||
double ADXL362::GetAcceleration(ADXL362::Axes axis) {
|
||||
if (m_gsPerLSB == 0.0) return 0.0;
|
||||
if (m_gsPerLSB == 0.0) {
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
if (axis == kAxis_X && m_simX) return m_simX.Get();
|
||||
if (axis == kAxis_Y && m_simY) return m_simY.Get();
|
||||
if (axis == kAxis_Z && m_simZ) return m_simZ.Get();
|
||||
if (axis == kAxis_X && m_simX) {
|
||||
return m_simX.Get();
|
||||
}
|
||||
if (axis == kAxis_Y && m_simY) {
|
||||
return m_simY.Get();
|
||||
}
|
||||
if (axis == kAxis_Z && m_simZ) {
|
||||
return m_simZ.Get();
|
||||
}
|
||||
|
||||
uint8_t buffer[4];
|
||||
uint8_t command[4] = {0, 0, 0, 0};
|
||||
|
||||
Reference in New Issue
Block a user