Make pipeline index rollback work with multiple cameras

This commit is contained in:
Declan Freeman-Gleason
2021-01-08 21:00:23 -05:00
parent 5d139e0a4e
commit 0b2de7d9f1
2 changed files with 18 additions and 10 deletions

View File

@@ -145,7 +145,7 @@ import Logs from "./views/LogsView"
},
data: () => ({
// Used so that we can switch back to the previously selected pipeline after camera calibration
previouslySelectedIndex: undefined,
previouslySelectedIndices: [],
timer: undefined,
}),
computed: {
@@ -240,15 +240,23 @@ import Logs from "./views/LogsView"
})
},
switchToDriverMode() {
this.previouslySelectedIndex = this.$store.getters.currentPipelineIndex;
this.handleInputWithIndex('currentPipeline', -1)
},
rollbackPipelineIndex() {
if (this.previouslySelectedIndex !== null) {
this.handleInputWithIndex('currentPipeline', this.previouslySelectedIndex || 0);
if (!this.previouslySelectedIndices) this.previouslySelectedIndices = [];
for (const [i, cameraSettings] of this.$store.state.cameraSettings.entries()) {
this.previouslySelectedIndices[i] = cameraSettings.currentPipelineIndex;
this.handleInputWithIndex('currentPipeline', -1, i);
}
this.previouslySelectedIndex = null;
},
rollbackPipelineIndex()
{
if (this.previouslySelectedIndices !== null) {
for (const [i] of this.$store.state.cameraSettings.entries()) {
this.handleInputWithIndex('currentPipeline', this.previouslySelectedIndices[i] || 0, i);
}
}
this.previouslySelectedIndices = null;
}
,
switchToSettingsTab() {
this.axios.post('http://' + this.$address + '/api/sendMetrics', {})
}

View File

@@ -4,10 +4,10 @@ export const dataHandleMixin = {
let msg = this.$msgPack.encode({[key]: value});
this.$socket.send(msg);
},
handleInputWithIndex(key, value) {
handleInputWithIndex(key, value, cameraIndex = this.$store.getters.currentCameraIndex) {
let msg = this.$msgPack.encode({
[key]: value,
["cameraIndex"]: this.$store.getters.currentCameraIndex
["cameraIndex"]: cameraIndex,
});
this.$socket.send(msg);
},