From b7fce80935013fa73bfe9f8c80d6d35279df9fdc Mon Sep 17 00:00:00 2001 From: Thomas Farstrike Date: Mon, 12 May 2025 22:59:44 +0200 Subject: [PATCH] QR decoding in app works (to serial) --- c_mpos/quirc/lib/quirc.c | 3 +-- .../apps/com.example.camtest/assets/camtest.py | 13 ++++++------- scripts/install.sh | 1 + 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/c_mpos/quirc/lib/quirc.c b/c_mpos/quirc/lib/quirc.c index 4bbf41c8..208746ec 100644 --- a/c_mpos/quirc/lib/quirc.c +++ b/c_mpos/quirc/lib/quirc.c @@ -25,8 +25,7 @@ const char *quirc_version(void) struct quirc *quirc_new(void) { - printf("quirc_new\n"); - struct quirc *q = d_malloc(sizeof(*q)); + struct quirc *q = ps_malloc(sizeof(*q)); if (!q) return NULL; diff --git a/internal_filesystem/apps/com.example.camtest/assets/camtest.py b/internal_filesystem/apps/com.example.camtest/assets/camtest.py index 5c3d44c2..713b4801 100644 --- a/internal_filesystem/apps/com.example.camtest/assets/camtest.py +++ b/internal_filesystem/apps/com.example.camtest/assets/camtest.py @@ -62,7 +62,6 @@ def qr_button_click(e): print(f"QR decoding found: {result}") except Exception as e: print("QR decode error: ", e) - raise qr_button.add_event_cb(qr_button_click,lv.EVENT.CLICKED,None) @@ -95,8 +94,8 @@ cam = Camera( xclk_freq=20000000, powerdown_pin=-1, reset_pin=-1, - pixel_format=PixelFormat.RGB565, - #pixel_format=PixelFormat.GRAYSCALE, + #pixel_format=PixelFormat.RGB565, + pixel_format=PixelFormat.GRAYSCALE, frame_size=FrameSize.R240X240, grab_mode=GrabMode.LATEST ) @@ -121,11 +120,11 @@ image_dsc = lv.image_dsc_t({ "magic": lv.IMAGE_HEADER_MAGIC, "w": width, "h": height, - "stride": width *2, - "cf": lv.COLOR_FORMAT.RGB565 - #"cf": lv.COLOR_FORMAT.L8 + "stride": width , + #"cf": lv.COLOR_FORMAT.RGB565 + "cf": lv.COLOR_FORMAT.L8 }, - 'data_size': width * height*2, + 'data_size': width * height, 'data': None # Will be updated per frame }) diff --git a/scripts/install.sh b/scripts/install.sh index f525af0a..d845d860 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -26,6 +26,7 @@ if [ ! -z "$appname" ]; then exit 1 fi fi + ~/sources/lvgl_micropython/lib/micropython/tools/mpremote/mpremote.py mkdir "/apps" ~/sources/lvgl_micropython/lib/micropython/tools/mpremote/mpremote.py mkdir "/builtin" ~/sources/lvgl_micropython/lib/micropython/tools/mpremote/mpremote.py mkdir "/builtin/apps" ~/sources/lvgl_micropython/lib/micropython/tools/mpremote/mpremote.py fs cp -r "$appdir" :/"$target"