Browse Source

crash fix

pull/2568/head
Christos Themelis 1 month ago
parent
commit
2b2834bb53
  1. 3
      examples/simple_secure_chat_ui/main.cpp
  2. 1
      examples/simple_secure_chat_ui/uiManager.cpp
  3. 5
      lib/lvgl/lv_conf.h

3
examples/simple_secure_chat_ui/main.cpp

@ -1152,6 +1152,9 @@ void initializeMesh() {
msgstore_load_public(); msgstore_load_public();
uiManager->endPublicHistoryLoad(); uiManager->endPublicHistoryLoad();
Serial.printf("[ui] free heap: %u B free PSRAM: %u B\n",
esp_get_free_heap_size(), esp_get_free_internal_heap_size());
Serial.println("[mesh] Sending self-advert..."); Serial.println("[mesh] Sending self-advert...");
the_mesh.sendSelfAdvert(1200); the_mesh.sendSelfAdvert(1200);
Serial.println("[mesh] Advert queued (1200ms delay)"); Serial.println("[mesh] Advert queued (1200ms delay)");

1
examples/simple_secure_chat_ui/uiManager.cpp

@ -272,6 +272,7 @@ void UIManager::addPrivateChatBubble(const char *time_str, const char *msg, bool
LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_START,
LV_FLEX_ALIGN_START LV_FLEX_ALIGN_START
); );
if (!row) { Serial.println("[ui] OOM: addPrivateChatBubble row alloc failed"); return; }
// 2. Bubble column: message text + timestamp below // 2. Bubble column: message text + timestamp below
lv_obj_t* aligner = LvObj(row) lv_obj_t* aligner = LvObj(row)

5
lib/lvgl/lv_conf.h

@ -46,7 +46,10 @@
*=========================*/ *=========================*/
/*1: use custom malloc/free, 0: use the built-in `lv_mem_alloc()` and `lv_mem_free()`*/ /*1: use custom malloc/free, 0: use the built-in `lv_mem_alloc()` and `lv_mem_free()`*/
#define LV_MEM_CUSTOM 0 /* ESP32-S3 has 8 MB OPI PSRAM. Switching to LV_MEM_CUSTOM=1 lets LVGL use the
system heap (which includes PSRAM on this board) instead of a fixed 48 KB
static pool. This prevents OOM crashes when loading many chat bubbles. */
#define LV_MEM_CUSTOM 1
#if LV_MEM_CUSTOM == 0 #if LV_MEM_CUSTOM == 0
/*Size of the memory available for `lv_mem_alloc()` in bytes (>= 2kB)*/ /*Size of the memory available for `lv_mem_alloc()` in bytes (>= 2kB)*/
#define LV_MEM_SIZE (48U * 1024U) /*[bytes]*/ #define LV_MEM_SIZE (48U * 1024U) /*[bytes]*/

Loading…
Cancel
Save