From 56b758320fafce9bae7d6f412238ba7a05b82513 Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Mon, 13 Mar 2023 21:27:52 -0700 Subject: [PATCH] [wpilib] DataLogManager: increase time for datetime to be valid (#5185) There's no signal from NetComm as to when it is valid, and 1 second seems to be marginal. Increase to 6 seconds for just DS, 5 seconds for FMS attached. --- wpilibc/src/main/native/cpp/DataLogManager.cpp | 4 ++-- .../src/main/java/edu/wpi/first/wpilibj/DataLogManager.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/wpilibc/src/main/native/cpp/DataLogManager.cpp b/wpilibc/src/main/native/cpp/DataLogManager.cpp index 0dc611d17d..bd5e50bc54 100644 --- a/wpilibc/src/main/native/cpp/DataLogManager.cpp +++ b/wpilibc/src/main/native/cpp/DataLogManager.cpp @@ -186,7 +186,7 @@ void Thread::Main() { } else { dsAttachCount = 0; } - if (dsAttachCount > 50) { // 1 second + if (dsAttachCount > 300) { // 6 seconds std::time_t now = std::time(nullptr); auto tm = std::gmtime(&now); if (tm->tm_year > 100) { @@ -207,7 +207,7 @@ void Thread::Main() { } else { fmsAttachCount = 0; } - if (fmsAttachCount > 100) { // 2 seconds + if (fmsAttachCount > 250) { // 5 seconds // match info comes through TCP, so we need to double-check we've // actually received it auto matchType = DriverStation::GetMatchType(); diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/DataLogManager.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/DataLogManager.java index 927c14d16a..76f8f7cddb 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/DataLogManager.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/DataLogManager.java @@ -316,7 +316,7 @@ public final class DataLogManager { } else { dsAttachCount = 0; } - if (dsAttachCount > 50) { // 1 second + if (dsAttachCount > 300) { // 6 seconds LocalDateTime now = LocalDateTime.now(m_utc); if (now.getYear() > 2000) { // assume local clock is now synchronized to DS, so rename based on @@ -336,7 +336,7 @@ public final class DataLogManager { } else { fmsAttachCount = 0; } - if (fmsAttachCount > 100) { // 2 seconds + if (fmsAttachCount > 250) { // 5 seconds // match info comes through TCP, so we need to double-check we've // actually received it DriverStation.MatchType matchType = DriverStation.getMatchType();