From a21ba43d3fce1d9734145c975fad091695903383 Mon Sep 17 00:00:00 2001 From: zhaohe Date: Thu, 11 Apr 2024 18:34:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=AE=E5=BA=A6=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 -- src/camera_light_src_timing_controller/clst_controler.cpp | 11 +++++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 200d587..eafefc6 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,4 @@ V4: 2.配置 地址,数值 地址,数值 - - ``` \ No newline at end of file diff --git a/src/camera_light_src_timing_controller/clst_controler.cpp b/src/camera_light_src_timing_controller/clst_controler.cpp index 1689890..b1f05c4 100644 --- a/src/camera_light_src_timing_controller/clst_controler.cpp +++ b/src/camera_light_src_timing_controller/clst_controler.cpp @@ -536,7 +536,18 @@ zaf_error_code_t CLSTControler::LightSrcX_setLightIntensityDuty(int32_t index, f uint32_t freqcnt = 0; DO_CMD(reg_read(kreg_light_ctrol_module1_light_driver_freq_cnt + (index - 1) * 32, freqcnt)); + if (duty >= 99) { + duty = 99; + } + uint32_t cnt = freqcnt * (duty / 100.0); + if (duty < 1) { + cnt = 1; + } + if (cnt >= freqcnt) { + cnt = freqcnt - 1; + } + return reg_write(kreg_light_ctrol_module1_light_intensity_cnt + (index - 1) * 32, cnt); } zaf_error_code_t CLSTControler::LightSrcX_setLightDriverFreq(int32_t index, float freq) { //