Skip to content

Commit a8d8259

Browse files
authored
Fix PipelineType index mismatch (#2204)
## Description #2180 added an additional value to PipelineType.java. Enums are serialized with `ordinal()`, and the frontend wasn't updated to account for this, causing an off-by-one error where the UI thought the pipeline was actually the next pipeline over. This resyncs the enum on the frontend to the backend and adjusts the mapping from PipelineType to WebsocketPipelineType to make everything match. Fixes #2201. closes #2202 ## Meta Merge checklist: - [x] Pull Request title is [short, imperative summary](https://cbea.ms/git-commit/) of proposed changes - [x] The description documents the _what_ and _why_ - [x] This PR has been [linted](https://docs.photonvision.org/en/latest/docs/contributing/linting.html). - [ ] If this PR changes behavior or adds a feature, user documentation is updated - [ ] If this PR touches photon-serde, all messages have been regenerated and hashes have not changed unexpectedly - [ ] If this PR touches configuration, this is backwards compatible with settings back to v2025.3.2 - [x] If this PR touches pipeline settings or anything related to data exchange, the frontend typing is updated - [ ] If this PR addresses a bug, a regression test for it is added
1 parent 63593b8 commit a8d8259

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

photon-client/src/stores/settings/CameraSettingsStore.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export const useCameraSettingsStore = defineStore("cameraSettings", {
4545
},
4646
// This method only exists due to just how lazy I am and my dislike of consolidating the pipeline type enums (which mind you, suck as is)
4747
currentWebsocketPipelineType(): WebsocketPipelineType {
48-
return this.currentPipelineType - 2;
48+
return this.currentPipelineType - 3;
4949
},
5050
currentVideoFormat(): VideoFormat {
5151
return this.currentCameraSettings.validVideoFormats[this.currentPipelineSettings.cameraVideoModeIndex];

photon-client/src/types/PipelineTypes.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
import type { WebsocketNumberPair } from "@/types/WebsocketDataTypes";
22
import type { ObjectDetectionModelProperties } from "@/types/SettingTypes";
33

4+
/**
5+
* The on-wire form of PipelineType.java (the enum is serialized with `ordinal()`)
6+
*/
47
export enum PipelineType {
5-
DriverMode = 1,
6-
Reflective = 2,
7-
ColoredShape = 3,
8-
AprilTag = 4,
9-
Aruco = 5,
10-
ObjectDetection = 6
8+
DriverMode = 2,
9+
Reflective = 3,
10+
ColoredShape = 4,
11+
AprilTag = 5,
12+
Aruco = 6,
13+
ObjectDetection = 7
1114
}
1215

1316
export enum AprilTagFamily {

0 commit comments

Comments
 (0)