mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
Replaced floats with doubles (#355)
This makes our APIs more consistent. With optimizations enabled, doubles are just as efficient as floats on ARMv7, so we should take advantage of the extra precision.
This commit is contained in:
committed by
Peter Johnson
parent
7bcd243ec3
commit
69422dc063
@@ -81,7 +81,7 @@ AnalogAccelerometer::AnalogAccelerometer(std::shared_ptr<AnalogInput> channel)
|
||||
*
|
||||
* @return The current acceleration of the sensor in Gs.
|
||||
*/
|
||||
float AnalogAccelerometer::GetAcceleration() const {
|
||||
double AnalogAccelerometer::GetAcceleration() const {
|
||||
return (m_analogInput->GetAverageVoltage() - m_zeroGVoltage) / m_voltsPerG;
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ float AnalogAccelerometer::GetAcceleration() const {
|
||||
*
|
||||
* @param sensitivity The sensitivity of accelerometer in Volts per G.
|
||||
*/
|
||||
void AnalogAccelerometer::SetSensitivity(float sensitivity) {
|
||||
void AnalogAccelerometer::SetSensitivity(double sensitivity) {
|
||||
m_voltsPerG = sensitivity;
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ void AnalogAccelerometer::SetSensitivity(float sensitivity) {
|
||||
*
|
||||
* @param zero The zero G voltage.
|
||||
*/
|
||||
void AnalogAccelerometer::SetZero(float zero) { m_zeroGVoltage = zero; }
|
||||
void AnalogAccelerometer::SetZero(double zero) { m_zeroGVoltage = zero; }
|
||||
|
||||
/**
|
||||
* Get the Acceleration for the PID Source parent.
|
||||
|
||||
Reference in New Issue
Block a user