Clean up unit UDL usage (#6961)

This commit is contained in:
Tyler Veness
2024-08-14 10:44:00 -07:00
committed by GitHub
parent 70fa41c69e
commit 8e0d9ac805
25 changed files with 57 additions and 77 deletions

View File

@@ -818,7 +818,7 @@ units::degree_t ADIS16470_IMU::GetAngle(IMUAxis axis) const {
break;
}
return units::degree_t{0.0};
return 0_deg;
}
units::degrees_per_second_t ADIS16470_IMU::GetRate(IMUAxis axis) const {

View File

@@ -264,7 +264,7 @@ void PneumaticsControlModule::UnreserveCompressor() {
}
units::volt_t PneumaticsControlModule::GetAnalogVoltage(int channel) const {
return units::volt_t{0};
return 0_V;
}
units::pounds_per_square_inch_t PneumaticsControlModule::GetPressure(

View File

@@ -45,7 +45,7 @@ Tachometer::~Tachometer() {
units::hertz_t Tachometer::GetFrequency() const {
auto period = GetPeriod();
if (period.value() == 0) {
return units::hertz_t{0.0};
return 0_Hz;
}
return 1 / period;
}
@@ -67,11 +67,11 @@ void Tachometer::SetEdgesPerRevolution(int edges) {
units::turns_per_second_t Tachometer::GetRevolutionsPerSecond() const {
auto period = GetPeriod();
if (period.value() == 0) {
return units::turns_per_second_t{0.0};
return 0_tps;
}
int edgesPerRevolution = GetEdgesPerRevolution();
if (edgesPerRevolution == 0) {
return units::turns_per_second_t{0.0};
return 0_tps;
}
auto rotationHz = ((1.0 / edgesPerRevolution) / period);
return units::turns_per_second_t{rotationHz.value()};