From 67d6847039ecc65186b39382d38a63dfffc0a9b2 Mon Sep 17 00:00:00 2001 From: Willem Melching Date: Tue, 5 Apr 2022 08:10:53 -0700 Subject: [PATCH] camera_qcom2: target 40ms acquisition time, use register wizard (#24093) * register values from wizard * target 25fps to leave some room for timing jitter * update max lines in ui --- selfdrive/camerad/cameras/camera_qcom2.cc | 2 +- selfdrive/camerad/cameras/sensor2_i2c.h | 20 ++++++++++++++------ selfdrive/ui/ui.cc | 2 +- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/selfdrive/camerad/cameras/camera_qcom2.cc b/selfdrive/camerad/cameras/camera_qcom2.cc index 63dd32bb79..e42723ecff 100644 --- a/selfdrive/camerad/cameras/camera_qcom2.cc +++ b/selfdrive/camerad/cameras/camera_qcom2.cc @@ -64,7 +64,7 @@ const int ANALOG_GAIN_REC_IDX = 0x6; // 0.8x const int ANALOG_GAIN_MAX_IDX = 0xD; // 4.0x const int EXPOSURE_TIME_MIN = 2; // with HDR, fastest ss -const int EXPOSURE_TIME_MAX = 1904; // with HDR, slowest ss +const int EXPOSURE_TIME_MAX = 1618; // with HDR, slowest ss, 40ms // ************** low level camera helpers **************** int do_cam_control(int fd, int op_code, void *handle, int size) { diff --git a/selfdrive/camerad/cameras/sensor2_i2c.h b/selfdrive/camerad/cameras/sensor2_i2c.h index 169e92182d..75817494b8 100644 --- a/selfdrive/camerad/cameras/sensor2_i2c.h +++ b/selfdrive/camerad/cameras/sensor2_i2c.h @@ -65,8 +65,8 @@ struct i2c_random_wr_payload init_array_ar0231[] = { {0x3032, 0x0000}, // SCALING_MODE {0x30A2, 0x0001}, // X_ODD_INC_ {0x30A6, 0x0001}, // Y_ODD_INC_ - {0x3402, 0x0F10}, // X_OUTPUT_CONTROL - {0x3404, 0x0970}, // Y_OUTPUT_CONTROL + {0x3402, 0x0788}, // X_OUTPUT_CONTROL + {0x3404, 0x04B8}, // Y_OUTPUT_CONTROL {0x3064, 0x1802}, // SMIA_TEST {0x30BA, 0x11F2}, // DIGITAL_CTRL @@ -77,7 +77,7 @@ struct i2c_random_wr_payload init_array_ar0231[] = { // Readout timing {0x300C, 0x07B9}, // LINE_LENGTH_PCK - {0x300A, 0x07E7}, // FRAME_LENGTH_LINES + {0x300A, 0x0652}, // FRAME_LENGTH_LINES {0x3042, 0x0000}, // EXTRA_DELAY // Readout Settings @@ -107,9 +107,17 @@ struct i2c_random_wr_payload init_array_ar0231[] = { // HDR Settings {0x3082, 0x0004}, // OPERATION_MODE_CTRL - {0x3238, 0x0004}, // EXPOSURE_RATIO - {0x3014, 0x098E}, // FINE_INTEGRATION_TIME_ - {0x321E, 0x098E}, // FINE_INTEGRATION_TIME2 + {0x3238, 0x0444}, // EXPOSURE_RATIO + + {0x1008, 0x0361}, // FINE_INTEGRATION_TIME_MIN + {0x100C, 0x0589}, // FINE_INTEGRATION_TIME2_MIN + {0x100E, 0x07B1}, // FINE_INTEGRATION_TIME3_MIN + {0x1010, 0x0139}, // FINE_INTEGRATION_TIME4_MIN + {0x3014, 0x08CB}, // FINE_INTEGRATION_TIME_ + {0x321E, 0x08CB}, // FINE_INTEGRATION_TIME2 + {0x321E, 0x08CB}, // FINE_INTEGRATION_TIME3 + {0x321E, 0x0894}, // FINE_INTEGRATION_TIME4 + {0x31D0, 0x0000}, // COMPANDING, no good in 10 bit? {0x33DA, 0x0000}, // COMPANDING {0x318E, 0x0200}, // PRE_HDR_GAIN_EN diff --git a/selfdrive/ui/ui.cc b/selfdrive/ui/ui.cc index 96cd65af79..6825506e66 100644 --- a/selfdrive/ui/ui.cc +++ b/selfdrive/ui/ui.cc @@ -179,7 +179,7 @@ static void update_state(UIState *s) { } else if (Hardware::TICI() && sm.updated("wideRoadCameraState")) { auto camera_state = sm["wideRoadCameraState"].getWideRoadCameraState(); - float max_lines = 1904; + float max_lines = 1618; float max_gain = 10.0; float max_ev = max_lines * max_gain / 6;