mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-19 00:41:41 +00:00
Remove time source override (#1582)
This commit is contained in:
@@ -152,10 +152,9 @@ void wpi::tsp::TimeSyncClient::UdpCallback(uv::Buffer& buf, size_t nbytes,
|
||||
|
||||
wpi::tsp::TimeSyncClient::TimeSyncClient(std::string_view server,
|
||||
int remote_port,
|
||||
std::chrono::milliseconds ping_delay,
|
||||
std::function<uint64_t()> timeProvider)
|
||||
std::chrono::milliseconds ping_delay)
|
||||
: m_logger(::ClientLoggerFunc),
|
||||
m_timeProvider(timeProvider),
|
||||
m_timeProvider(nt::Now),
|
||||
m_udp{},
|
||||
m_pingTimer{},
|
||||
m_serverIP{server},
|
||||
|
||||
@@ -97,10 +97,9 @@ void wpi::tsp::TimeSyncServer::UdpCallback(uv::Buffer& data, size_t n,
|
||||
// pong.client_time, pong.server_time);
|
||||
}
|
||||
|
||||
wpi::tsp::TimeSyncServer::TimeSyncServer(int port,
|
||||
std::function<uint64_t()> timeProvider)
|
||||
wpi::tsp::TimeSyncServer::TimeSyncServer(int port)
|
||||
: m_logger{::ServerLoggerFunc},
|
||||
m_timeProvider{timeProvider},
|
||||
m_timeProvider{nt::Now},
|
||||
m_udp{},
|
||||
m_port(port) {}
|
||||
|
||||
|
||||
@@ -74,11 +74,11 @@ class TimeSyncClient {
|
||||
|
||||
std::chrono::milliseconds m_loopDelay;
|
||||
|
||||
std::mutex m_offsetMutex;
|
||||
Metadata m_metadata;
|
||||
std::mutex m_offsetMutex{};
|
||||
Metadata m_metadata{};
|
||||
|
||||
// We only allow the most recent ping to stay alive, so only keep track of it
|
||||
TspPing m_lastPing;
|
||||
TspPing m_lastPing{};
|
||||
|
||||
// 30s is a reasonable guess
|
||||
frc::MedianFilter<int64_t> m_lastOffsets{30};
|
||||
@@ -90,8 +90,7 @@ class TimeSyncClient {
|
||||
|
||||
public:
|
||||
TimeSyncClient(std::string_view server, int remote_port,
|
||||
std::chrono::milliseconds ping_delay,
|
||||
std::function<uint64_t()> timeProvider = nt::Now);
|
||||
std::chrono::milliseconds ping_delay);
|
||||
|
||||
void Start();
|
||||
void Stop();
|
||||
|
||||
@@ -62,8 +62,7 @@ class TimeSyncServer {
|
||||
unsigned flags);
|
||||
|
||||
public:
|
||||
explicit TimeSyncServer(int port = 5810,
|
||||
std::function<uint64_t()> timeProvider = nt::Now);
|
||||
explicit TimeSyncServer(int port = 5810);
|
||||
|
||||
/**
|
||||
* Start listening for pings
|
||||
|
||||
Reference in New Issue
Block a user