Fix trivial errorprone warnings (NFC) (#6135)

This commit is contained in:
David Vo
2024-01-20 15:46:38 +11:00
committed by GitHub
parent d198605562
commit a274e297cd
22 changed files with 33 additions and 36 deletions

View File

@@ -383,7 +383,7 @@ public class ADIS16448_IMU implements AutoCloseable, Sendable {
/** */
private static int toShort(int... buf) {
return (short) (((buf[0] & 0xFF) << 8) + ((buf[1] & 0xFF)));
return (short) (((buf[0] & 0xFF) << 8) + (buf[1] & 0xFF));
}
/** */

View File

@@ -453,7 +453,7 @@ public class ADIS16470_IMU implements AutoCloseable, Sendable {
* @return
*/
private static int toUShort(ByteBuffer buf) {
return (buf.getShort(0)) & 0xFFFF;
return buf.getShort(0) & 0xFFFF;
}
/**
@@ -469,7 +469,7 @@ public class ADIS16470_IMU implements AutoCloseable, Sendable {
* @return
*/
private static int toShort(int... buf) {
return (short) (((buf[0] & 0xFF) << 8) + ((buf[1] & 0xFF)));
return (short) (((buf[0] & 0xFF) << 8) + (buf[1] & 0xFF));
}
/**
@@ -693,7 +693,7 @@ public class ADIS16470_IMU implements AutoCloseable, Sendable {
private void writeRegister(int reg, int val) {
ByteBuffer buf = ByteBuffer.allocateDirect(2);
// low byte
buf.put(0, (byte) ((0x80 | reg)));
buf.put(0, (byte) (0x80 | reg));
buf.put(1, (byte) (val & 0xff));
m_spi.write(buf, 2);
// high byte

View File

@@ -84,7 +84,7 @@ public class Servo extends PWM {
degrees = kMaxServoAngle;
}
setPosition(((degrees - kMinServoAngle)) / getServoAngleRange());
setPosition((degrees - kMinServoAngle) / getServoAngleRange());
}
/**

View File

@@ -368,7 +368,7 @@ public class DifferentialDrive extends RobotDriveBase implements Sendable, AutoC
builder.setSmartDashboardType("DifferentialDrive");
builder.setActuator(true);
builder.setSafeState(this::stopMotor);
builder.addDoubleProperty("Left Motor Speed", () -> m_leftOutput, m_leftMotor::accept);
builder.addDoubleProperty("Right Motor Speed", () -> m_rightOutput, m_rightMotor::accept);
builder.addDoubleProperty("Left Motor Speed", () -> m_leftOutput, m_leftMotor);
builder.addDoubleProperty("Right Motor Speed", () -> m_rightOutput, m_rightMotor);
}
}

View File

@@ -321,13 +321,10 @@ public class MecanumDrive extends RobotDriveBase implements Sendable, AutoClosea
builder.setSmartDashboardType("MecanumDrive");
builder.setActuator(true);
builder.setSafeState(this::stopMotor);
builder.addDoubleProperty("Front Left Motor Speed", () -> m_frontLeftOutput, m_frontLeftMotor);
builder.addDoubleProperty(
"Front Left Motor Speed", () -> m_frontLeftOutput, m_frontLeftMotor::accept);
builder.addDoubleProperty(
"Front Right Motor Speed", () -> m_frontRightOutput, m_frontRightMotor::accept);
builder.addDoubleProperty(
"Rear Left Motor Speed", () -> m_rearLeftOutput, m_rearLeftMotor::accept);
builder.addDoubleProperty(
"Rear Right Motor Speed", () -> m_rearRightOutput, m_rearRightMotor::accept);
"Front Right Motor Speed", () -> m_frontRightOutput, m_frontRightMotor);
builder.addDoubleProperty("Rear Left Motor Speed", () -> m_rearLeftOutput, m_rearLeftMotor);
builder.addDoubleProperty("Rear Right Motor Speed", () -> m_rearRightOutput, m_rearRightMotor);
}
}