|
25 | 25 | import edu.wpi.first.util.PixelFormat;
|
26 | 26 | import java.util.ArrayList;
|
27 | 27 | import java.util.Arrays;
|
| 28 | +import java.util.Collections; |
28 | 29 | import java.util.HashMap;
|
29 | 30 | import java.util.List;
|
30 | 31 | import java.util.Optional;
|
| 32 | +import java.util.stream.Collectors; |
31 | 33 | import org.photonvision.common.configuration.CameraConfiguration;
|
32 | 34 | import org.photonvision.vision.camera.CameraQuirk;
|
33 | 35 | import org.photonvision.vision.processes.VisionSourceSettables;
|
@@ -287,11 +289,14 @@ private void cacheVideoModes() {
|
287 | 289 | var sortedList =
|
288 | 290 | videoModesList.stream()
|
289 | 291 | .distinct() // remove redundant video mode entries
|
290 |
| - .sorted(((a, b) -> (a.width + a.height) - (b.width + b.height))) |
291 |
| - .toList(); |
292 |
| - |
293 |
| - for (VideoMode videoMode : sortedList) { |
294 |
| - videoModes.put(sortedList.indexOf(videoMode), videoMode); |
| 292 | + .sorted(((a, b) -> (b.width + b.height) - (a.width + a.height))) |
| 293 | + .collect(Collectors.toList()); |
| 294 | + // The ordering is usually more logical when done like this. It typically puts higher FPSes |
| 295 | + // closer to the bottom. |
| 296 | + Collections.reverse(sortedList); |
| 297 | + |
| 298 | + for (int i = 0; i < sortedList.size(); i++) { |
| 299 | + videoModes.put(i, sortedList.get(i)); |
295 | 300 | }
|
296 | 301 |
|
297 | 302 | // If after all that we still have no video modes, not much we can do besides
|
|
0 commit comments