zhaohe 7 months ago
parent
commit
2f37214415
  1. 4
      README.md
  2. 36
      src/camera_light_src_timing_controller/clst_controler.cpp
  3. 2
      src/version.h

4
README.md

@ -12,8 +12,8 @@ V19,20:
V22:
基于V17,调整光源亮度计算公式 为duty = 59- 0.58773 * duty;
V23:
修复回读duty值不准确的BUG
```
```

36
src/camera_light_src_timing_controller/clst_controler.cpp

@ -597,6 +597,10 @@ zaf_error_code_t CLSTControler::LightSrcX_setTriggerModeFirstPluseOffset(int32_t
if (index < 1 || index > 4) return kaf_ec_param_error;
return reg_write(kreg_light_ctrol_module1_trigger_mode_first_pluse_offset + (index - 1) * 32, offset * 10); // 0.1us
}
#define DUTY_TO_REAL_DUTY(duty) (59 - 0.58773 * duty)
#define REAL_DUTY_TO_DUTY(duty) ((59 - duty) / 0.58773)
zaf_error_code_t CLSTControler::LightSrcX_setLightIntensityDuty(int32_t index, float duty) { //
if (index < 1 || index > 4) return kaf_ec_param_error;
@ -606,8 +610,9 @@ zaf_error_code_t CLSTControler::LightSrcX_setLightIntensityDuty(int32_t index, f
// duty = duty * 0.4; //旧设备
// duty = (0.767 - duty / 100.0 * 0.25 * 4.13 * 0.74) * 100 / 5 / 0.26; 新设备 ==> duty = 59- 0.58773 * duty
//
duty = 59- 0.58773 * duty;
//
// duty = 59 - 0.58773 * duty;
duty = DUTY_TO_REAL_DUTY(duty);
uint32_t freqcnt = 0;
DO_CMD(reg_read(kreg_light_ctrol_module1_light_driver_freq_cnt + (index - 1) * 32, freqcnt));
@ -625,6 +630,21 @@ zaf_error_code_t CLSTControler::LightSrcX_setLightIntensityDuty(int32_t index, f
// float bakduty = (cnt * 100.0 / freqcnt);
return reg_write(kreg_light_ctrol_module1_light_intensity_cnt + (index - 1) * 32, cnt);
}
zaf_error_code_t CLSTControler::LightSrcX_getLightIntensityDuty(int32_t index, float &duty) { //
if (index < 1 || index > 4) return kaf_ec_param_error;
uint32_t freqcnt = 0;
DO_CMD(reg_read(kreg_light_ctrol_module1_light_driver_freq_cnt + (index - 1) * 32, freqcnt));
uint32_t cnt = 0;
DO_CMD(reg_read(kreg_light_ctrol_module1_light_intensity_cnt + (index - 1) * 32, cnt));
duty = (cnt * 100.0 / freqcnt);
// duty = duty / 0.4;
duty = REAL_DUTY_TO_DUTY(duty);
return kaf_ec_success;
}
zaf_error_code_t CLSTControler::LightSrcX_setLightDriverFreq(int32_t index, float freq) { //
double T = 1.0 / freq;
@ -663,19 +683,7 @@ zaf_error_code_t CLSTControler::LightSrcX_getTriggerModePluseDelay(int32_t index
delay = val;
return kaf_ec_success;
}
zaf_error_code_t CLSTControler::LightSrcX_getLightIntensityDuty(int32_t index, float &duty) { //
if (index < 1 || index > 4) return kaf_ec_param_error;
uint32_t freqcnt = 0;
DO_CMD(reg_read(kreg_light_ctrol_module1_light_driver_freq_cnt + (index - 1) * 32, freqcnt));
uint32_t cnt = 0;
DO_CMD(reg_read(kreg_light_ctrol_module1_light_intensity_cnt + (index - 1) * 32, cnt));
duty = (cnt * 100.0 / freqcnt);
duty = duty / 0.4;
return kaf_ec_success;
}
zaf_error_code_t CLSTControler::LightSrcX_getLightDriverFreq(int32_t index, float &freq) { //
return readFreq(kreg_light_ctrol_module1_light_driver_freq_cnt + (index - 1) * 32, freq);
}

2
src/version.h

@ -1,4 +1,4 @@
#pragma once
#define VERSION 22
#define VERSION 23
#define MAUFACTURER "iflytop"
Loading…
Cancel
Save