Update NetworkTable driver mode entry on UI change

This commit is contained in:
Matt
2019-11-30 20:29:14 -08:00
parent 004e1d380a
commit 2eea85c622
2 changed files with 16 additions and 1 deletions

View File

@@ -37,7 +37,7 @@ public class VisionProcess {
// network table stuff
private final NetworkTable defaultTable;
private NetworkTableEntry ntPipelineEntry;
private NetworkTableEntry ntDriverModeEntry;
public NetworkTableEntry ntDriverModeEntry;
private int ntDriveModeListenerID;
private int ntPipelineListenerID;
private NetworkTableEntry ntYawEntry;
@@ -131,6 +131,15 @@ public class VisionProcess {
pipelineManager.setCurrentPipeline(wantedPipelineIndex);
}
public void setDriverModeEntry(boolean isDriverMode) {
// if it's null, we haven't even started the program yet, so just return
// otherwise, set it.
if(ntDriverModeEntry != null) {
ntDriverModeEntry.setBoolean(isDriverMode);
}
}
private void updateUI(CVPipelineResult data) {
if(cameraCapture.getProperties().name.equals(ConfigManager.settings.currentCamera)) {
HashMap<String, Object> WebSend = new HashMap<>();

View File

@@ -109,8 +109,14 @@ public class PipelineManager {
CVPipeline newPipeline;
if (index == DRIVERMODE_INDEX) {
newPipeline = driverModePipeline;
// if we're changing into driver mode, try to set the nt entry to frue
parentProcess.setDriverModeEntry(true);
} else {
newPipeline = pipelines.get(index);
// if we're switching out of driver mode, try to set the nt entry to false
parentProcess.setDriverModeEntry(false);
}
if (newPipeline != null) {
lastPipelineIndex = currentPipelineIndex;