summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo@jmondi.org>2022-07-14 16:44:48 +0200
committerJacopo Mondi <jacopo@jmondi.org>2022-07-14 20:12:17 +0200
commit75f7bb99f259b54b1799f10d4704e1ff50c45915 (patch)
treeb2c4310f18909b5ef9e1c2519e9f4f03d9c391be
parent818882f8f32739006fd2993373adcde3c14146d8 (diff)
[HACK] camera_lens: Rescale position in AK7375 range
A bad hack to rescale the value computed by the AF algorithm in the lens' accepted range. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
-rw-r--r--src/libcamera/camera_lens.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libcamera/camera_lens.cpp b/src/libcamera/camera_lens.cpp
index b3d48199..b0b70bdd 100644
--- a/src/libcamera/camera_lens.cpp
+++ b/src/libcamera/camera_lens.cpp
@@ -86,8 +86,10 @@ int CameraLens::init()
*/
int CameraLens::setFocusPosition(int32_t position)
{
+ int32_t lensPosition = position * 4096 / 180;
+
ControlList lensCtrls(subdev_->controls());
- lensCtrls.set(V4L2_CID_FOCUS_ABSOLUTE, static_cast<int32_t>(position));
+ lensCtrls.set(V4L2_CID_FOCUS_ABSOLUTE, lensPosition);
if (subdev_->setControls(&lensCtrls))
return -EINVAL;