Skip to content

Commit 48f1604

Browse files
authored
QRCodeScanner bug fix (Ameba-AIoT#269)
- modified yuv_snapshot_init(void *ctx) in qrcode_drv.c according to Freertos SDK
1 parent 82ffd11 commit 48f1604

File tree

1 file changed

+17
-1
lines changed
  • Arduino_package/hardware/libraries/QRCodeScanner/src

1 file changed

+17
-1
lines changed

Arduino_package/hardware/libraries/QRCodeScanner/src/qrcode_drv.c

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "qrcode_drv.h"
66
#include "module_video.h"
77
#include "freertos_service.h"
8+
#include "sensor.h"
89

910

1011
#define QR_CODE_MAX_SCAN_COUNT 5
@@ -85,8 +86,23 @@ static video_params_t video_v1_params = {
8586
void yuv_snapshot_init(void *ctx)
8687
{
8788
struct yuv_snapshot_context *yuv_ctx = (struct yuv_snapshot_context *)ctx;
89+
int iq_addr, sensor_addr;
8890

89-
yuv_ctx->v_adp = video_init(12800, 111168);
91+
int voe_heap_size = video_buf_calc(1, V1_WIDTH, V1_HEIGHT, V1_BPS, 1,
92+
0, 0, 0, 0, 0,
93+
0, 0, 0, 0, 0,
94+
0, 0, 0);
95+
96+
int sensor_id_value = 0;
97+
for (int i = 0; i < SENSOR_MAX; i++) {
98+
if (sen_id[i] == USE_SENSOR) {
99+
sensor_id_value = i;
100+
break;
101+
}
102+
}
103+
voe_get_sensor_info(sensor_id_value, &iq_addr, &sensor_addr);
104+
105+
yuv_ctx->v_adp = video_init(iq_addr, sensor_addr);
90106

91107
rtw_init_sema(&yuv_ctx->snapshot_sema, 0);
92108
}

0 commit comments

Comments
 (0)