Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

esp_lvgl_port: apply rotation from display configuration (BSP-443) #278

Closed
wants to merge 1 commit into from

Conversation

cybekRT
Copy link

@cybekRT cybekRT commented Jan 16, 2024

Initial rotation set in lvgl_port_display_cfg_t was not applied properly after display initialization. This commit adds call to update callback that sets the swap and mirror properties on panel.

Sample code that shows the behavior:

esp_lcd_panel_handle_t lcdPanelHandle;
ESP_ERROR_CHECK(esp_lcd_new_panel_gc9a01(lcdPanelIOHandle, &lcdPanelConfig, &lcdPanelHandle));

ESP_ERROR_CHECK(esp_lcd_panel_reset(lcdPanelHandle));
ESP_ERROR_CHECK(esp_lcd_panel_init(lcdPanelHandle));
ESP_ERROR_CHECK(esp_lcd_panel_disp_on_off(lcdPanelHandle, 1));

const lvgl_port_display_cfg_t displayCfg = {
		.io_handle = lcdPanelIOHandle,
		.panel_handle = lcdPanelHandle,
		.buffer_size = 240 * 240,
		.double_buffer = 0,
		.hres = 240,
		.vres = 240,
		.monochrome = 0,
		.rotation = {
			.mirror_x = 0,
			.mirror_y = 1,
			.swap_xy = 0,
		},
		.flags.buff_dma = 0,
		.flags.buff_spiram = 0,
};
display = lvgl_port_add_disp(&displayCfg);

lv_obj_t* root = lv_disp_get_scr_act(display);
lv_obj_t* lHello = lv_label_create(root);
lv_label_set_text(lHello, "Hello world~!");
lv_obj_align(lHello, LV_ALIGN_CENTER, 0, 0);

After this, the rotation parameters are ignored and requires manual update of lvgl driver to reapply them. This PR makes the rotation being applied just after initialization, as expected.
Tested on: https://www.waveshare.com/wiki/ESP32-S3-Touch-LCD-1.28

Initial rotation set in lvgl_port_display_cfg_t was not applied
properly after display initialization. This commit adds call to
update callback that sets the swap and mirror properties on panel.
@CLAassistant
Copy link

CLAassistant commented Jan 16, 2024

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions bot changed the title esp_lvgl_port: apply rotation from display configuration esp_lvgl_port: apply rotation from display configuration (BSP-443) Jan 16, 2024
@VojtechBartoska VojtechBartoska added the Area: LVGL related to LVGL and LVGL port label Mar 13, 2024
@espzav espzav mentioned this pull request Apr 11, 2024
2 tasks
@espzav
Copy link
Collaborator

espzav commented Apr 11, 2024

@cybekRT Thank you for this PR. I was added your changes to update LVGL port PR here: #320

@espzav espzav closed this in #320 May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: LVGL related to LVGL and LVGL port
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants