Drawing pixels to screen with as little memory usage possible

Description

Trying to draw a set of lv_color16_t pixels or something equivalent to the screen memory efficient.

What MCU/Processor/Board and compiler are you using?

nRF52832 on the Pinetime

What LVGL version are you using?

7.11 InfiniTime fork

What do you want to achieve?

I want to draw an image based on data send per Bluetooth. I deemed 32 * 32 or 16 * 16 pixels a viable size to display. Both are scaled up at runtime on the pinetime to cover a certain area.

What have you tried so far?

I tried to create an lv_color16_t array of the size needed to display my image and I tried creating an image src based on 4 bit indexed colors with the size needed. Both need to much memory (not sure if lv_mem is used in the case of them) and thus intersect with stack.
My current solution which also doesn’t work involves sending 16 pixels + row number via Bluetooth, those are buffered in an array fitting the size. From the buffer i try to directly draw to screen when the specified app is open (music app in InfiniTime). This method is in my eyes the most likely to work, but is probably stomped by the fact that the area drawn to gets overwritten too fast.

Code to reproduce

This code cannot exactly run on its own, as there is more ecosystem around it, see InfiniTime.

The code block(s) should be formatted like:

lv_area_t area; // Some area

lv_color16_t color;
color.full = (albumArtDataBuffer[dataIndex] << 8) | albumArtDataBuffer[dataIndex + 1];
dataIndex++;
dataIndex++;

lvgl.SetFullRefresh(Components::LittleVgl::FullRefreshDirections::None);
lvgl.FlushDisplay(&area, &color);

I am not sure if I might need to use lv_malloc. I found little use (none as I recall) of that function in the project

You’re optimizing memory on the nRF52832 (Pinetime) using LVGL 7.11 to display small images. Try indexed colors, partial screen refresh, and adjust LVGL’s lv_mem for better memory management. If displaying Spotify premium album art, compress Bluetooth data to save memory.

To save memory on the nRF52832, you can try updating only small parts of the screen instead of the whole area. Using lv_malloc might also help manage memory better. Compressing the Bluetooth data before sending can make it easier to display the image without using too much memory.