mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-25 01:41:43 +00:00
Replaced const variables with constexpr (#731)
This commit is contained in:
committed by
Peter Johnson
parent
259461aee9
commit
5af0c9c101
@@ -14,12 +14,6 @@
|
||||
|
||||
using namespace frc;
|
||||
|
||||
const int ADXL345_I2C::kAddress;
|
||||
const int ADXL345_I2C::kPowerCtlRegister;
|
||||
const int ADXL345_I2C::kDataFormatRegister;
|
||||
const int ADXL345_I2C::kDataRegister;
|
||||
constexpr double ADXL345_I2C::kGsPerLSB;
|
||||
|
||||
/**
|
||||
* Constructs the ADXL345 Accelerometer over I2C.
|
||||
*
|
||||
|
||||
@@ -15,11 +15,6 @@
|
||||
|
||||
using namespace frc;
|
||||
|
||||
const int ADXL345_SPI::kPowerCtlRegister;
|
||||
const int ADXL345_SPI::kDataFormatRegister;
|
||||
const int ADXL345_SPI::kDataRegister;
|
||||
constexpr double ADXL345_SPI::kGsPerLSB;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
|
||||
@@ -20,12 +20,6 @@
|
||||
|
||||
using namespace frc;
|
||||
|
||||
const int AnalogGyro::kOversampleBits;
|
||||
const int AnalogGyro::kAverageBits;
|
||||
constexpr double AnalogGyro::kSamplesPerSecond;
|
||||
constexpr double AnalogGyro::kCalibrationSampleTime;
|
||||
constexpr double AnalogGyro::kDefaultVoltsPerDegreePerSecond;
|
||||
|
||||
/**
|
||||
* Gyro constructor using the Analog Input channel number.
|
||||
*
|
||||
|
||||
@@ -20,10 +20,6 @@
|
||||
|
||||
using namespace frc;
|
||||
|
||||
const int AnalogInput::kAccumulatorModuleNumber;
|
||||
const int AnalogInput::kAccumulatorNumChannels;
|
||||
const int AnalogInput::kAccumulatorChannels[] = {0, 1};
|
||||
|
||||
/**
|
||||
* Construct an analog input.
|
||||
*
|
||||
|
||||
@@ -32,9 +32,7 @@ struct MatchInfoData {
|
||||
|
||||
using namespace frc;
|
||||
|
||||
const double JOYSTICK_UNPLUGGED_MESSAGE_INTERVAL = 1.0;
|
||||
|
||||
const int DriverStation::kJoystickPorts;
|
||||
static constexpr double kJoystickUnpluggedMessageInterval = 1.0;
|
||||
|
||||
DriverStation::~DriverStation() {
|
||||
m_isRunning = false;
|
||||
@@ -721,7 +719,7 @@ void DriverStation::ReportJoystickUnpluggedError(llvm::StringRef message) {
|
||||
double currentTime = Timer::GetFPGATimestamp();
|
||||
if (currentTime > m_nextMessageTime) {
|
||||
ReportError(message);
|
||||
m_nextMessageTime = currentTime + JOYSTICK_UNPLUGGED_MESSAGE_INTERVAL;
|
||||
m_nextMessageTime = currentTime + kJoystickUnpluggedMessageInterval;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -734,7 +732,7 @@ void DriverStation::ReportJoystickUnpluggedWarning(llvm::StringRef message) {
|
||||
double currentTime = Timer::GetFPGATimestamp();
|
||||
if (currentTime > m_nextMessageTime) {
|
||||
ReportWarning(message);
|
||||
m_nextMessageTime = currentTime + JOYSTICK_UNPLUGGED_MESSAGE_INTERVAL;
|
||||
m_nextMessageTime = currentTime + kJoystickUnpluggedMessageInterval;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,8 +20,6 @@
|
||||
|
||||
using namespace frc;
|
||||
|
||||
const int RobotDrive::kMaxNumberOfMotors;
|
||||
|
||||
static std::shared_ptr<SpeedController> make_shared_nodelete(
|
||||
SpeedController* ptr) {
|
||||
return std::shared_ptr<SpeedController>(ptr, NullDeleter<SpeedController>());
|
||||
|
||||
@@ -19,17 +19,7 @@
|
||||
|
||||
using namespace frc;
|
||||
|
||||
// Time (sec) for the ping trigger pulse.
|
||||
constexpr double Ultrasonic::kPingTime;
|
||||
|
||||
// Priority that the ultrasonic round robin task runs.
|
||||
const int Ultrasonic::kPriority;
|
||||
|
||||
// Max time (ms) between readings.
|
||||
constexpr double Ultrasonic::kMaxUltrasonicTime;
|
||||
constexpr double Ultrasonic::kSpeedOfSoundInchesPerSec;
|
||||
|
||||
// Automatic round robin mode.
|
||||
// Automatic round robin mode
|
||||
std::atomic<bool> Ultrasonic::m_automaticEnabled{false};
|
||||
|
||||
std::set<Ultrasonic*> Ultrasonic::m_sensors;
|
||||
|
||||
Reference in New Issue
Block a user