Skip to content

Commit

Permalink
Merge branch 'bugfix/fix_shared_pointer_incorrect_delete' into 'master'
Browse files Browse the repository at this point in the history
fix(lcd): use 'delete[]' instead of 'delete' for C array shared pointer

Closes #143

See merge request ae_group/ESP32_Display_Panel!6
  • Loading branch information
Lzw655 committed Dec 23, 2024
2 parents f9ed184 + bcbeb68 commit 0e8efec
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 6 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# ChangeLog

## v0.2.2 - 2024-12-23

### Bugfixes:

* fix(lcd): use 'delete[]' instead of 'delete' for C array shared pointer @FranciscoMoya (#142)
* fix(Kconfig): fix build error on esp-idf and incorrect descriptions @Cathgao (#133)

## v0.2.1 - 2024-11-14

### Enhancements:
Expand Down
4 changes: 2 additions & 2 deletions Kconfig
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
menu "ESP Display Panel Configurations"
config ESP_PANEL_CONF_FILE_SKIP
bool "Unckeck this to ignore `ESP_Panel_Conf.h`"
bool "Unckeck this to use `ESP_Panel_Conf.h`"
default y

config ESP_PANEL_BOARD_FILE_SKIP
bool "Unckeck this to ignore `ESP_Panel_Board_*.h`"
bool "Unckeck this to use `ESP_Panel_Board_*.h`"
default y

config ESP_PANEL_CHECK_RESULT_ASSERT
Expand Down
2 changes: 1 addition & 1 deletion idf_component.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: "0.2.1"
version: "0.2.2"
description: ESP32_Display_Panel is a library designed for ESP SoCs to drive display panels and facilitate rapid GUI development.
url: https://github.com/esp-arduino-libs/ESP32_Display_Panel
repository: https://github.com/esp-arduino-libs/ESP32_Display_Panel.git
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=ESP32_Display_Panel
version=0.2.1
version=0.2.2
author=espressif
maintainer=espressif
sentence=ESP32_Display_Panel is a library designed for ESP SoCs to drive display panels and facilitate rapid GUI development.
Expand Down
2 changes: 1 addition & 1 deletion src/ESP_PanelVersions.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
/* Library Version */
#define ESP_PANEL_VERSION_MAJOR 0
#define ESP_PANEL_VERSION_MINOR 2
#define ESP_PANEL_VERSION_PATCH 1
#define ESP_PANEL_VERSION_PATCH 2

/* File `ESP_Panel_Conf.h` */
#define ESP_PANEL_CONF_VERSION_MAJOR 0
Expand Down
21 changes: 21 additions & 0 deletions src/ESP_Panel_Board_Kconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,13 @@
#define ESP_PANEL_LCD_3WIRE_SPI_SDA_USE_EXPNADER 0
#endif
#endif
#ifndef ESP_PANEL_LCD_3WIRE_SPI_SCL_ACTIVE_EDGE
#ifdef CONfIGESP_PANEL_LCD_3WIRE_SPI_SCL_ACTIVE_EDGE
#define ESP_PANEL_LCD_3WIRE_SPI_SCL_ACTIVE_EDGE CONFIG_ESP_PANEL_LCD_3WIRE_SPI_SCL_ACTIVE_EDGE
#else
#define ESP_PANEL_LCD_3WIRE_SPI_SCL_ACTIVE_EDGE 0
#endif
#endif
#ifndef ESP_PANEL_LCD_FLAGS_AUTO_DEL_PANEL_IO
#ifdef CONFIG_ESP_PANEL_LCD_FLAGS_AUTO_DEL_PANEL_IO
#define ESP_PANEL_LCD_FLAGS_AUTO_DEL_PANEL_IO CONFIG_ESP_PANEL_LCD_FLAGS_AUTO_DEL_PANEL_IO
Expand Down Expand Up @@ -587,6 +594,13 @@
#error "Missing configuration: ESP_PANEL_LCD_RGB_PIXEL_BITS"
#endif
#endif
#ifndef ESP_PANEL_LCD_RGB_BOUNCE_BUF_SIZE
#ifdef CONFIG_ESP_PANEL_LCD_RGB_BOUNCE_BUF_SIZE
#define ESP_PANEL_LCD_RGB_BOUNCE_BUF_SIZE CONFIG_ESP_PANEL_LCD_RGB_BOUNCE_BUF_SIZE
#else
#define ESP_PANEL_LCD_RGB_BOUNCE_BUF_SIZE 0
#endif
#endif
#ifndef ESP_PANEL_LCD_RGB_IO_HSYNC
#ifdef CONFIG_ESP_PANEL_LCD_RGB_IO_HSYNC
#define ESP_PANEL_LCD_RGB_IO_HSYNC CONFIG_ESP_PANEL_LCD_RGB_IO_HSYNC
Expand Down Expand Up @@ -1042,6 +1056,13 @@
#define ESP_PANEL_BACKLIGHT_IDLE_OFF 0
#endif
#endif
#ifndef ESP_PANEL_LCD_BL_USE_PWM
#ifdef CONFIG_ESP_PANEL_LCD_BL_USE_PWM
#define ESP_PANEL_LCD_BL_USE_PWM CONFIG_ESP_PANEL_LCD_BL_USE_PWM
#else
#define ESP_PANEL_LCD_BL_USE_PWM 0
#endif
#endif
#endif /* ESP_PANEL_USE_BACKLIGHT */

// IO Expander
Expand Down
11 changes: 11 additions & 0 deletions src/board/Kconfig.board_custom
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,12 @@ menu "LCD settings"
bool "Use IO expander to control SDA"
default n

config ESP_PANEL_LCD_3WIRE_SPI_SCL_ACTIVE_EDGE
bool "SCL active falling edge"
default n
help
If set to 1, the SCL signal will be active on the falling edge; otherwise, it will be active on the raising edge.

config ESP_PANEL_LCD_FLAGS_AUTO_DEL_PANEL_IO
bool "Auto delete panel IO instance"
default n
Expand Down Expand Up @@ -334,6 +340,11 @@ menu "LCD settings"
default 24 if ESP_PANEL_LCD_RGB_DATA_WIDTH_8
default 16 if ESP_PANEL_LCD_RGB_DATA_WIDTH_16

config ESP_PANEL_LCD_RGB_BOUNCE_BUF_SIZE
int "Bounce buffer size (bytes)"
default 0
range 0 10000000

menu "Pins"
config ESP_PANEL_LCD_RGB_IO_HSYNC
int "HSYNC"
Expand Down
2 changes: 1 addition & 1 deletion src/lcd/ESP_PanelLcd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ bool ESP_PanelLcd::colorBarTest(uint16_t width, uint16_t height)
int res_line_count = 0;

/* Malloc memory for a single color bar */
shared_ptr<uint8_t> single_bar_buf(new uint8_t[row_per_bar * width * bytes_per_piexl]);
shared_ptr<uint8_t> single_bar_buf(new uint8_t[row_per_bar * width * bytes_per_piexl], [](uint8_t* ptr) { delete[] ptr; });
ESP_PANEL_CHECK_FALSE_RET(single_bar_buf != nullptr, false, "Malloc color buffer failed");

/* Draw color bar from top left to bottom right, the order is B - G - R */
Expand Down

0 comments on commit 0e8efec

Please sign in to comment.