From 0e73a1827ad6df015dc0ae760d5b6fc1d7caa8d9 Mon Sep 17 00:00:00 2001 From: ZwX1616 Date: Wed, 28 Feb 2024 20:20:56 -0800 Subject: [PATCH] fix regs --- system/camerad/sensors/os04c10.cc | 8 ++- system/camerad/sensors/os04c10_registers.h | 81 +++++++++++++--------- 2 files changed, 53 insertions(+), 36 deletions(-) diff --git a/system/camerad/sensors/os04c10.cc b/system/camerad/sensors/os04c10.cc index 0e960ebd1d..73de0ba3ee 100644 --- a/system/camerad/sensors/os04c10.cc +++ b/system/camerad/sensors/os04c10.cc @@ -62,14 +62,16 @@ OS04C10::OS04C10() { } std::vector OS04C10::getExposureRegisters(int exposure_time, int new_exp_g, bool dc_gain_enabled) const { - uint32_t hcg_time = exposure_time; + uint32_t long_time = exposure_time; uint32_t real_gain = os04c10_analog_gains_reg[new_exp_g]; - // hcg_time *= 16; // shift 4 bits + uint32_t short_time = long_time > exposure_time_min*8 ? long_time / 8 : exposure_time_min; return { - {0x3501, hcg_time>>8}, {0x3502, hcg_time&0xFF}, + {0x3501, long_time>>8}, {0x3502, long_time&0xFF}, + {0x3511, short_time>>8}, {0x3512, short_time&0xFF}, {0x3508, real_gain>>8}, {0x3509, real_gain&0xFF}, + {0x350c, real_gain>>8}, {0x350d, real_gain&0xFF}, }; } diff --git a/system/camerad/sensors/os04c10_registers.h b/system/camerad/sensors/os04c10_registers.h index c0028b8da3..b3c2566cfb 100644 --- a/system/camerad/sensors/os04c10_registers.h +++ b/system/camerad/sensors/os04c10_registers.h @@ -5,6 +5,8 @@ const struct i2c_random_wr_payload stop_reg_array_os04c10[] = {{0x100, 0}}; const struct i2c_random_wr_payload init_array_os04c10[] = { {0x0103, 0x01}, + + // PLL {0x0301, 0xe4}, {0x0303, 0x01}, {0x0305, 0xb6}, @@ -13,27 +15,15 @@ const struct i2c_random_wr_payload init_array_os04c10[] = { {0x0323, 0x04}, {0x0324, 0x01}, {0x0325, 0x62}, + {0x3012, 0x06}, {0x3013, 0x02}, {0x3016, 0x72}, {0x3021, 0x03}, {0x3106, 0x21}, {0x3107, 0xa1}, - {0x3500, 0x00}, - {0x3501, 0x00}, - {0x3502, 0x08}, - {0x3503, 0x88}, - {0x3508, 0x07}, - {0x3509, 0xc0}, - {0x350a, 0x04}, - {0x350b, 0x00}, - {0x350c, 0x07}, - {0x350d, 0xc0}, - {0x350e, 0x04}, - {0x350f, 0x00}, - {0x3510, 0x00}, - {0x3511, 0x00}, - {0x3512, 0x08}, + + // ? {0x3624, 0x00}, {0x3625, 0x4c}, {0x3660, 0x04}, @@ -110,6 +100,8 @@ const struct i2c_random_wr_payload init_array_os04c10[] = { {0x3d8d, 0xe2}, {0x3f00, 0x0b}, {0x3f06, 0x04}, + + // BLC {0x400a, 0x01}, {0x400b, 0x50}, {0x400e, 0x08}, @@ -128,6 +120,7 @@ const struct i2c_random_wr_payload init_array_os04c10[] = { {0x40b8, 0x00}, {0x40b9, 0x00}, {0x40ba, 0x01}, + {0x4301, 0x00}, {0x4303, 0x00}, {0x4502, 0x04}, @@ -155,20 +148,26 @@ const struct i2c_random_wr_payload init_array_os04c10[] = { {0x4d0b, 0x01}, {0x4e00, 0x2a}, {0x4e0d, 0x00}, + + // ISP {0x5001, 0x09}, {0x5004, 0x00}, {0x5080, 0x04}, {0x5036, 0x80}, {0x5180, 0x70}, {0x5181, 0x10}, + + // DPC {0x520a, 0x03}, {0x520b, 0x06}, {0x520c, 0x0c}, + {0x580b, 0x0f}, {0x580d, 0x00}, {0x580f, 0x00}, {0x5820, 0x00}, {0x5821, 0x00}, + {0x301c, 0xf8}, {0x301e, 0xb4}, {0x301f, 0xf0}, @@ -199,7 +198,7 @@ const struct i2c_random_wr_payload init_array_os04c10[] = { {0x370c, 0x01}, {0x370f, 0x04}, {0x3714, 0x24}, - {0x3716, 0x24}, + {0x3716, 0x04}, {0x3719, 0x11}, {0x371a, 0x1e}, {0x3720, 0x00}, @@ -248,29 +247,25 @@ const struct i2c_random_wr_payload init_array_os04c10[] = { {0x4041, 0x07}, {0x4008, 0x02}, {0x4009, 0x0d}, - {0x3800, 0x00}, - {0x3801, 0x00}, - {0x3802, 0x00}, - {0x3803, 0x00}, - {0x3804, 0x0a}, - {0x3805, 0x8f}, - {0x3806, 0x05}, - {0x3807, 0xff}, - {0x3808, 0x0a}, - {0x3809, 0x80}, - {0x380a, 0x05}, - {0x380b, 0xf0}, - {0x380c, 0x08}, - {0x380d, 0x5c}, - {0x380e, 0x06}, - {0x380f, 0x26}, + + // 2704x1536 -> 2688x1520 out + {0x3800, 0x00}, {0x3801, 0x00}, + {0x3802, 0x00}, {0x3803, 0x00}, + {0x3804, 0x0a}, {0x3805, 0x8f}, + {0x3806, 0x05}, {0x3807, 0xff}, + {0x3808, 0x0a}, {0x3809, 0x80}, + {0x380a, 0x05}, {0x380b, 0xf0}, {0x3811, 0x08}, {0x3813, 0x08}, {0x3814, 0x01}, {0x3815, 0x01}, {0x3816, 0x01}, {0x3817, 0x01}, - {0x3820, 0x88}, + + {0x380c, 0x08}, {0x380d, 0x5c}, // HTS + {0x380e, 0x06}, {0x380f, 0x26}, // VTS + + {0x3820, 0xb0}, {0x3821, 0x04}, {0x3880, 0x25}, {0x3882, 0x20}, @@ -294,4 +289,24 @@ const struct i2c_random_wr_payload init_array_os04c10[] = { {0x4c05, 0x00}, {0x5000, 0xf9}, {0x3822, 0x14}, + + // initialize exposure + {0x3503, 0x88}, + + // long + {0x3500, 0x00}, {0x3501, 0x00}, {0x3502, 0x80}, + {0x3508, 0x00}, {0x3509, 0x80}, + {0x350a, 0x04}, {0x350b, 0x00}, + + // short + {0x3510, 0x00}, {0x3511, 0x00}, {0x3512, 0x10}, + {0x350c, 0x00}, {0x350d, 0x80}, + {0x350e, 0x04}, {0x350f, 0x00}, + + // wb + {0x5100, 0x06}, {0x5101, 0xcb}, + {0x5102, 0x04}, {0x5103, 0x00}, + {0x5104, 0x08}, {0x5105, 0xde}, + + {0x5106, 0x02}, {0x5107, 0x00}, };