Skip to content

Commit a81157b

Browse files
Still no crash
1 parent 9085630 commit a81157b

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

c_mpos/src/quirc_decode.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,37 @@
11
#include <stdio.h>
2+
#include <esp_log.h> // For ESP-IDF logging
23
#include "py/obj.h"
34
#include "py/runtime.h"
45
#include "py/mperrno.h"
56
#include <string.h>
67
#include "../quirc/lib/quirc.h"
78

9+
10+
11+
static const char *TAG = "qrdecode";
12+
813
// Function to decode a QR code from a grayscale image buffer
914
static mp_obj_t qrdecode(mp_uint_t n_args, const mp_obj_t *args) {
1015
printf("qrdecode: Starting\n");
16+
ESP_LOGI(TAG, "qrdecode starting");
1117
fflush(stdout);
1218

1319
// Check argument count (expecting buffer, width, height)
1420
printf("qrdecode: Checking argument count\n");
21+
ESP_LOGI(TAG, "Checking argument count");
1522
fflush(stdout);
1623
if (n_args != 3) {
1724
mp_raise_ValueError(MP_ERROR_TEXT("quirc_decode expects 3 arguments: buffer, width, height"));
1825
}
19-
/*
26+
2027
// Extract buffer
2128
printf("qrdecode: Extracting buffer\n");
29+
ESP_LOGI(TAG, "Extracting buffer");
2230
fflush(stdout);
2331
mp_buffer_info_t bufinfo;
2432
mp_get_buffer_raise(args[0], &bufinfo, MP_BUFFER_READ);
2533
printf("qrdecode: Buffer extracted, len=%zu\n", bufinfo.len);
34+
ESP_LOGI(TAG, "Buffer extracted, len=%zu", bufinfo.len);
2635

2736
// Extract width and height
2837
printf("qrdecode: Extracting width and height\n");
@@ -53,7 +62,7 @@ static mp_obj_t qrdecode(mp_uint_t n_args, const mp_obj_t *args) {
5362
}
5463
printf("qrdecode: quirc initialized\n");
5564
fflush(stdout);
56-
65+
/*
5766
// Resize quirc for the image dimensions
5867
printf("qrdecode: Resizing quirc\n");
5968
fflush(stdout);

0 commit comments

Comments
 (0)