mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-21 01:01:41 +00:00
Reset network tables on camera rename
This commit is contained in:
@@ -91,6 +91,13 @@ public class VisionProcess {
|
||||
initNT(newTable);
|
||||
}
|
||||
|
||||
public void setCameraName(String newName) {
|
||||
var newTable = NetworkTableInstance.getDefault().getTable("/chameleon-vision/" + newName);
|
||||
resetNT(newTable);
|
||||
pipelineManager.renameCurrentPipeline(newName);
|
||||
pipelineManager.ntIndexEntry = ntPipelineEntry;
|
||||
}
|
||||
|
||||
private void initNT(NetworkTable newTable) {
|
||||
ntPipelineEntry = newTable.getEntry("pipeline");
|
||||
ntDriverModeEntry = newTable.getEntry("driver_mode");
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.chameleonvision.vision.pipeline.CVPipelineSettings;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import edu.wpi.first.networktables.NetworkTable;
|
||||
import io.javalin.websocket.WsBinaryMessageContext;
|
||||
import io.javalin.websocket.WsCloseContext;
|
||||
import io.javalin.websocket.WsConnectContext;
|
||||
@@ -71,7 +72,7 @@ public class SocketHandler {
|
||||
break;
|
||||
}
|
||||
case "changePipelineName": {
|
||||
currentProcess.pipelineManager.renameCurrentPipeline((String) entry.getValue());
|
||||
currentProcess.setCameraName((String) entry.getValue());
|
||||
sendFullSettings();
|
||||
VisionManager.saveCurrentCameraPipelines();
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user