From a4ba3435137a5ef834a6f2d1f0250afdedf15d8d Mon Sep 17 00:00:00 2001 From: Matt Date: Thu, 19 Sep 2024 23:53:24 -0700 Subject: [PATCH] Yeet (don't forget to use the correct jdk) --- .../main/native/cpp/net/TimeSyncClientServer.cpp | 1 + .../src/test/java/net/TimeSyncTest.java | 13 +++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/photon-targeting/src/main/native/cpp/net/TimeSyncClientServer.cpp b/photon-targeting/src/main/native/cpp/net/TimeSyncClientServer.cpp index 0c020aff07..96a41a8f04 100644 --- a/photon-targeting/src/main/native/cpp/net/TimeSyncClientServer.cpp +++ b/photon-targeting/src/main/native/cpp/net/TimeSyncClientServer.cpp @@ -292,6 +292,7 @@ wpi::TimeSyncClient::TimeSyncClient(std::string_view server, int remote_port, m_serverIP{server}, m_serverPort{remote_port}, m_loopDelay(ping_delay) { + fmt::println("Connecting to server at {}:{}", m_serverIP, m_serverPort); struct sockaddr_in serverAddr; uv::NameToAddr(m_serverIP, m_serverPort, &serverAddr); m_udp->Connect(serverAddr); diff --git a/photon-targeting/src/test/java/net/TimeSyncTest.java b/photon-targeting/src/test/java/net/TimeSyncTest.java index 3df7570433..b9183dc103 100644 --- a/photon-targeting/src/test/java/net/TimeSyncTest.java +++ b/photon-targeting/src/test/java/net/TimeSyncTest.java @@ -12,6 +12,7 @@ import edu.wpi.first.apriltag.jni.AprilTagJNI; import edu.wpi.first.cscore.CameraServerCvJNI; import edu.wpi.first.cscore.CameraServerJNI; +import edu.wpi.first.hal.HAL; import edu.wpi.first.hal.JNIWrapper; import edu.wpi.first.math.WPIMathJNI; import edu.wpi.first.net.WPINetJNI; @@ -60,18 +61,22 @@ public void smoketest() throws InterruptedException { assertTrue(false); } - // var server = new TimeSyncServer(5812); + HAL.initialize(1000, 0); + + var server = new TimeSyncServer(5812); var client = new TimeSyncClient("127.0.0.1", 5812, 1.0); - // server.start(); + System.err.println("Waiting: PID=" + ProcessHandle.current().pid()); + + server.start(); client.start(); for (int i = 0; i < 5; i++) { Thread.sleep(1000); - // System.out.println(client.getOffset()); + System.out.println(client.getOffset()); } - // server.stop(); + server.stop(); client.stop(); } }