|
1 | 1 | #include <stdio.h> |
| 2 | +#include <esp_log.h> // For ESP-IDF logging |
2 | 3 | #include "py/obj.h" |
3 | 4 | #include "py/runtime.h" |
4 | 5 | #include "py/mperrno.h" |
5 | 6 | #include <string.h> |
6 | 7 | #include "../quirc/lib/quirc.h" |
7 | 8 |
|
| 9 | + |
| 10 | + |
| 11 | +static const char *TAG = "qrdecode"; |
| 12 | + |
8 | 13 | // Function to decode a QR code from a grayscale image buffer |
9 | 14 | static mp_obj_t qrdecode(mp_uint_t n_args, const mp_obj_t *args) { |
10 | 15 | printf("qrdecode: Starting\n"); |
| 16 | + ESP_LOGI(TAG, "qrdecode starting"); |
11 | 17 | fflush(stdout); |
12 | 18 |
|
13 | 19 | // Check argument count (expecting buffer, width, height) |
14 | 20 | printf("qrdecode: Checking argument count\n"); |
| 21 | + ESP_LOGI(TAG, "Checking argument count"); |
15 | 22 | fflush(stdout); |
16 | 23 | if (n_args != 3) { |
17 | 24 | mp_raise_ValueError(MP_ERROR_TEXT("quirc_decode expects 3 arguments: buffer, width, height")); |
18 | 25 | } |
19 | | -/* |
| 26 | + |
20 | 27 | // Extract buffer |
21 | 28 | printf("qrdecode: Extracting buffer\n"); |
| 29 | + ESP_LOGI(TAG, "Extracting buffer"); |
22 | 30 | fflush(stdout); |
23 | 31 | mp_buffer_info_t bufinfo; |
24 | 32 | mp_get_buffer_raise(args[0], &bufinfo, MP_BUFFER_READ); |
25 | 33 | printf("qrdecode: Buffer extracted, len=%zu\n", bufinfo.len); |
| 34 | + ESP_LOGI(TAG, "Buffer extracted, len=%zu", bufinfo.len); |
26 | 35 |
|
27 | 36 | // Extract width and height |
28 | 37 | 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) { |
53 | 62 | } |
54 | 63 | printf("qrdecode: quirc initialized\n"); |
55 | 64 | fflush(stdout); |
56 | | -
|
| 65 | +/* |
57 | 66 | // Resize quirc for the image dimensions |
58 | 67 | printf("qrdecode: Resizing quirc\n"); |
59 | 68 | fflush(stdout); |
|
0 commit comments