SSD1306 Software Rotation

Description

Hello,

I’m trying to get software rotation to work on LVGL but it’s giving me some issues. I’m hoping there’s some point I’m missing to get it to work properly.

I’ve started from the ESP-IDF example app which works fine in the default landscape mode (except some weird black line that appears there). The OLED controlled (SSD1306) doesn’t support rotation in hardware.

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

ESP-32 + I2C SSD1306 + 0.91" OLED display (32x128)

What LVGL version are you using?

8.2.0

What do you want to achieve?

The display is encased in a device that will hold the display in portrait mode so I need the icons and text to be rotated.

What have you tried so far?

I’ve enabled software rotation in the display driver structure. I’ve tried 90 degree rotation which shows up as the below image. I’ve also tried 180 degree rotation, but that didn’t seem to do anything.

Code to reproduce

Based on the ESP-IDF example, linked above, I added the following lines

    disp_drv.sw_rotate = 1;
    //disp_drv.rotated = LV_DISP_ROT_180;
    disp_drv.rotated = LV_DISP_ROT_90;

In addition, I’ve change the example to include 3 labels aligned to top, middle and bottom:

    lv_obj_t *label = lv_label_create(scr);
    lv_label_set_long_mode(label, LV_LABEL_LONG_SCROLL_CIRCULAR);
    lv_label_set_text(label, "Hello Espressif, Hello LVGL.");
    lv_obj_set_width(label, 150);
    lv_obj_align(label, LV_ALIGN_TOP_LEFT, 0, 0);

    label = lv_label_create(scr);
    lv_label_set_long_mode(label, LV_LABEL_LONG_SCROLL_CIRCULAR);
    lv_label_set_text(label, "Hello Espressif, Hello LVGL.");
    lv_obj_set_width(label, 150);
    lv_obj_align(label, LV_ALIGN_LEFT_MID, 0, 0);

    label = lv_label_create(scr);
    lv_label_set_long_mode(label, LV_LABEL_LONG_SCROLL_CIRCULAR);
    lv_label_set_text(label, "Hello Espressif, Hello LVGL.");
    lv_obj_set_width(label, 150);
    lv_obj_align(label, LV_ALIGN_BOTTOM_LEFT, 0, 0);

Screenshot and/or video

This is how it’s displayed without rotation:


(Not sure what the deal with the black line there)
With 90 software rotation:

It seems that it does align the text correctly but it’s not rotated and there’s the noise between the labels.

It’s my understanding that I don’t need to modify any of the driver callbacks when enabling software rotation so what am I missing?

Thanks in advance!

Bump.

Can anyone confirm software rotation works as expected? And that no other modifications are needed in this case?

Thanks