Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public class NetworkTablesManager {

private NetworkTablesManager() {
ntInstance.addLogger(
LogMessage.kInfo, LogMessage.kCritical, this::logNtMessage); // to hide error messages
LogMessage.kDebug4, LogMessage.kCritical, this::logNtMessage); // to hide error messages
Comment thread
crschardt marked this conversation as resolved.
Outdated
ntInstance.addConnectionListener(true, this::checkNtConnectState); // to hide error messages

ntInstance.addListener(
Expand All @@ -104,7 +104,6 @@ private NetworkTablesManager() {

public void registerTimedTasks() {
m_timeSync.start();
TimedTaskManager.getInstance().addTask("NTManager", this::ntTick, 5000);
TimedTaskManager.getInstance()
.addTask("CheckHostnameAndCameraNames", this::checkHostnameAndCameraNames, 10000);
}
Expand Down Expand Up @@ -380,23 +379,6 @@ private void setServerMode() {
broadcastVersion();
}

// So it seems like if Photon starts before the robot NT server does, and both aren't static IP,
// it'll never connect. This hack works around it by restarting the client/server while the nt
// instance isn't connected, same as clicking the save button in the settings menu (or restarting
// the service)
private void ntTick() {
if (!ntInstance.isConnected()
&& !ConfigManager.getInstance().getConfig().getNetworkConfig().runNTServer) {
setConfig(ConfigManager.getInstance().getConfig().getNetworkConfig());
}

if (!ntInstance.isConnected() && !m_isRetryingConnection) {
m_isRetryingConnection = true;
logger.error(
"[NetworkTablesManager] Could not connect to the robot! Will retry in the background...");
}
}

public long getTimeSinceLastPong() {
return m_timeSync.getTimeSinceLastPong();
}
Expand Down
Loading