mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-27 02:01:42 +00:00
[wpilib] Report LiveWindow-enabled-in-test (#6158)
This commit is contained in:
@@ -45,6 +45,7 @@ kADXL345_I2C = 2
|
||||
kCommand_Scheduler = 1
|
||||
kCommand2_Scheduler = 2
|
||||
kSmartDashboard_Instance = 1
|
||||
kSmartDashboard_LiveWindow = 2
|
||||
kKinematics_DifferentialDrive = 1
|
||||
kKinematics_MecanumDrive = 2
|
||||
kKinematics_SwerveDrive = 3
|
||||
|
||||
@@ -354,6 +354,8 @@ public final class FRCNetComm {
|
||||
public static final int kCommand2_Scheduler = 2;
|
||||
/** kSmartDashboard_Instance = 1. */
|
||||
public static final int kSmartDashboard_Instance = 1;
|
||||
/** kSmartDashboard_LiveWindow = 2. */
|
||||
public static final int kSmartDashboard_LiveWindow = 2;
|
||||
/** kKinematics_DifferentialDrive = 1. */
|
||||
public static final int kKinematics_DifferentialDrive = 1;
|
||||
/** kKinematics_MecanumDrive = 2. */
|
||||
|
||||
@@ -216,6 +216,7 @@ namespace HALUsageReporting {
|
||||
kCommand_Scheduler = 1,
|
||||
kCommand2_Scheduler = 2,
|
||||
kSmartDashboard_Instance = 1,
|
||||
kSmartDashboard_LiveWindow = 2,
|
||||
kKinematics_DifferentialDrive = 1,
|
||||
kKinematics_MecanumDrive = 2,
|
||||
kKinematics_SwerveDrive = 3,
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <fmt/format.h>
|
||||
#include <hal/DriverStation.h>
|
||||
#include <hal/FRCUsageReporting.h>
|
||||
#include <networktables/NetworkTableInstance.h>
|
||||
|
||||
#include "frc/DSControlWord.h"
|
||||
@@ -97,10 +98,16 @@ void IterativeRobotBase::SetNetworkTablesFlushEnabled(bool enabled) {
|
||||
}
|
||||
|
||||
void IterativeRobotBase::EnableLiveWindowInTest(bool testLW) {
|
||||
static bool hasReported;
|
||||
if (IsTestEnabled()) {
|
||||
throw FRC_MakeError(err::IncompatibleMode,
|
||||
"Can't configure test mode while in test mode!");
|
||||
}
|
||||
if (!hasReported && testLW) {
|
||||
HAL_Report(HALUsageReporting::kResourceType_SmartDashboard,
|
||||
HALUsageReporting::kSmartDashboard_LiveWindow);
|
||||
hasReported = true;
|
||||
}
|
||||
m_lwEnabledInTest = testLW;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
package edu.wpi.first.wpilibj;
|
||||
|
||||
import edu.wpi.first.hal.DriverStationJNI;
|
||||
import edu.wpi.first.hal.FRCNetComm.tInstances;
|
||||
import edu.wpi.first.hal.FRCNetComm.tResourceType;
|
||||
import edu.wpi.first.hal.HAL;
|
||||
import edu.wpi.first.networktables.NetworkTableInstance;
|
||||
import edu.wpi.first.wpilibj.livewindow.LiveWindow;
|
||||
@@ -257,6 +259,8 @@ public abstract class IterativeRobotBase extends RobotBase {
|
||||
m_ntFlushEnabled = enabled;
|
||||
}
|
||||
|
||||
private boolean m_reportedLw;
|
||||
|
||||
/**
|
||||
* Sets whether LiveWindow operation is enabled during test mode. Calling
|
||||
*
|
||||
@@ -267,6 +271,10 @@ public abstract class IterativeRobotBase extends RobotBase {
|
||||
if (isTestEnabled()) {
|
||||
throw new ConcurrentModificationException("Can't configure test mode while in test mode!");
|
||||
}
|
||||
if (!m_reportedLw && testLW) {
|
||||
HAL.report(tResourceType.kResourceType_SmartDashboard, tInstances.kSmartDashboard_LiveWindow);
|
||||
m_reportedLw = true;
|
||||
}
|
||||
m_lwEnabledInTest = testLW;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user