[wpilib] Rename private constants to all caps

This commit is contained in:
Peter Johnson
2026-03-17 16:35:16 -07:00
parent b7122f0fda
commit 8a802fd670
9 changed files with 24 additions and 24 deletions

View File

@@ -62,8 +62,8 @@ public final class DataLogManager {
// if less than this much free space, delete log files until there is this much free space
// OR there are this many files remaining.
private static final long kFreeSpaceThreshold = 50000000L;
private static final int kFileCountThreshold = 10;
private static final long FREE_SPACE_THRESHOLD = 50000000L;
private static final int FILE_COUNT_THRESHOLD = 10;
private DataLogManager() {}
@@ -308,7 +308,7 @@ public final class DataLogManager {
{
File logDir = new File(m_logDir);
long freeSpace = logDir.getUsableSpace();
if (freeSpace < kFreeSpaceThreshold) {
if (freeSpace < FREE_SPACE_THRESHOLD) {
// Delete oldest WPILIB_*.wpilog files (ignore WPILIB_TBD_*.wpilog as we just created one)
File[] files =
logDir.listFiles(
@@ -321,14 +321,14 @@ public final class DataLogManager {
int count = files.length;
for (File file : files) {
--count;
if (count < kFileCountThreshold) {
if (count < FILE_COUNT_THRESHOLD) {
break;
}
long length = file.length();
if (file.delete()) {
DriverStation.reportWarning("DataLogManager: Deleted " + file.getName(), false);
freeSpace += length;
if (freeSpace >= kFreeSpaceThreshold) {
if (freeSpace >= FREE_SPACE_THRESHOLD) {
break;
}
} else {
@@ -336,12 +336,12 @@ public final class DataLogManager {
}
}
}
} else if (freeSpace < 2 * kFreeSpaceThreshold) {
} else if (freeSpace < 2 * FREE_SPACE_THRESHOLD) {
DriverStation.reportWarning(
"DataLogManager: Log storage device has "
+ freeSpace / 1000000
+ " MB of free space remaining! Logs will get deleted below "
+ kFreeSpaceThreshold / 1000000
+ FREE_SPACE_THRESHOLD / 1000000
+ " MB of free space. "
+ "Consider deleting logs off the storage device.",
false);

View File

@@ -18,7 +18,7 @@ import org.wpilib.driverstation.DriverStation;
* which parts of an operation consumed the most time.
*/
public class Tracer {
private static final long kMinPrintPeriod = 1000000; // microseconds
private static final long MIN_PRINT_PERIOD = 1000000; // microseconds
private long m_lastEpochsPrintTime; // microseconds
private long m_startTime; // microseconds
@@ -72,7 +72,7 @@ public class Tracer {
*/
public void printEpochs(Consumer<String> output) {
long now = RobotController.getMonotonicTime();
if (now - m_lastEpochsPrintTime > kMinPrintPeriod) {
if (now - m_lastEpochsPrintTime > MIN_PRINT_PERIOD) {
StringBuilder sb = new StringBuilder();
m_lastEpochsPrintTime = now;
m_epochs.forEach(

View File

@@ -25,7 +25,7 @@ import org.wpilib.util.WPIUtilJNI;
*/
public class Watchdog implements Closeable, Comparable<Watchdog> {
// Used for timeout print rate-limiting
private static final long kMinPrintPeriod = (long) 1e6; // μs
private static final long MIN_PRINT_PERIOD = (long) 1e6; // μs
private double m_startTime;
private double m_timeout;
@@ -260,7 +260,7 @@ public class Watchdog implements Closeable, Comparable<Watchdog> {
Watchdog watchdog = m_watchdogs.poll();
double now = curTime * 1e-6;
if (now - watchdog.m_lastTimeoutPrint > kMinPrintPeriod) {
if (now - watchdog.m_lastTimeoutPrint > MIN_PRINT_PERIOD) {
watchdog.m_lastTimeoutPrint = now;
if (!watchdog.m_suppressTimeoutMessage) {
DriverStation.reportWarning(