Skip to content

Commit

Permalink
Limit PS3Eye to 100FPS (#218)
Browse files Browse the repository at this point in the history
This helps prevent running in to USB bandwidth issues with multiple PS3Eyes.
  • Loading branch information
Bankst authored Jan 6, 2021
1 parent b8bc65e commit 08a51fd
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,7 @@ public enum CameraQuirk {
/** Camera settable for controllable image gain */
Gain,
/** For the Raspberry Pi Camera */
PiCam
PiCam,
/** Cap at 100FPS for high-bandwidth cameras */
FPSCap100
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class QuirkyCamera {

private static final List<QuirkyCamera> quirkyCameras =
List.of(
new QuirkyCamera(0x2000, 0x1415, CameraQuirk.Gain), // PS3Eye
new QuirkyCamera(0x2000, 0x1415, CameraQuirk.Gain, CameraQuirk.FPSCap100), // PS3Eye
new QuirkyCamera(-1, -1, "mmal service 16.1", CameraQuirk.PiCam) // PiCam (via V4L2)
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,12 @@ public HashMap<Integer, VideoMode> getAllVideoModes() {
}
}

if (cameraQuirks.hasQuirk(CameraQuirk.FPSCap100)) {
if (videoMode.fps > 100) {
continue;
}
}

videoModesList.add(videoMode);

// We look for modes with the same height/width/pixelformat as this mode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public class QuirkyCameraTest {
public void ps3EyeTest() {
HashMap<CameraQuirk, Boolean> ps3EyeQuirks = new HashMap<>();
ps3EyeQuirks.put(CameraQuirk.Gain, true);
ps3EyeQuirks.put(CameraQuirk.FPSCap100, true);
for (var q : CameraQuirk.values()) {
ps3EyeQuirks.putIfAbsent(q, false);
}
Expand Down

0 comments on commit 08a51fd

Please sign in to comment.