diff --git a/radio/src/gui/screenshot.cpp b/radio/src/gui/screenshot.cpp index aed100828..4581d55da 100644 --- a/radio/src/gui/screenshot.cpp +++ b/radio/src/gui/screenshot.cpp @@ -79,18 +79,34 @@ const char * writeScreenshot() } #if defined(COLORLCD) - for (int y = LCD_H - 1; y >= 0; y--) { - for (int x = 0; x < LCD_W; x++) { - lcdFront->reset(); - auto pixel = *(lcdFront->getPixelPtr(x, y)); - uint32_t dst = (0xFF << 24) + (GET_RED(pixel) << 16) + (GET_GREEN(pixel) << 8) + (GET_BLUE(pixel) << 0); + lv_img_dsc_t* snapshot = lv_snapshot_take(lv_scr_act(), LV_IMG_CF_TRUE_COLOR); + if (!snapshot) { f_close(&bmpFile); return nullptr; } + + auto w = snapshot->header.w; + auto h = snapshot->header.h; + + for (int y = h - 1; y >= 0; y--) { + for (int x = 0; x < w; x++) { + + lv_color_t pixel = lv_img_buf_get_px_color(snapshot, x, y, {}); + + uint32_t dst = (0xFF << 24) + | (pixel.ch.red << 19) + | (pixel.ch.green << 10) + | (pixel.ch.blue << 3); + if (f_write(&bmpFile, &dst, sizeof(dst), &written) != FR_OK || written != sizeof(dst)) { + lv_snapshot_free(snapshot); f_close(&bmpFile); return SDCARD_ERROR(result); } } } -#else + + lv_snapshot_free(snapshot); + +#else // stdlcd + for (int y=LCD_H-1; y>=0; y-=1) { for (int x=0; x<8*((LCD_W+7)/8); x+=2) { pixel_t byte = getPixel(x+1, y) + (getPixel(x, y) << 4); diff --git a/radio/src/thirdparty/libopenui b/radio/src/thirdparty/libopenui index fae044977..f6b929798 160000 --- a/radio/src/thirdparty/libopenui +++ b/radio/src/thirdparty/libopenui @@ -1 +1 @@ -Subproject commit fae04497704cfa1f9c0f464bcae84b5e514de398 +Subproject commit f6b9297988192b00630fc8a52b399926d77f0b71