mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-21 01:01:41 +00:00
Update NetworkTable driver mode entry on UI change
This commit is contained in:
@@ -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<>();
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user