mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
[build] Apply spotless for java formatting (#1768)
Update checkstyle config to be compatible with spotless. Co-authored-by: Austin Shalit <austinshalit@gmail.com>
This commit is contained in:
@@ -24,41 +24,43 @@ public class MockDS {
|
||||
|
||||
@SuppressWarnings("MissingJavadocMethod")
|
||||
public void start() {
|
||||
m_thread = new Thread(() -> {
|
||||
DatagramSocket socket;
|
||||
try {
|
||||
socket = new DatagramSocket();
|
||||
} catch (SocketException e1) {
|
||||
// TODO Auto-generated catch block
|
||||
e1.printStackTrace();
|
||||
return;
|
||||
}
|
||||
InetSocketAddress addr = new InetSocketAddress("127.0.0.1", 1110);
|
||||
byte[] sendData = new byte[6];
|
||||
DatagramPacket packet = new DatagramPacket(sendData, 0, 6, addr);
|
||||
short sendCount = 0;
|
||||
int initCount = 0;
|
||||
while (!Thread.currentThread().isInterrupted()) {
|
||||
try {
|
||||
Thread.sleep(20);
|
||||
generateEnabledDsPacket(sendData, sendCount++);
|
||||
// ~50 disabled packets are required to make the robot actually enable
|
||||
// 1 is definitely not enough.
|
||||
if (initCount < 50) {
|
||||
initCount++;
|
||||
sendData[3] = 0;
|
||||
}
|
||||
packet.setData(sendData);
|
||||
socket.send(packet);
|
||||
} catch (InterruptedException ex) {
|
||||
Thread.currentThread().interrupt();
|
||||
} catch (IOException ex) {
|
||||
// TODO Auto-generated catch block
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
socket.close();
|
||||
});
|
||||
m_thread =
|
||||
new Thread(
|
||||
() -> {
|
||||
DatagramSocket socket;
|
||||
try {
|
||||
socket = new DatagramSocket();
|
||||
} catch (SocketException e1) {
|
||||
// TODO Auto-generated catch block
|
||||
e1.printStackTrace();
|
||||
return;
|
||||
}
|
||||
InetSocketAddress addr = new InetSocketAddress("127.0.0.1", 1110);
|
||||
byte[] sendData = new byte[6];
|
||||
DatagramPacket packet = new DatagramPacket(sendData, 0, 6, addr);
|
||||
short sendCount = 0;
|
||||
int initCount = 0;
|
||||
while (!Thread.currentThread().isInterrupted()) {
|
||||
try {
|
||||
Thread.sleep(20);
|
||||
generateEnabledDsPacket(sendData, sendCount++);
|
||||
// ~50 disabled packets are required to make the robot actually enable
|
||||
// 1 is definitely not enough.
|
||||
if (initCount < 50) {
|
||||
initCount++;
|
||||
sendData[3] = 0;
|
||||
}
|
||||
packet.setData(sendData);
|
||||
socket.send(packet);
|
||||
} catch (InterruptedException ex) {
|
||||
Thread.currentThread().interrupt();
|
||||
} catch (IOException ex) {
|
||||
// TODO Auto-generated catch block
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
socket.close();
|
||||
});
|
||||
// Because of the test setup in Java, this thread will not be stopped
|
||||
// So it must be a daemon thread
|
||||
m_thread.setDaemon(true);
|
||||
|
||||
Reference in New Issue
Block a user