forked from xiaozhi/xiaozhi-esp32
Bump to v1.9.0 (#1157)
* update v2 partition table readme * feat: Add user only tool * Add image cache * smaller cache and buffer, more heap * use MAIN_EVENT_CLOCK_TICK to avoid audio glitches * fix: esp_psram_get_size not found in c3 * Bump to 1.9.0
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
#include "lcd_display.h"
|
||||
#include "assets/lang_config.h"
|
||||
#include "settings.h"
|
||||
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
@@ -6,10 +8,8 @@
|
||||
#include <esp_log.h>
|
||||
#include <esp_err.h>
|
||||
#include <esp_lvgl_port.h>
|
||||
#include <esp_heap_caps.h>
|
||||
#include "assets/lang_config.h"
|
||||
#include <esp_psram.h>
|
||||
#include <cstring>
|
||||
#include "settings.h"
|
||||
|
||||
#include "board.h"
|
||||
|
||||
@@ -102,10 +102,21 @@ SpiLcdDisplay::SpiLcdDisplay(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_h
|
||||
ESP_LOGI(TAG, "Initialize LVGL library");
|
||||
lv_init();
|
||||
|
||||
#if CONFIG_SPIRAM
|
||||
// lv image cache, currently only PNG is supported
|
||||
size_t psram_size_mb = esp_psram_get_size() / 1024 / 1024;
|
||||
if (psram_size_mb >= 8) {
|
||||
lv_image_cache_resize(2 * 1024 * 1024, true);
|
||||
ESP_LOGI(TAG, "Use 2MB of PSRAM for image cache");
|
||||
} else if (psram_size_mb >= 2) {
|
||||
lv_image_cache_resize(512 * 1024, true);
|
||||
ESP_LOGI(TAG, "Use 512KB of PSRAM for image cache");
|
||||
}
|
||||
#endif
|
||||
|
||||
ESP_LOGI(TAG, "Initialize LVGL port");
|
||||
lvgl_port_cfg_t port_cfg = ESP_LVGL_PORT_INIT_CONFIG();
|
||||
port_cfg.task_priority = 1;
|
||||
port_cfg.timer_period_ms = 40;
|
||||
lvgl_port_init(&port_cfg);
|
||||
|
||||
ESP_LOGI(TAG, "Adding LCD display");
|
||||
@@ -621,6 +632,9 @@ void LcdDisplay::SetPreviewImage(const lv_img_dsc_t* img_dsc) {
|
||||
|
||||
// 设置自定义属性标记气泡类型
|
||||
lv_obj_set_user_data(img_bubble, (void*)"image");
|
||||
|
||||
// Create the image object inside the bubble
|
||||
lv_obj_t* preview_image = lv_image_create(img_bubble);
|
||||
|
||||
// Create the image object inside the bubble
|
||||
lv_obj_t* preview_image = lv_image_create(img_bubble);
|
||||
@@ -816,8 +830,10 @@ void LcdDisplay::SetPreviewImage(const lv_img_dsc_t* img_dsc) {
|
||||
if (img_dsc != nullptr) {
|
||||
// 设置图片源并显示预览图片
|
||||
lv_image_set_src(preview_image_, img_dsc);
|
||||
// zoom factor 0.5
|
||||
lv_image_set_scale(preview_image_, 128 * width_ / img_dsc->header.w);
|
||||
if (img_dsc->header.w > 0) {
|
||||
// zoom factor 0.5
|
||||
lv_image_set_scale(preview_image_, 128 * width_ / img_dsc->header.w);
|
||||
}
|
||||
lv_obj_remove_flag(preview_image_, LV_OBJ_FLAG_HIDDEN);
|
||||
// 隐藏emotion_label_
|
||||
if (emotion_label_ != nullptr) {
|
||||
|
||||
@@ -23,7 +23,6 @@ OledDisplay::OledDisplay(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_handl
|
||||
lvgl_port_cfg_t port_cfg = ESP_LVGL_PORT_INIT_CONFIG();
|
||||
port_cfg.task_priority = 1;
|
||||
port_cfg.task_stack = 6144;
|
||||
port_cfg.timer_period_ms = 40;
|
||||
lvgl_port_init(&port_cfg);
|
||||
|
||||
ESP_LOGI(TAG, "Adding OLED display");
|
||||
|
||||
Reference in New Issue
Block a user