mirror of
https://github.com/PhotonVision/photonvision
synced 2026-07-06 03:31: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
|
// network table stuff
|
||||||
private final NetworkTable defaultTable;
|
private final NetworkTable defaultTable;
|
||||||
private NetworkTableEntry ntPipelineEntry;
|
private NetworkTableEntry ntPipelineEntry;
|
||||||
private NetworkTableEntry ntDriverModeEntry;
|
public NetworkTableEntry ntDriverModeEntry;
|
||||||
private int ntDriveModeListenerID;
|
private int ntDriveModeListenerID;
|
||||||
private int ntPipelineListenerID;
|
private int ntPipelineListenerID;
|
||||||
private NetworkTableEntry ntYawEntry;
|
private NetworkTableEntry ntYawEntry;
|
||||||
@@ -131,6 +131,15 @@ public class VisionProcess {
|
|||||||
pipelineManager.setCurrentPipeline(wantedPipelineIndex);
|
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) {
|
private void updateUI(CVPipelineResult data) {
|
||||||
if(cameraCapture.getProperties().name.equals(ConfigManager.settings.currentCamera)) {
|
if(cameraCapture.getProperties().name.equals(ConfigManager.settings.currentCamera)) {
|
||||||
HashMap<String, Object> WebSend = new HashMap<>();
|
HashMap<String, Object> WebSend = new HashMap<>();
|
||||||
|
|||||||
@@ -109,8 +109,14 @@ public class PipelineManager {
|
|||||||
CVPipeline newPipeline;
|
CVPipeline newPipeline;
|
||||||
if (index == DRIVERMODE_INDEX) {
|
if (index == DRIVERMODE_INDEX) {
|
||||||
newPipeline = driverModePipeline;
|
newPipeline = driverModePipeline;
|
||||||
|
|
||||||
|
// if we're changing into driver mode, try to set the nt entry to frue
|
||||||
|
parentProcess.setDriverModeEntry(true);
|
||||||
} else {
|
} else {
|
||||||
newPipeline = pipelines.get(index);
|
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) {
|
if (newPipeline != null) {
|
||||||
lastPipelineIndex = currentPipelineIndex;
|
lastPipelineIndex = currentPipelineIndex;
|
||||||
|
|||||||
Reference in New Issue
Block a user