Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
@@ -0,0 +1,25 @@
package com.acmerobotics.dashboard;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
* Build-time dashboard settings. Put the annotation on any one class in your project.
*
* <pre>
* &#64;DashboardSettings(limelightProxy = false)
* public class RobotConstants { }
* </pre>
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface DashboardSettings {
/**
* Whether the dashboard may proxy a Limelight on ports 5800-5807.
*
* @return true to allow the dashboard's Limelight proxy (the default)
*/
boolean limelightProxy() default true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@
new Mutex<>(new TreeMap<>());

private final LimelightProxyManager limelightProxyManager = new LimelightProxyManager();
private static boolean limelightProxyEnabled = true;

private static class OpModeAndStatus {
public OpMode opMode;
Expand Down Expand Up @@ -361,7 +362,7 @@
if (targetConfig.delete()) {
RobotLog.e(TAG, "Successfully deleted hardware config: " + name);
} else {
RobotLog.ee(TAG, "Failed to delete hardware config: " + name, null);

Check warning on line 365 in FtcDashboard/src/main/java/com/acmerobotics/dashboard/FtcDashboard.java

View workflow job for this annotation

GitHub Actions / build

non-varargs call of varargs method with inexact argument type for last parameter;

Check warning on line 365 in FtcDashboard/src/main/java/com/acmerobotics/dashboard/FtcDashboard.java

View workflow job for this annotation

GitHub Actions / build

non-varargs call of varargs method with inexact argument type for last parameter;
}
} else {
RobotLog.w(TAG, "Hardware config file does not exist: " + name);
Expand Down Expand Up @@ -968,6 +969,11 @@
try {
Class<?> configClass = Class.forName(className, false, classLoader);

DashboardSettings settings = configClass.getAnnotation(DashboardSettings.class);
if (settings != null && !settings.limelightProxy()) {
limelightProxyEnabled = false;
}
Comment thread
monkbroc marked this conversation as resolved.

if (!configClass.isAnnotationPresent(Config.class)
|| configClass.isAnnotationPresent(Disabled.class)) {
continue;
Expand Down Expand Up @@ -1302,7 +1308,9 @@
logcatMonitorRunnable = new LogcatMonitorRunnable();
logcatMonitorExecutor.submit(logcatMonitorRunnable);

limelightProxyManager.start();
if (limelightProxyEnabled) {
limelightProxyManager.start();
}

core.enabled = true;

Expand Down
Loading