@@ -12,10 +12,7 @@ static const char *TAG = "qrdecode";
1212
1313// Function to decode a QR code from a grayscale image buffer
1414static mp_obj_t qrdecode (mp_uint_t n_args , const mp_obj_t * args ) {
15- printf ("qrdecode: Starting\n" );
16- ESP_LOGI (TAG , "qrdecode starting" );
17- QRDECODE_DEBUG_PRINT ("mp_printf works in qrdecode!" );
18- fflush (stdout );
15+ QRDECODE_DEBUG_PRINT ("qrdecode: Starting\n" );
1916
2017 // Check argument count (expecting buffer, width, height)
2118 QRDECODE_DEBUG_PRINT ("qrdecode: Checking argument count\n" );
@@ -62,7 +59,6 @@ static mp_obj_t qrdecode(mp_uint_t n_args, const mp_obj_t *args) {
6259 mp_raise_OSError (MP_ENOMEM );
6360 }
6461 QRDECODE_DEBUG_PRINT ("qrdecode: quirc initialized\n" );
65- QRDECODE_DEBUG_PRINT ("mp_printf works in qrdecode!" );
6662 fflush (stdout );
6763
6864 // Resize quirc for the image dimensions
@@ -83,10 +79,10 @@ static mp_obj_t qrdecode(mp_uint_t n_args, const mp_obj_t *args) {
8379 image = quirc_begin (qr , NULL , NULL ); // Get pointer to quirc's image buffer
8480 QRDECODE_DEBUG_PRINT ("qrdecode: quirc image buffer obtained\n" );
8581 fflush (stdout );
86- QRDECODE_DEBUG_PRINT ("qrdecode: Copying buffer, size=%zu \n" , (size_t )(width * height ));
82+ QRDECODE_DEBUG_PRINT ("qrdecode: Copying buffer, size=%ul \n" , (size_t )(width * height ));
8783 fflush (stdout );
8884 memcpy (image , bufinfo .buf , width * height );
89- QRDECODE_DEBUG_PRINT
85+ QRDECODE_DEBUG_PRINT ( "qrdecode: Buffer copied\n" );
9086 fflush (stdout );
9187 quirc_end (qr );
9288 QRDECODE_DEBUG_PRINT ("qrdecode: quirc processing ended\n" );
@@ -102,6 +98,7 @@ static mp_obj_t qrdecode(mp_uint_t n_args, const mp_obj_t *args) {
10298 quirc_destroy (qr );
10399 mp_raise_ValueError (MP_ERROR_TEXT ("no QR code found" ));
104100 }
101+ // it works until here, it finds 1 QR code!
105102
106103 // Extract and decode the first QR code
107104 QRDECODE_DEBUG_PRINT ("qrdecode: Extracting first QR code\n" );
@@ -110,6 +107,7 @@ static mp_obj_t qrdecode(mp_uint_t n_args, const mp_obj_t *args) {
110107 quirc_extract (qr , 0 , & code );
111108 QRDECODE_DEBUG_PRINT ("qrdecode: QR code extracted\n" );
112109 fflush (stdout );
110+ // it works until here!
113111
114112 // Decode the QR code
115113 QRDECODE_DEBUG_PRINT ("qrdecode: Decoding QR code\n" );
@@ -122,7 +120,10 @@ static mp_obj_t qrdecode(mp_uint_t n_args, const mp_obj_t *args) {
122120 }
123121 QRDECODE_DEBUG_PRINT ("qrdecode: QR code decoded, payload_len=%d\n" , data .payload_len );
124122 fflush (stdout );
125-
123+ QRDECODE_DEBUG_PRINT ("qrdecode: got result: %s\n" , data .payload );
124+ fflush (stdout );
125+ QRDECODE_DEBUG_PRINT ("ok so now what?!" );
126+ /*
126127 // Convert decoded data to Python string
127128 QRDECODE_DEBUG_PRINT("qrdecode: Creating Python string\n");
128129 fflush(stdout);
@@ -136,10 +137,11 @@ static mp_obj_t qrdecode(mp_uint_t n_args, const mp_obj_t *args) {
136137 quirc_destroy(qr);
137138 QRDECODE_DEBUG_PRINT("qrdecode: quirc destroyed\n");
138139 fflush(stdout);
140+ */
139141
140142 printf ("qrdecode: Returning result\n" );
141- return result ;
142- // return mp_const_none; // MicroPython functions typically return None
143+ // return result;
144+ return mp_const_none ; // MicroPython functions typically return None
143145}
144146
145147// Wrapper function to fix incompatible pointer type warning
0 commit comments