Enhance memory management in asset download and OTA processes by repl… (#1716)
* Enhance memory management in asset download and OTA processes by replacing static buffer allocations with dynamic memory allocation using heap capabilities. Update SPIRAM configuration values for improved memory usage. Add logging for error handling in buffer allocation failures. Introduce a new parameter in CloseAudioChannel to control goodbye message sending in MQTT and WebSocket protocols. * Update component versions in idf_component.yml and refactor GIF decoder functions for improved performance. Bump versions for audio effects, audio codec, LED strip, and other dependencies. Change GIF read and seek functions to inline for optimization. * Update language files to include new phrases for flight mode and connection status across multiple locales. Added translations for "FLIGHT_MODE_ON", "FLIGHT_MODE_OFF", "CONNECTION_SUCCESSFUL", and "MODEM_INIT_ERROR" in various languages, enhancing user experience and localization support. * fix wechat display
This commit is contained in:
@ -12,6 +12,7 @@
|
||||
#include <esp_lvgl_port.h>
|
||||
#include <esp_psram.h>
|
||||
#include <cstring>
|
||||
#include <src/misc/cache/lv_cache.h>
|
||||
|
||||
#include "board.h"
|
||||
|
||||
@ -568,28 +569,25 @@ void LcdDisplay::SetChatMessage(const char* role, const char* content) {
|
||||
lv_obj_t* msg_text = lv_label_create(msg_bubble);
|
||||
lv_label_set_text(msg_text, content);
|
||||
|
||||
// Calculate actual text width
|
||||
lv_coord_t text_width = lv_txt_get_width(content, strlen(content), text_font, 0);
|
||||
|
||||
// Calculate bubble width
|
||||
// Calculate bubble width constraints
|
||||
lv_coord_t max_width = LV_HOR_RES * 85 / 100 - 16; // 85% of screen width
|
||||
lv_coord_t min_width = 20;
|
||||
lv_coord_t bubble_width;
|
||||
|
||||
// Let LVGL calculate the natural text width first
|
||||
lv_obj_set_width(msg_text, LV_SIZE_CONTENT);
|
||||
lv_obj_update_layout(msg_text);
|
||||
lv_coord_t text_width = lv_obj_get_width(msg_text);
|
||||
|
||||
// Ensure text width is not less than minimum width
|
||||
if (text_width < min_width) {
|
||||
text_width = min_width;
|
||||
}
|
||||
|
||||
// If text width is less than max width, use text width
|
||||
if (text_width < max_width) {
|
||||
bubble_width = text_width;
|
||||
} else {
|
||||
bubble_width = max_width;
|
||||
}
|
||||
// Constrain to max width
|
||||
lv_coord_t bubble_width = (text_width < max_width) ? text_width : max_width;
|
||||
|
||||
// Set message text width
|
||||
lv_obj_set_width(msg_text, bubble_width); // Subtract padding
|
||||
lv_obj_set_width(msg_text, bubble_width);
|
||||
lv_label_set_long_mode(msg_text, LV_LABEL_LONG_WRAP);
|
||||
|
||||
// Set bubble width
|
||||
@ -1113,7 +1111,7 @@ void LcdDisplay::SetTheme(Theme* theme) {
|
||||
if (lv_obj_get_child_cnt(obj) > 0) {
|
||||
// Might be a container, check if it's a user or system message container
|
||||
// User and system message containers are transparent
|
||||
lv_opa_t bg_opa = lv_obj_get_style_bg_opa(obj, 0);
|
||||
lv_opa_t bg_opa = lv_obj_get_style_bg_opa(obj, LV_PART_MAIN);
|
||||
if (bg_opa == LV_OPA_TRANSP) {
|
||||
// This is a user or system message container
|
||||
bubble = lv_obj_get_child(obj, 0);
|
||||
|
||||
@ -30,8 +30,8 @@ typedef struct Table {
|
||||
|
||||
static gd_GIF * gif_open(gd_GIF * gif);
|
||||
static bool f_gif_open(gd_GIF * gif, const void * path, bool is_file);
|
||||
static void f_gif_read(gd_GIF * gif, void * buf, size_t len);
|
||||
static int f_gif_seek(gd_GIF * gif, size_t pos, int k);
|
||||
static inline void f_gif_read(gd_GIF * gif, void * buf, size_t len);
|
||||
static inline int f_gif_seek(gd_GIF * gif, size_t pos, int k);
|
||||
static void f_gif_close(gd_GIF * gif);
|
||||
|
||||
#if LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_HELIUM
|
||||
|
||||
Reference in New Issue
Block a user