Update to 2.0.0

This commit is contained in:
2025-09-13 23:40:38 +08:00
parent 5a929f5b06
commit 63e404d610
247 changed files with 13586 additions and 11497 deletions

File diff suppressed because one or more lines are too long

View File

@@ -8,4 +8,4 @@ files:
license: MIT
repository: https://github.com/78/esp-ml307
url: https://github.com/78/esp-ml307
version: 3.3.0
version: 3.3.3

View File

@@ -5,6 +5,7 @@
#include <string>
#include <map>
#include <thread>
#include <mutex>
#include <freertos/FreeRTOS.h>
#include <freertos/event_groups.h>
@@ -40,8 +41,10 @@ private:
std::string receive_buffer_;
bool handshake_completed_ = false;
bool connected_ = false;
// Mutex for sending data and replying pong
std::mutex send_mutex_;
// FreeRTOS 事件组用于同步握手
EventGroupHandle_t handshake_event_group_;
static const EventBits_t HANDSHAKE_SUCCESS_BIT = BIT0;
static const EventBits_t HANDSHAKE_FAILED_BIT = BIT1;

View File

@@ -233,7 +233,7 @@ void HttpClient::Close() {
void HttpClient::OnTcpData(const std::string& data) {
std::lock_guard<std::mutex> lock(mutex_);
// 检查 body_chunks_ 大小,如果超过 8KB 且 heap 小于 32KB 则阻塞
// 检查 body_chunks_ 大小,如果超过 8KB
{
std::unique_lock<std::mutex> read_lock(read_mutex_);
write_cv_.wait(read_lock, [this, size=data.size()] {
@@ -241,8 +241,7 @@ void HttpClient::OnTcpData(const std::string& data) {
for (const auto& chunk : body_chunks_) {
total_size += chunk.data.size();
}
size_t free_heap = esp_get_free_heap_size();
return total_size < MAX_BODY_CHUNKS_SIZE || !connected_ || free_heap >= 32768;
return total_size < MAX_BODY_CHUNKS_SIZE || !connected_;
});
}

View File

@@ -246,6 +246,7 @@ bool WebSocket::Send(const void* data, size_t len, bool binary, bool fin) {
continuation_ = !fin;
// 发送帧
std::lock_guard<std::mutex> lock(send_mutex_);
return tcp_->Send(frame) >= 0;
}
@@ -381,11 +382,11 @@ void WebSocket::OnTcpData(const std::string& data) {
}
break;
case 0x9: // Ping
// 发送 Pong
SendControlFrame(0xA, payload.data(), payload_length);
std::thread([this, payload, payload_length]() {
SendControlFrame(0xA, payload.data(), payload_length);
}).detach();
break;
case 0xA: // Pong
// 可以在这里处理 Pong
break;
default:
ESP_LOGE(TAG, "Unknown opcode: %d", opcode);
@@ -432,5 +433,6 @@ bool WebSocket::SendControlFrame(uint8_t opcode, const void* data, size_t len) {
}
// 发送帧
std::lock_guard<std::mutex> lock(send_mutex_);
return tcp_->Send(frame) >= 0;
}

View File

@@ -1 +1 @@
d9cc3aad735638e558cee514103b25d2cb60afc78ef53709ffeea443b4d1c835
677fa98425b8c20f3db336c81b5abdf0445ea0adf2ce40b28940daaa84c92dcb

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -12,4 +12,4 @@ files:
license: MIT
repository: https://github.com/78/xiaozhi-fonts
url: https://github.com/78/xiaozhi-fonts
version: 1.5.1
version: 1.5.2

View File

@@ -1 +1 @@
00ab2872c56a4037e6d1efda104ef0da00c5296865f8f938cc7cc2fc3e99f962
9e165065cf25b4575dd9f587440ad22aa94d011359d55a97fc39bb691a9fc0cd

View File

@@ -1 +1 @@
{"version": "1.0", "algorithm": "sha256", "created_at": "2025-05-21T15:56:53.722942+00:00", "files": [{"path": "CMakeLists.txt", "size": 456, "hash": "581b434233fe10f4ae03f48fe4ffcdc76e66027fbe744a663cb997910f492b4c"}, {"path": "idf_component.yml", "size": 419, "hash": "ad43d718c731c9544afc1212c7cdfa2a191b20ace26432a16834b0103d99023e"}, {"path": "esp_lcd_st7796_mipi.c", "size": 10806, "hash": "d072e86ab67b328e1377b5bfbb303273d4908c2fb3b6143ce10e5ed06eb01671"}, {"path": "esp_lcd_st7796.c", "size": 1238, "hash": "03c742b629f27d38a94cd3aa8a157195b9a9f8cc57618d30e96ecc3545b07b98"}, {"path": "README.md", "size": 6349, "hash": "bea9ce10526e7d6ad31f0ae522be18ecdd21275ff9935d3d5d86946f3da605da"}, {"path": "esp_lcd_st7796_general.c", "size": 13051, "hash": "d4b50de091a25cb3c001ed903d0178c6fc76d2705ea87daa11fe245a93592447"}, {"path": "license.txt", "size": 11358, "hash": "cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30"}, {"path": "include/esp_lcd_st7796.h", "size": 9569, "hash": "25837296fe53c0a3a6dbb7e80dae24a97cbf266abbae762264a000f1b245a7e2"}, {"path": "test_apps/CMakeLists.txt", "size": 316, "hash": "bb5058dad04df955f82c042f32ea8b9a5434a54104caa0f01b2929741a24f0e5"}, {"path": "test_apps/sdkconfig.defaults", "size": 353, "hash": "296f4a3a607c38d36f5d9405c3fc968a1a495447f762753f007b212b0d21fbb7"}, {"path": "priv_include/esp_lcd_st7796_interface.h", "size": 1275, "hash": "3dcf1fc8902350f3d7e172cfb956431047121a011f0e35f86fd22437a675a66b"}, {"path": "test_apps/main/test_esp_lcd_st7796_general.c", "size": 5226, "hash": "b1027efe0ff375cfe33452525160d645fd4f83887235d3590dedc06eddf0f533"}, {"path": "test_apps/main/CMakeLists.txt", "size": 113, "hash": "5b20a48123d65be888744cb5c81ce67aab07572469268b9daf97e7d8177918f0"}, {"path": "test_apps/main/idf_component.yml", "size": 148, "hash": "2c9d76d9b5cf309b56ac449dfb787fadc3b3bd9debd7c941f2e75b413e7eae04"}, {"path": "test_apps/main/test_esp_lcd_st7796_mipi.c", "size": 7985, "hash": "b76a27bec8fd126f51a5a60729e62d7e703d2e644da721a35ca0637420c64e2c"}, {"path": "test_apps/main/test_app_main.c", "size": 1499, "hash": "c1525b7878c26e6700e6e992037a132a18b8d5ac6a9006d80c245d039815c7b0"}]}
{"version": "1.0", "algorithm": "sha256", "created_at": "2025-08-26T09:58:45.372697+00:00", "files": [{"path": "CMakeLists.txt", "size": 456, "hash": "581b434233fe10f4ae03f48fe4ffcdc76e66027fbe744a663cb997910f492b4c"}, {"path": "README.md", "size": 6088, "hash": "13d7a64f75cbac9c0ab647ec91e1c90d5c8fb7c2842c7fedca2e92bcce032110"}, {"path": "esp_lcd_st7796.c", "size": 1238, "hash": "03c742b629f27d38a94cd3aa8a157195b9a9f8cc57618d30e96ecc3545b07b98"}, {"path": "esp_lcd_st7796_general.c", "size": 13466, "hash": "dc67f5511567c20ca48ef1190a680504efb2653dfc14ad8312e9d7288cb6a440"}, {"path": "esp_lcd_st7796_mipi.c", "size": 11624, "hash": "844bd3958fa078a9fadbd9ffe12a766296f4f895f4ac0ff19aa62bfc0b96f44f"}, {"path": "idf_component.yml", "size": 419, "hash": "916ce7401966adbae5bd2b9a895c0290373c359d7ff73e5b5c4f896b09d93356"}, {"path": "license.txt", "size": 11358, "hash": "cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30"}, {"path": "include/esp_lcd_st7796.h", "size": 10809, "hash": "f27197e0c05577badc107428edbbd0145481dbcfa74dda0c96d0d6d5b3c1abd8"}, {"path": "priv_include/esp_lcd_st7796_interface.h", "size": 1275, "hash": "3dcf1fc8902350f3d7e172cfb956431047121a011f0e35f86fd22437a675a66b"}, {"path": "test_apps/CMakeLists.txt", "size": 263, "hash": "a44782cc239c58b39146a1fd9fbd40d952417ca0dcbcc34056d0f7af208024c6"}, {"path": "test_apps/sdkconfig.defaults", "size": 353, "hash": "296f4a3a607c38d36f5d9405c3fc968a1a495447f762753f007b212b0d21fbb7"}, {"path": "test_apps/main/CMakeLists.txt", "size": 159, "hash": "c7883535398f0b3c534d0fa2f98041d1b2fec5b098af36040af790222464c13d"}, {"path": "test_apps/main/idf_component.yml", "size": 148, "hash": "2c9d76d9b5cf309b56ac449dfb787fadc3b3bd9debd7c941f2e75b413e7eae04"}, {"path": "test_apps/main/test_app_main.c", "size": 1499, "hash": "c1525b7878c26e6700e6e992037a132a18b8d5ac6a9006d80c245d039815c7b0"}, {"path": "test_apps/main/test_esp_lcd_st7796_general.c", "size": 5331, "hash": "cf1e7ff95eecf164d402713bfb3380d7d5d3b8d21c2d3d58e8a088c7b9b3aeeb"}, {"path": "test_apps/main/test_esp_lcd_st7796_mipi.c", "size": 7985, "hash": "b76a27bec8fd126f51a5a60729e62d7e703d2e644da721a35ca0637420c64e2c"}]}

View File

@@ -14,7 +14,7 @@ Packages from this repository are uploaded to [Espressif's component service](ht
You can add them to your project via `idf.py add-dependency`, e.g.
```bash
compote manifest add-dependency espressif/esp_lcd_st7796==1.0.0
idf.py add-dependency "espressif/esp_lcd_st7796^1.3.0"
```
Alternatively, you can create `idf_component.yml`. More is in [Espressif's documentation](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/tools/idf-component-manager.html).
@@ -59,23 +59,15 @@ Alternatively, you can create `idf_component.yml`. More is in [Espressif's docum
// .init_cmds_size = sizeof(lcd_init_cmds) / sizeof(st7796_lcd_init_cmd_t),
// };
const esp_lcd_panel_dev_config_t panel_config = {
.reset_gpio_num = EXAMPLE_PIN_NUM_LCD_RST, // Set to -1 if not use
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0) // Implemented by LCD command `36h`
.color_space = ESP_LCD_COLOR_SPACE_RGB,
#else
.rgb_endian = LCD_RGB_ENDIAN_RGB,
#endif
.bits_per_pixel = EXAMPLE_LCD_BIT_PER_PIXEL, // Implemented by LCD command `3Ah` (16/18/24)
// .vendor_config = &vendor_config, // Uncomment this line if use custom initialization commands
.reset_gpio_num = EXAMPLE_PIN_NUM_LCD_RST, // Set to -1 if not use
.rgb_ele_order = LCD_RGB_ELEMENT_ORDER_RGB, // RGB element order: R-G-B
.bits_per_pixel = EXAMPLE_LCD_BIT_PER_PIXEL, // Implemented by LCD command `3Ah` (16/18/24)
// .vendor_config = &vendor_config, // Uncomment this line if use custom initialization commands
};
ESP_ERROR_CHECK(esp_lcd_new_panel_st7796(io_handle, &panel_config, &panel_handle));
ESP_ERROR_CHECK(esp_lcd_panel_reset(panel_handle));
ESP_ERROR_CHECK(esp_lcd_panel_init(panel_handle));
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0)
ESP_ERROR_CHECK(esp_lcd_panel_disp_off(panel_handle, false));
#else
ESP_ERROR_CHECK(esp_lcd_panel_disp_on_off(panel_handle, true));
#endif
```
### MIPI Interface

View File

@@ -74,7 +74,7 @@ esp_err_t esp_lcd_new_panel_st7796_general(const esp_lcd_panel_io_handle_t io, c
ESP_GOTO_ON_FALSE(false, ESP_ERR_NOT_SUPPORTED, err, TAG, "unsupported color space");
break;
}
#else
#elif ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(6, 0, 0)
switch (panel_dev_config->rgb_endian) {
case LCD_RGB_ENDIAN_RGB:
st7796->madctl_val = 0;
@@ -86,6 +86,18 @@ esp_err_t esp_lcd_new_panel_st7796_general(const esp_lcd_panel_io_handle_t io, c
ESP_GOTO_ON_FALSE(false, ESP_ERR_NOT_SUPPORTED, err, TAG, "unsupported rgb endian");
break;
}
#else
switch (panel_dev_config->rgb_ele_order) {
case LCD_RGB_ELEMENT_ORDER_RGB:
st7796->madctl_val = 0;
break;
case LCD_RGB_ELEMENT_ORDER_BGR:
st7796->madctl_val |= LCD_CMD_BGR_BIT;
break;
default:
ESP_GOTO_ON_FALSE(false, ESP_ERR_NOT_SUPPORTED, err, TAG, "unsupported rgb element order");
break;
}
#endif
switch (panel_dev_config->bits_per_pixel) {

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2024-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -65,7 +65,32 @@ esp_err_t esp_lcd_new_panel_st7796_mipi(const esp_lcd_panel_io_handle_t io, cons
ESP_GOTO_ON_ERROR(gpio_config(&io_conf), err, TAG, "configure GPIO for RST line failed");
}
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0)
switch (panel_dev_config->color_space) {
case ESP_LCD_COLOR_SPACE_RGB:
st7796->madctl_val = 0;
break;
case ESP_LCD_COLOR_SPACE_BGR:
st7796->madctl_val |= LCD_CMD_BGR_BIT;
break;
default:
ESP_GOTO_ON_FALSE(false, ESP_ERR_NOT_SUPPORTED, err, TAG, "unsupported color space");
break;
}
#elif ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(6, 0, 0)
switch (panel_dev_config->rgb_endian) {
case LCD_RGB_ENDIAN_RGB:
st7796->madctl_val = 0;
break;
case LCD_RGB_ENDIAN_BGR:
st7796->madctl_val |= LCD_CMD_BGR_BIT;
break;
default:
ESP_GOTO_ON_FALSE(false, ESP_ERR_NOT_SUPPORTED, err, TAG, "unsupported rgb endian");
break;
}
#else
switch (panel_dev_config->rgb_ele_order) {
case LCD_RGB_ELEMENT_ORDER_RGB:
st7796->madctl_val = 0;
break;
@@ -73,9 +98,10 @@ esp_err_t esp_lcd_new_panel_st7796_mipi(const esp_lcd_panel_io_handle_t io, cons
st7796->madctl_val |= LCD_CMD_BGR_BIT;
break;
default:
ESP_GOTO_ON_FALSE(false, ESP_ERR_NOT_SUPPORTED, err, TAG, "unsupported color space");
ESP_GOTO_ON_FALSE(false, ESP_ERR_NOT_SUPPORTED, err, TAG, "unsupported rgb element order");
break;
}
#endif
switch (panel_dev_config->bits_per_pixel) {
case 16: // RGB565

View File

@@ -4,7 +4,7 @@ dependencies:
description: ESP LCD ST7796 driver (SPI && I80 && MIPI DSI)
repository: git://github.com/espressif/esp-bsp.git
repository_info:
commit_sha: 7e5759a5dcae75624e0c7abb8d8aef6b95e33b1f
commit_sha: ca6290a9e2d65aa43af6297c9646cce09103f7be
path: components/lcd/esp_lcd_st7796
targets:
- esp32
@@ -12,4 +12,4 @@ targets:
- esp32s3
- esp32p4
url: https://github.com/espressif/esp-bsp/tree/master/components/lcd/esp_lcd_st7796
version: 1.3.2
version: 1.3.4

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2024-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -97,7 +97,7 @@ esp_err_t esp_lcd_new_panel_st7796(const esp_lcd_panel_io_handle_t io, const esp
.bus_width = data_width, \
.max_transfer_bytes = max_trans_bytes, \
}
#else
#elif ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 3, 0)
#define ST7796_PANEL_BUS_I80_CONFIG(max_trans_bytes, data_width, dc, wr, d0, d1, d2, d3, d4, \
d5, d6, d7, d8 , d9, d10, d11, d12, d13, d14, d15) \
{ \
@@ -112,6 +112,20 @@ esp_err_t esp_lcd_new_panel_st7796(const esp_lcd_panel_io_handle_t io, const esp
.psram_trans_align = 64, \
.sram_trans_align = 4, \
}
#else
#define ST7796_PANEL_BUS_I80_CONFIG(max_trans_bytes, data_width, dc, wr, d0, d1, d2, d3, d4, \
d5, d6, d7, d8 , d9, d10, d11, d12, d13, d14, d15) \
{ \
.clk_src = LCD_CLK_SRC_PLL160M, \
.dc_gpio_num = dc, \
.wr_gpio_num = wr, \
.data_gpio_nums = { \
d0, d1, d2, d3, d4, d5, d6, d7, d8 , d9, d10, d11, d12, d13, d14, d15 \
}, \
.bus_width = data_width, \
.max_transfer_bytes = max_trans_bytes, \
.dma_burst_size = 64, \
}
#endif
/**

View File

@@ -1,6 +1,6 @@
# The following lines of boilerplate have to be in your project's CMakeLists
# in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.5)
set(EXTRA_COMPONENT_DIRS "$ENV{IDF_PATH}/tools/unit-test-app/components")
set(COMPONENTS main)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(test_esp_lcd_st7796)

View File

@@ -1,3 +1,4 @@
idf_component_register(SRC_DIRS "."
INCLUDE_DIRS "."
WHOLE_ARCHIVE)
REQUIRES unity driver
WHOLE_ARCHIVE)

View File

@@ -110,8 +110,10 @@ TEST_CASE("test st7796 to draw color bar with I80 interface", "[st7796][i80]")
.reset_gpio_num = TEST_PIN_NUM_LCD_RST,
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0)
.color_space = ESP_LCD_COLOR_SPACE_BGR,
#else
#elif ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(6, 0, 0)
.rgb_endian = LCD_RGB_ENDIAN_BGR,
#else
.rgb_ele_order = LCD_RGB_ELEMENT_ORDER_BGR,
#endif
.bits_per_pixel = TEST_LCD_BIT_PER_PIXEL,
};