Skip to content

Commit 11af02e

Browse files
quirc: use ps_malloc() more
1 parent 84baebd commit 11af02e

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

c_mpos/quirc/lib/quirc.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ const char *quirc_version(void)
2525

2626
struct quirc *quirc_new(void)
2727
{
28-
struct quirc *q = malloc(sizeof(*q));
28+
printf("quirc_new\n");
29+
struct quirc *q = d_malloc(sizeof(*q));
2930

3031
if (!q)
3132
return NULL;
@@ -85,7 +86,7 @@ int quirc_resize(struct quirc *q, int w, int h)
8586

8687
/* alloc a new buffer for q->pixels if needed */
8788
if (!QUIRC_PIXEL_ALIAS_IMAGE) {
88-
pixels = calloc(newdim, sizeof(quirc_pixel_t));
89+
pixels = ps_malloc(newdim * sizeof(quirc_pixel_t));
8990
if (!pixels)
9091
goto fail;
9192
}

draft_code/saved_functions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ def log_callback(level, log_str):
602602
# Convert log_str to string if it's a bytes object
603603
log_str = log_str.decode() if isinstance(log_str, bytes) else log_str
604604
# Optional: Print for debugging
605-
#print(f"Level: {level}, Log: {log_str}")
605+
print(f"Level: {level}, Log: {log_str}")
606606
# Log message format: "sysmon: 25 FPS (refr_cnt: 8 | redraw_cnt: 1), ..."
607607
if "sysmon:" in log_str and "FPS" in log_str:
608608
try:

internal_filesystem/apps/com.example.camtest/assets/camtest.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,13 @@ def qr_button_click(e):
5555
height = 240
5656
buffer_size = width * height # 240 * 240 = 57600 bytes
5757
try:
58+
import qrdecode
5859
result = qrdecode.qrdecode(current_cam_buffer, width, height)
5960
if result.startswith('\ufeff'): # Remove BOM (\ufeff) from the start of the decoded string, if present
6061
result = result[1:]
6162
print(f"QR decoding found: {result}")
62-
except ValueError as e:
63-
print("Error:", e)
63+
except Exception as e:
64+
print("QR decode error: ", e)
6465
raise
6566

6667

scripts/install.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ if [ ! -z "$appname" ]; then
2626
exit 1
2727
fi
2828
fi
29+
~/sources/lvgl_micropython/lib/micropython/tools/mpremote/mpremote.py mkdir "builtin"
30+
~/sources/lvgl_micropython/lib/micropython/tools/mpremote/mpremote.py mkdir "builtin/apps"
2931
~/sources/lvgl_micropython/lib/micropython/tools/mpremote/mpremote.py fs cp -r "$appdir" :/"$target"
3032
echo "start_app(\"/$appdir\")"
3133
~/sources/lvgl_micropython/lib/micropython/tools/mpremote/mpremote.py

0 commit comments

Comments
 (0)