mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-06-22 22:42:05 +08:00
cleanup camera_qcom const structs (#20251)
* move actuator_ringing_params from global to function actuator_move * remove varaible infinity_dac from CameraState * static actuator_ringing_params * continue * rebase master
This commit is contained in:
@@ -28,6 +28,9 @@
|
||||
#include "sensor_i2c.h"
|
||||
#include "camera_qcom.h"
|
||||
|
||||
// leeco actuator (DW9800W H-Bridge Driver IC)
|
||||
// from sniff
|
||||
const uint16_t INFINITY_DAC = 364;
|
||||
|
||||
extern ExitHandler do_exit;
|
||||
|
||||
@@ -553,10 +556,6 @@ static void camera_open(CameraState *s, bool is_road_cam) {
|
||||
err = ioctl(s->actuator_fd, VIDIOC_MSM_ACTUATOR_CFG, &actuator_cfg_data);
|
||||
LOG("actuator init: %d", err);
|
||||
|
||||
// leeco actuator (DW9800W H-Bridge Driver IC)
|
||||
// from sniff
|
||||
s->infinity_dac = 364;
|
||||
|
||||
struct msm_actuator_reg_params_t actuator_reg_params[] = {
|
||||
{
|
||||
.reg_write_type = MSM_ACTUATOR_WRITE_DAC,
|
||||
@@ -598,7 +597,7 @@ static void camera_open(CameraState *s, bool is_road_cam) {
|
||||
.park_lens = {.damping_step = 1023, .damping_delay = 14000, .hw_params = 11, .max_step = 20},
|
||||
},
|
||||
.af_tuning_params = {
|
||||
.initial_code = (int16_t)s->infinity_dac,
|
||||
.initial_code = INFINITY_DAC,
|
||||
.pwd_step = 0,
|
||||
.region_size = 1,
|
||||
.total_steps = 238,
|
||||
@@ -756,40 +755,24 @@ static void camera_open(CameraState *s, bool is_road_cam) {
|
||||
LOG("isp start stream: %d", err);
|
||||
}
|
||||
|
||||
|
||||
static struct damping_params_t actuator_ringing_params = {
|
||||
.damping_step = 1023,
|
||||
.damping_delay = 15000,
|
||||
.hw_params = 0x0000e422,
|
||||
};
|
||||
|
||||
static void road_camera_start(CameraState *s) {
|
||||
struct msm_actuator_cfg_data actuator_cfg_data = {0};
|
||||
|
||||
set_exposure(s, 1.0, 1.0);
|
||||
|
||||
int err = sensor_write_regs(s, start_reg_array, ARRAYSIZE(start_reg_array), MSM_CAMERA_I2C_BYTE_DATA);
|
||||
LOG("sensor start regs: %d", err);
|
||||
|
||||
// focus on infinity assuming phone is perpendicular
|
||||
int inf_step;
|
||||
|
||||
actuator_ringing_params.damping_step = 1023;
|
||||
actuator_ringing_params.damping_delay = 20000;
|
||||
actuator_ringing_params.hw_params = 13;
|
||||
|
||||
inf_step = 512 - s->infinity_dac;
|
||||
int inf_step = 512 - INFINITY_DAC;
|
||||
|
||||
// initial guess
|
||||
s->lens_true_pos = 400;
|
||||
|
||||
// reset lens position
|
||||
memset(&actuator_cfg_data, 0, sizeof(actuator_cfg_data));
|
||||
struct msm_actuator_cfg_data actuator_cfg_data = {};
|
||||
actuator_cfg_data.cfgtype = CFG_SET_POSITION;
|
||||
actuator_cfg_data.cfg.setpos = (struct msm_actuator_set_position_t){
|
||||
.number_of_steps = 1,
|
||||
.hw_params = (uint32_t)7,
|
||||
.pos = {s->infinity_dac, 0},
|
||||
.pos = {INFINITY_DAC, 0},
|
||||
.delay = {0,}
|
||||
};
|
||||
err = ioctl(s->actuator_fd, VIDIOC_MSM_ACTUATOR_CFG, &actuator_cfg_data);
|
||||
@@ -819,6 +802,14 @@ static void road_camera_start(CameraState *s) {
|
||||
|
||||
void actuator_move(CameraState *s, uint16_t target) {
|
||||
// LP3 moves only on even positions. TODO: use proper sensor params
|
||||
|
||||
// focus on infinity assuming phone is perpendicular
|
||||
static struct damping_params_t actuator_ringing_params = {
|
||||
.damping_step = 1023,
|
||||
.damping_delay = 20000,
|
||||
.hw_params = 13,
|
||||
};
|
||||
|
||||
int step = (target - s->cur_lens_pos) / 2;
|
||||
|
||||
int dest_step_pos = s->cur_step_pos + step;
|
||||
@@ -838,7 +829,6 @@ void actuator_move(CameraState *s, uint16_t target) {
|
||||
|
||||
s->cur_step_pos = dest_step_pos;
|
||||
s->cur_lens_pos = actuator_cfg_data.cfg.move.curr_lens_pos;
|
||||
|
||||
//LOGD("step %d target: %d lens pos: %d", dest_step_pos, target, s->cur_lens_pos);
|
||||
}
|
||||
|
||||
|
||||
@@ -84,7 +84,6 @@ typedef struct CameraState {
|
||||
uint16_t cur_lens_pos;
|
||||
int16_t focus[NUM_FOCUS];
|
||||
uint8_t confidence[NUM_FOCUS];
|
||||
uint16_t infinity_dac;
|
||||
} CameraState;
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user