Skip to content

Commit

Permalink
Merge pull request #418 from espressif/fix/lvgl_sw_rotation
Browse files Browse the repository at this point in the history
fix(lvgl_port): Fixed SW rotation in LVGL9.2 and fixed free buffers.
  • Loading branch information
espzav authored Nov 6, 2024
2 parents e5a3498 + 3e6a581 commit 977d561
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
8 changes: 7 additions & 1 deletion components/esp_lvgl_port/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
# Changelog

## 2.4.2

### Fixes
- Fixed SW rotation in LVGL9.2
- Fixed freeing right buffers when error

## 2.4.1

### Fixes
Fix the issue of the DPI callback function not being initialized.
- Fixed the issue of the DPI callback function not being initialized.

## 2.4.0

Expand Down
2 changes: 1 addition & 1 deletion components/esp_lvgl_port/idf_component.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: "2.4.1"
version: "2.4.2"
description: ESP LVGL port
url: https://github.com/espressif/esp-bsp/tree/master/components/esp_lvgl_port
dependencies:
Expand Down
2 changes: 1 addition & 1 deletion components/esp_lvgl_port/include/esp_lvgl_port_disp.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ typedef struct {

bool monochrome; /*!< True, if display is monochrome and using 1bit for 1px */

lvgl_port_rotation_cfg_t rotation; /*!< Default values of the screen rotation */
lvgl_port_rotation_cfg_t rotation; /*!< Default values of the screen rotation (Only HW state. Not supported for default SW rotation!) */
#if LVGL_VERSION_MAJOR >= 9
lv_color_format_t color_format; /*!< The color format of the display */
#endif
Expand Down
12 changes: 6 additions & 6 deletions components/esp_lvgl_port/src/lvgl9/esp_lvgl_port_disp.c
Original file line number Diff line number Diff line change
Expand Up @@ -356,11 +356,11 @@ static lv_display_t *lvgl_port_add_disp_priv(const lvgl_port_display_cfg_t *disp

err:
if (ret != ESP_OK) {
if (buf1) {
free(buf1);
if (disp_ctx->draw_buffs[0]) {
free(disp_ctx->draw_buffs[0]);
}
if (buf2) {
free(buf2);
if (disp_ctx->draw_buffs[1]) {
free(disp_ctx->draw_buffs[1]);
}
if (disp_ctx->draw_buffs[2]) {
free(disp_ctx->draw_buffs[2]);
Expand Down Expand Up @@ -534,9 +534,9 @@ static void lvgl_port_flush_callback(lv_display_t *drv, const lv_area_t *area, u
if (disp_ctx->current_rotation == LV_DISPLAY_ROTATION_180) {
lv_draw_sw_rotate(color_map, disp_ctx->draw_buffs[2], hh, ww, h_stride, h_stride, LV_DISPLAY_ROTATION_180, cf);
} else if (disp_ctx->current_rotation == LV_DISPLAY_ROTATION_90) {
lv_draw_sw_rotate(color_map, disp_ctx->draw_buffs[2], ww, hh, w_stride, h_stride, LV_DISPLAY_ROTATION_270, cf);
} else if (disp_ctx->current_rotation == LV_DISPLAY_ROTATION_270) {
lv_draw_sw_rotate(color_map, disp_ctx->draw_buffs[2], ww, hh, w_stride, h_stride, LV_DISPLAY_ROTATION_90, cf);
} else if (disp_ctx->current_rotation == LV_DISPLAY_ROTATION_270) {
lv_draw_sw_rotate(color_map, disp_ctx->draw_buffs[2], ww, hh, w_stride, h_stride, LV_DISPLAY_ROTATION_270, cf);
}
color_map = (uint8_t *)disp_ctx->draw_buffs[2];
lvgl_port_rotate_area(drv, (lv_area_t *)area);
Expand Down

0 comments on commit 977d561

Please sign in to comment.