Skip to content

Commit

Permalink
Update h/v res after rotation
Browse files Browse the repository at this point in the history
  • Loading branch information
rzeldent committed Jun 20, 2024
1 parent 1ba8493 commit 31798f2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/esp32_smartdisplay.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,18 +230,26 @@ void lvgl_display_resolution_changed_callback(lv_event_t *event)
case LV_DISPLAY_ROTATION_0:
ESP_ERROR_CHECK(esp_lcd_panel_swap_xy(panel_handle, DISPLAY_SWAP_XY));
ESP_ERROR_CHECK(esp_lcd_panel_mirror(panel_handle, DISPLAY_MIRROR_X, DISPLAY_MIRROR_Y));
display->hor_res = DISPLAY_WIDTH;
display->ver_res = DISPLAY_HEIGHT;
break;
case LV_DISPLAY_ROTATION_90:
ESP_ERROR_CHECK(esp_lcd_panel_swap_xy(panel_handle, !DISPLAY_SWAP_XY));
ESP_ERROR_CHECK(esp_lcd_panel_mirror(panel_handle, DISPLAY_MIRROR_X, !DISPLAY_MIRROR_Y));
display->hor_res = DISPLAY_HEIGHT;
display->ver_res = DISPLAY_WIDTH;
break;
case LV_DISPLAY_ROTATION_180:
ESP_ERROR_CHECK(esp_lcd_panel_swap_xy(panel_handle, DISPLAY_SWAP_XY));
ESP_ERROR_CHECK(esp_lcd_panel_mirror(panel_handle, !DISPLAY_MIRROR_X, !DISPLAY_MIRROR_Y));
display->hor_res = DISPLAY_WIDTH;
display->ver_res = DISPLAY_HEIGHT;
break;
case LV_DISPLAY_ROTATION_270:
ESP_ERROR_CHECK(esp_lcd_panel_swap_xy(panel_handle, !DISPLAY_SWAP_XY));
ESP_ERROR_CHECK(esp_lcd_panel_mirror(panel_handle, !DISPLAY_MIRROR_X, DISPLAY_MIRROR_Y));
display->hor_res = DISPLAY_HEIGHT;
display->ver_res = DISPLAY_WIDTH;
break;
}
}
Expand Down

0 comments on commit 31798f2

Please sign in to comment.