Skip to content

Commit d43ec57

Browse files
quirc_decode.c: less debug
1 parent d7f7b33 commit d43ec57

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

c_mpos/src/quirc_decode.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ size_t uxTaskGetStackHighWaterMark(void * unused) {
2222
#define QRDECODE_DEBUG_PRINT(...) mp_printf(&mp_plat_print, __VA_ARGS__)
2323

2424
static mp_obj_t qrdecode(mp_uint_t n_args, const mp_obj_t *args) {
25-
QRDECODE_DEBUG_PRINT("qrdecode: Starting\n");
26-
QRDECODE_DEBUG_PRINT("qrdecode: Stack high-water mark: %u bytes\n", uxTaskGetStackHighWaterMark(NULL));
25+
//QRDECODE_DEBUG_PRINT("qrdecode: Starting\n");
26+
//QRDECODE_DEBUG_PRINT("qrdecode: Stack high-water mark: %u bytes\n", uxTaskGetStackHighWaterMark(NULL));
2727

2828
if (n_args != 3) {
2929
mp_raise_ValueError(MP_ERROR_TEXT("quirc_decode expects 3 arguments: buffer, width, height"));
@@ -34,13 +34,13 @@ static mp_obj_t qrdecode(mp_uint_t n_args, const mp_obj_t *args) {
3434

3535
mp_int_t width = mp_obj_get_int(args[1]);
3636
mp_int_t height = mp_obj_get_int(args[2]);
37-
QRDECODE_DEBUG_PRINT("qrdecode: Width=%u, Height=%u\n", width, height);
37+
//QRDECODE_DEBUG_PRINT("qrdecode: Width=%u, Height=%u\n", width, height);
3838

3939
if (width <= 0 || height <= 0) {
4040
mp_raise_ValueError(MP_ERROR_TEXT("width and height must be positive"));
4141
}
42-
QRDECODE_DEBUG_PRINT("qrdecode bufsize: %u bytes\n", bufinfo.len);
4342
if (bufinfo.len != (size_t)(width * height)) {
43+
QRDECODE_DEBUG_PRINT("qrdecode wrong bufsize: %u bytes\n", bufinfo.len);
4444
mp_raise_ValueError(MP_ERROR_TEXT("buffer size must match width * height"));
4545
}
4646
struct quirc *qr = quirc_new();
@@ -109,7 +109,7 @@ static mp_obj_t qrdecode(mp_uint_t n_args, const mp_obj_t *args) {
109109
free(data);
110110
free(code);
111111
quirc_destroy(qr);
112-
QRDECODE_DEBUG_PRINT("qrdecode: Decode failed, freed data, code, and quirc object\n");
112+
//QRDECODE_DEBUG_PRINT("qrdecode: Decode failed, freed data, code, and quirc object\n");
113113
mp_raise_TypeError(MP_ERROR_TEXT("failed to decode QR code"));
114114
}
115115

@@ -123,7 +123,7 @@ static mp_obj_t qrdecode(mp_uint_t n_args, const mp_obj_t *args) {
123123
}
124124

125125
static mp_obj_t qrdecode_rgb565(mp_uint_t n_args, const mp_obj_t *args) {
126-
QRDECODE_DEBUG_PRINT("qrdecode_rgb565: Starting\n");
126+
//QRDECODE_DEBUG_PRINT("qrdecode_rgb565: Starting\n");
127127

128128
if (n_args != 3) {
129129
mp_raise_ValueError(MP_ERROR_TEXT("qrdecode_rgb565 expects 3 arguments: buffer, width, height"));
@@ -134,21 +134,21 @@ static mp_obj_t qrdecode_rgb565(mp_uint_t n_args, const mp_obj_t *args) {
134134

135135
mp_int_t width = mp_obj_get_int(args[1]);
136136
mp_int_t height = mp_obj_get_int(args[2]);
137-
QRDECODE_DEBUG_PRINT("qrdecode_rgb565: Width=%u, Height=%u\n", width, height);
137+
//QRDECODE_DEBUG_PRINT("qrdecode_rgb565: Width=%u, Height=%u\n", width, height);
138138

139139
if (width <= 0 || height <= 0) {
140140
mp_raise_ValueError(MP_ERROR_TEXT("width and height must be positive"));
141141
}
142-
QRDECODE_DEBUG_PRINT("qrdecode bufsize: %u bytes\n", bufinfo.len);
143142
if (bufinfo.len != (size_t)(width * height * 2)) {
143+
QRDECODE_DEBUG_PRINT("qrdecode_rgb565 wrong bufsize: %u bytes\n", bufinfo.len);
144144
mp_raise_ValueError(MP_ERROR_TEXT("buffer size must match width * height * 2 for RGB565"));
145145
}
146146

147147
uint8_t *gray_buffer = (uint8_t *)malloc(width * height * sizeof(uint8_t));
148148
if (!gray_buffer) {
149149
mp_raise_OSError(MP_ENOMEM);
150150
}
151-
QRDECODE_DEBUG_PRINT("qrdecode_rgb565: Allocated gray_buffer (%u bytes)\n", width * height * sizeof(uint8_t));
151+
//QRDECODE_DEBUG_PRINT("qrdecode_rgb565: Allocated gray_buffer (%u bytes)\n", width * height * sizeof(uint8_t));
152152

153153
uint16_t *rgb565 = (uint16_t *)bufinfo.buf;
154154
for (size_t i = 0; i < (size_t)(width * height); i++) {
@@ -170,10 +170,10 @@ static mp_obj_t qrdecode_rgb565(mp_uint_t n_args, const mp_obj_t *args) {
170170
if (nlr_push(&exception_handler) == 0) {
171171
result = qrdecode(3, gray_args);
172172
nlr_pop();
173-
QRDECODE_DEBUG_PRINT("qrdecode_rgb565: qrdecode succeeded, freeing gray_buffer\n");
173+
//QRDECODE_DEBUG_PRINT("qrdecode_rgb565: qrdecode succeeded, freeing gray_buffer\n");
174174
free(gray_buffer);
175175
} else {
176-
QRDECODE_DEBUG_PRINT("qrdecode_rgb565: Exception caught, freeing gray_buffer\n");
176+
//QRDECODE_DEBUG_PRINT("qrdecode_rgb565: Exception caught, freeing gray_buffer\n");
177177
// Cleanup
178178
if (gray_buffer) {
179179
free(gray_buffer);

0 commit comments

Comments
 (0)