PROS - Displaying images without SD card

Hey everyone!

As you may know, PROS uses LVGL 5.3 under the hood. Sadly, this is quite outdated, meaning there doesn’t seem to be any easy way to display an image without an SD card.

I know it’s possible, but the docs for LVGL v5 were essentially wiped from the internet making it extremely difficult. Plus, the image converter (which you need) for LVGL 5 was taken offline (link).

Is there any way to do this these days? All my attempts yield the same “no data” screen, the same result as basically everyone else I’ve talked to.

Thanks for any help!

1 Like

I would imagine that the raw image data array output from the latest image converter is probably the same as the old one, you would just need to modify the other data structures to match what V5.3 needs. PROS has a plan to move lvgl out of the kernel for V4, but that’s been in progress for a long time, you can follow here.
https://github.com/purduesigbots/pros/issues/168

or alternatively switch to VEXcode and use lvgl 8.

6 Likes

I believe you were helped on the discord server a short while ago, please let us know the results of that

To add on to what James said, lvgl will be treated as a separate template similar to okapilib in PROS Kernel 4. We expect to be able to release PROS 4 in a beta state around the end of December, so it is not too far away.

I was helped in the discord! I can’t give the results of that now as I don’t have the robot with me, but I’ll post a reply here tomorrow with the solution if it works.

As for PROS 4, I’m assuming separating LVGL could potentially allow it to be manually updated in the future? Can’t wait for v4, and thanks!

Discord help worked! Here’s what they said:

image

Thanks to everyone that helped me!

3 Likes

Yes this has worked for me as well !

I am not sure how to display the image. I copied the example from the docs linked below, but there is a build error that says “undefined reference to `testimage’”. I think the problem is with the lv_img_set_src().

My code:

void initialize()
{
	LV_IMG_DECLARE(testimage);
	lv_obj_t * img1 = lv_img_create(lv_scr_act(), NULL);
	lv_img_set_src(img1, &testimage);
	lv_obj_align(img1, NULL, LV_ALIGN_IN_TOP_LEFT, 20, 40);
}

The file of the image c array is inside the include folder. The name is “testimage.c”.

Here’s how I did it:

  1. I put the .c image in my src folder
  2. Somewhere around the top of my main.cpp, I added the line LV_IMG_DECLARE(testimage);
  3. I called the following code in initialize():
lv_obj_t * img1 = lv_img_create(lv_scr_act(), NULL);
lv_img_set_src(img1, &testimage);
lv_obj_align(img1, NULL, LV_ALIGN_CENTER, 0, 0);

I think the undefined reference error is due to your .c file being located in the include folder, moving it to the src folder should help!

1 Like

After moving the image to src, I was still having some build error, but this was resolved by commenting out the entire const lv_img_dsc_t testimage at the end of the file.

Thank you!!! I am excited to test if this works tomorrow.

The image display worked!

However, what I said in my previous reply is actually wrong. Do not remove the const lv_img_dsc_t image. The problem I had before was because I renamed the image_map to image, so do not mess with that.