Skip to content

Commit

Permalink
Merge branch 'update_mcm' into 'dev'
Browse files Browse the repository at this point in the history
update mcm

See merge request maix_sw/k230_canmv!197
  • Loading branch information
zzxcanaan committed Mar 12, 2024
2 parents 2acbc04 + 25b9f4c commit e01e919
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
12 changes: 11 additions & 1 deletion micropython_port/media/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ def __init__(self):
self.dev_attr = k_vicap_dev_attr()
self.chn_attr = [k_vicap_chn_attr() for i in range(0, VICAP_CHN_ID_MAX)]
self.buf_init = [False for i in range(0, VICAP_CHN_ID_MAX)]
self.buf_in_init = False
# set the default value
self.dev_attr.buffer_num = CAM_DEFAULT_INPUT_BUF_NUM
self.dev_attr.mode = VICAP_WORK_ONLINE_MODE
Expand Down Expand Up @@ -122,6 +123,16 @@ def sensor_init(cls, dev_num, type):
cls.cam_dev[dev_num].dev_attr.dw_enable = 0
cls.cam_dev[dev_num].dev_attr.cpature_frame = 0

if ((cls.cam_dev[0].dev_attr.dev_enable + cls.cam_dev[1].dev_attr.dev_enable + cls.cam_dev[2].dev_attr.dev_enable) > 1):
for num in range(0, CAM_DEV_ID_MAX):
if not cls.cam_dev[num].dev_attr.dev_enable:
continue
if cls.cam_dev[num].buf_in_init:
continue
cls.set_inbufs(num, CAM_DEFAULT_INPUT_BUF_NUM)
cls.cam_dev[num].buf_in_init = True
print("MCM Device: ", num)

# set_inbufs
@classmethod
def set_inbufs(cls, dev_num, num):
Expand Down Expand Up @@ -278,7 +289,6 @@ def start_mcm_stream(cls):
for dev_num in range(0, CAM_DEV_ID_MAX):
if not cls.cam_dev[dev_num].dev_attr.dev_enable:
continue
cls.set_inbufs(dev_num, CAM_DEFAULT_INPUT_BUF_NUM)
print("kd_mpi_vicap_set_dev_attr : ", dev_num)
ret = kd_mpi_vicap_set_dev_attr(dev_num, cls.cam_dev[dev_num].dev_attr)
if ret:
Expand Down
2 changes: 0 additions & 2 deletions tests/media/camera_2sensors.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ def camera_test():
# use hdmi for display
display.init(LT9611_1920X1080_30FPS)
camera.sensor_init(CAM_DEV_ID_0, CAM_DEFAULT_SENSOR)
camera.set_inbufs(CAM_DEV_ID_0, 4)
out_width = 640
out_height = 480
# set camera out width align up with 16Bytes
Expand All @@ -35,7 +34,6 @@ def camera_test():


camera.sensor_init(CAM_DEV_ID_1, CAM_OV5647_1920X1080_CSI1_30FPS_10BIT_USEMCLK_LINEAR)
camera.set_inbufs(CAM_DEV_ID_1, 4)
out_width = 640
out_height = 480
# set camera out width align up with 16Bytes
Expand Down
3 changes: 0 additions & 3 deletions tests/media/camera_3sensors.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ def camera_test():
# use hdmi for display
display.init(LT9611_1920X1080_30FPS)
camera.sensor_init(CAM_DEV_ID_0, CAM_DEFAULT_SENSOR)
camera.set_inbufs(CAM_DEV_ID_0, 4)
out_width = 640
out_height = 480
# set camera out width align up with 16Bytes
Expand All @@ -35,7 +34,6 @@ def camera_test():


camera.sensor_init(CAM_DEV_ID_1, CAM_OV5647_1920X1080_CSI1_30FPS_10BIT_USEMCLK_LINEAR)
camera.set_inbufs(CAM_DEV_ID_1, 4)
out_width = 640
out_height = 480
# set camera out width align up with 16Bytes
Expand All @@ -55,7 +53,6 @@ def camera_test():


camera.sensor_init(CAM_DEV_ID_2, CAM_OV5647_1920X1080_CSI2_30FPS_10BIT_USEMCLK_LINEAR)
camera.set_inbufs(CAM_DEV_ID_2, 4)
out_width = 640
out_height = 480
# set camera out width align up with 16Bytes
Expand Down

0 comments on commit e01e919

Please sign in to comment.