From 57ad924934b95ece9faef474a67fba400a81cbe7 Mon Sep 17 00:00:00 2001 From: philmoz Date: Fri, 25 Jul 2025 09:53:56 +1000 Subject: [PATCH] fix(color): debug messages when loading images in Lua script not shown as errors (#6464) --- radio/src/gui/colorlcd/libui/bitmapbuffer_fileio.cpp | 8 ++++---- radio/src/gui/colorlcd/libui/static.cpp | 5 ++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/radio/src/gui/colorlcd/libui/bitmapbuffer_fileio.cpp b/radio/src/gui/colorlcd/libui/bitmapbuffer_fileio.cpp index 6df40ef95..c397bdf9a 100644 --- a/radio/src/gui/colorlcd/libui/bitmapbuffer_fileio.cpp +++ b/radio/src/gui/colorlcd/libui/bitmapbuffer_fileio.cpp @@ -111,7 +111,7 @@ BitmapBuffer *BitmapBuffer::loadBitmap(const char *filename, BitmapFormats fmt) f_close(&imgFile); if (!img) { - TRACE("loadBitmap(%s) failed: %s", filename, stbi_failure_reason()); + TRACE_ERROR("loadBitmap(%s) failed: %s", filename, stbi_failure_reason()); return nullptr; } @@ -123,7 +123,7 @@ BitmapBuffer *BitmapBuffer::loadBitmap(const char *filename, BitmapFormats fmt) BitmapBuffer *bmp = new BitmapBuffer(dst_fmt, w, h); if (bmp == nullptr) { - TRACE("loadBitmap: malloc failed"); + TRACE_ERROR("loadBitmap: malloc failed"); return nullptr; } @@ -192,7 +192,7 @@ static uint8_t *convert_bitmap(uint8_t *img, int w, int h, int n) { uint8_t *bmp = (uint8_t *)lv_mem_alloc(((n == 4) ? 3 : 2) * w * h); if (bmp == nullptr) { - TRACE("convert_bitmap: lv_mem_alloc failed"); + TRACE_ERROR("convert_bitmap: lv_mem_alloc failed"); return nullptr; } @@ -240,7 +240,7 @@ static lv_res_t decoder_open(lv_img_decoder_t *decoder, f_close(&imgFile); if (!img) { - TRACE("decoder_open(%s) failed: %s", fn, stbi_failure_reason()); + TRACE_ERROR("decoder_open(%s) failed: %s", fn, stbi_failure_reason()); return LV_RES_INV; } diff --git a/radio/src/gui/colorlcd/libui/static.cpp b/radio/src/gui/colorlcd/libui/static.cpp index 89466bdf0..a858ff24c 100644 --- a/radio/src/gui/colorlcd/libui/static.cpp +++ b/radio/src/gui/colorlcd/libui/static.cpp @@ -237,9 +237,8 @@ void StaticImage::setSource(std::string filename) lv_img_set_src(image, fullpath.c_str()); if (!hasImage()) { // Failed to load - TRACE("could not load image '%s'", filename.c_str()); - lv_obj_del(image); - image = nullptr; + TRACE_ERROR("could not load image '%s'", filename.c_str()); + clearSource(); } setZoom(); } else {