Skip to content

Commit 3909c10

Browse files
quirc_decode fails
1 parent 170ec4f commit 3909c10

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

c_mpos/src/quirc_decode.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,23 @@
88

99
#define QRDECODE_DEBUG_PRINT(...) mp_printf(&mp_plat_print, __VA_ARGS__);
1010

11-
static const char *TAG = "qrdecode";
12-
1311
// Function to decode a QR code from a grayscale image buffer
1412
static mp_obj_t qrdecode(mp_uint_t n_args, const mp_obj_t *args) {
1513
QRDECODE_DEBUG_PRINT("qrdecode: Starting\n");
1614

1715
// Check argument count (expecting buffer, width, height)
1816
QRDECODE_DEBUG_PRINT("qrdecode: Checking argument count\n");
19-
ESP_LOGI(TAG, "Checking argument count");
2017
fflush(stdout);
2118
if (n_args != 3) {
2219
mp_raise_ValueError(MP_ERROR_TEXT("quirc_decode expects 3 arguments: buffer, width, height"));
2320
}
2421

2522
// Extract buffer
2623
QRDECODE_DEBUG_PRINT("qrdecode: Extracting buffer\n");
27-
ESP_LOGI(TAG, "Extracting buffer");
2824
fflush(stdout);
2925
mp_buffer_info_t bufinfo;
3026
mp_get_buffer_raise(args[0], &bufinfo, MP_BUFFER_READ);
3127
printf("qrdecode: Buffer extracted, len=%zu\n", bufinfo.len);
32-
ESP_LOGI(TAG, "Buffer extracted, len=%zu", bufinfo.len);
3328

3429
// Extract width and height
3530
QRDECODE_DEBUG_PRINT("qrdecode: Extracting width and height\n");
@@ -108,8 +103,8 @@ static mp_obj_t qrdecode(mp_uint_t n_args, const mp_obj_t *args) {
108103
QRDECODE_DEBUG_PRINT("qrdecode: QR code extracted\n");
109104
fflush(stdout);
110105
// it works until here!
111-
112-
// Decode the QR code
106+
/*
107+
// Decode the QR code - this is the part that fails:
113108
QRDECODE_DEBUG_PRINT("qrdecode: Decoding QR code\n");
114109
fflush(stdout);
115110
struct quirc_data data;
@@ -120,15 +115,16 @@ static mp_obj_t qrdecode(mp_uint_t n_args, const mp_obj_t *args) {
120115
}
121116
QRDECODE_DEBUG_PRINT("qrdecode: QR code decoded, payload_len=%d\n", data.payload_len);
122117
fflush(stdout);
118+
123119
QRDECODE_DEBUG_PRINT("qrdecode: got result: %s\n", data.payload);
124120
fflush(stdout);
125121
QRDECODE_DEBUG_PRINT("ok so now what?!");
126-
/*
122+
127123
// Convert decoded data to Python string
128124
QRDECODE_DEBUG_PRINT("qrdecode: Creating Python string\n");
129125
fflush(stdout);
130126
mp_obj_t result = mp_obj_new_str((const char *)data.payload, data.payload_len);
131-
printf("qrdecode: Python string created\n");
127+
QRDECODE_DEBUG_PRINT("qrdecode: Python string created\n");
132128
fflush(stdout);
133129
134130
// Clean up

scripts/flash_over_usb.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
fwfile="/home/user/sources/lvgl_micropython/build/lvgl_micropy_ESP32_GENERIC_S3-SPIRAM_OCT-16.bin"
22
ls -al $fwfile
3-
~/.espressif/python_env/idf5.2_py3.9_env/bin/python -m esptool --chip esp32s3 --before default_reset --after hard_reset write_flash --flash_mode dio --flash_size 16MB --flash_freq 80m --erase-all 0x0 $fwfile
3+
#~/.espressif/python_env/idf5.2_py3.9_env/bin/python -m esptool --chip esp32s3 --before default_reset --after hard_reset write_flash --flash_mode dio --flash_size 16MB --flash_freq 80m --erase-all 0x0 $fwfile
4+
~/.espressif/python_env/idf5.2_py3.9_env/bin/python -m esptool --chip esp32s3 --before default_reset --after hard_reset write_flash --flash_mode dio --flash_size 16MB --flash_freq 80m 0x0 $fwfile
45

0 commit comments

Comments
 (0)