fix: restore non-display psram usage and clean stale qrcode log

Signed-off-by: Bo <boironic@gmail.com>
This commit is contained in:
Bo
2026-02-19 17:40:00 +08:00
parent 0c256d7653
commit f0a2741e0c
5 changed files with 17 additions and 10 deletions

View File

@@ -172,12 +172,13 @@ static void agent_loop_task(void *arg)
{
ESP_LOGI(TAG, "Agent loop started on core %d", xPortGetCoreID());
char *system_prompt = calloc(1, MIMI_CONTEXT_BUF_SIZE);
char *history_json = calloc(1, MIMI_LLM_STREAM_BUF_SIZE);
char *tool_output = calloc(1, TOOL_OUTPUT_SIZE);
/* Allocate large buffers from PSRAM */
char *system_prompt = heap_caps_calloc(1, MIMI_CONTEXT_BUF_SIZE, MALLOC_CAP_SPIRAM);
char *history_json = heap_caps_calloc(1, MIMI_LLM_STREAM_BUF_SIZE, MALLOC_CAP_SPIRAM);
char *tool_output = heap_caps_calloc(1, TOOL_OUTPUT_SIZE, MALLOC_CAP_SPIRAM);
if (!system_prompt || !history_json || !tool_output) {
ESP_LOGE(TAG, "Failed to allocate runtime buffers");
ESP_LOGE(TAG, "Failed to allocate PSRAM buffers");
vTaskDelete(NULL);
return;
}
@@ -317,8 +318,8 @@ static void agent_loop_task(void *arg)
free(msg.content);
/* Log memory status */
ESP_LOGI(TAG, "Free internal heap: %d bytes",
(int)heap_caps_get_free_size(MALLOC_CAP_INTERNAL));
ESP_LOGI(TAG, "Free PSRAM: %d bytes",
(int)heap_caps_get_free_size(MALLOC_CAP_SPIRAM));
}
}