Skip to content

Commit

Permalink
FIxups to not request unrealistic framerates (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
gerth2 authored Jul 21, 2024
1 parent fb1eafb commit ab99c9f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
22 changes: 8 additions & 14 deletions src/camera_grabber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,27 +178,21 @@ void CameraGrabber::setControls(libcamera::Request *request) {
} else {
controls_.set(controls::AeExposureMode, controls::ExposureShort);
}

// 1/fps=seconds
// seconds * 1e6 = uS
constexpr const int MIN_FRAME_TIME = 1e6 / 250;
constexpr const int MAX_FRAME_TIME = 1e6 / 15;
controls_.set(libcamera::controls::FrameDurationLimits,
libcamera::Span<const int64_t, 2>{
{MIN_FRAME_TIME, MAX_FRAME_TIME}});
} else {
controls_.set(controls::AeEnable,
false); // Auto exposure disabled
controls_.set(controls::ExposureTime,
m_settings.exposureTimeUs); // in microseconds
controls_.set(
libcamera::controls::FrameDurationLimits,
libcamera::Span<const int64_t, 2>{
{m_settings.exposureTimeUs,
m_settings.exposureTimeUs}}); // Set default to zero, we have
// specified the exposure time
}

// 1/fps=seconds
// seconds * 1e6 = uS
constexpr const int MIN_FRAME_TIME = 1e6 / 120;
constexpr const int MAX_FRAME_TIME = 1e6 / 1;
controls_.set(libcamera::controls::FrameDurationLimits,
libcamera::Span<const int64_t, 2>{
{MIN_FRAME_TIME, MAX_FRAME_TIME}});

controls_.set(controls::ExposureValue, 0);

if (m_model != OV7251 && m_model != OV9281) {
Expand Down
1 change: 0 additions & 1 deletion src/camera_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
static const CameraModel grayScaleCameras[] = {OV9281};

CameraModel stringToModel(const std::string &model) {
std::printf("Checking model: %s\n", model.c_str());
const char *famname = model.c_str();
if (!strcmp(famname, "ov5647"))
return OV5647;
Expand Down

0 comments on commit ab99c9f

Please sign in to comment.