整理任务使用的cpu
新增配置: CONFIG_TQ_NETWORK_TASK_CORE=0 CONFIG_TQ_LOCAL_TASK_CORE=1 网络类任务默认固定到 Core 0: cp_ws_wait cp_wifi_state cp_fortune mm_autostart mm_watchdog mm_ws_ordered mm_ws_stop lan_http 本地类任务默认固定到 Core 1: cp_model_cmd cp_direction cp_lcd_render cp_task_monitor cp_system_event cp_key_input factory_cli mm_local_evt 已有音频任务保持现有配置: CONFIG_MULTIMODAL_AUDIO_TASK_CORE=1
This commit is contained in:
@@ -47,6 +47,16 @@
|
|||||||
#define CONTROL_PLANE_IDLE_TRANSPORT_SHUTDOWN_MS 30000
|
#define CONTROL_PLANE_IDLE_TRANSPORT_SHUTDOWN_MS 30000
|
||||||
#define CONTROL_PLANE_WATCHDOG_TASK_STACK_SIZE 6144
|
#define CONTROL_PLANE_WATCHDOG_TASK_STACK_SIZE 6144
|
||||||
|
|
||||||
|
#ifndef CONFIG_TQ_NETWORK_TASK_CORE
|
||||||
|
#define CONFIG_TQ_NETWORK_TASK_CORE 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if CONFIG_TQ_NETWORK_TASK_CORE < 0
|
||||||
|
#define CONTROL_PLANE_MULTIMODAL_NETWORK_TASK_CORE tskNO_AFFINITY
|
||||||
|
#else
|
||||||
|
#define CONTROL_PLANE_MULTIMODAL_NETWORK_TASK_CORE ((BaseType_t)CONFIG_TQ_NETWORK_TASK_CORE)
|
||||||
|
#endif
|
||||||
|
|
||||||
static const char *TAG = "control_plane_mm_rt";
|
static const char *TAG = "control_plane_mm_rt";
|
||||||
static TaskHandle_t s_multimodal_watchdog_task;
|
static TaskHandle_t s_multimodal_watchdog_task;
|
||||||
static TaskHandle_t s_multimodal_autostart_task;
|
static TaskHandle_t s_multimodal_autostart_task;
|
||||||
@@ -434,12 +444,13 @@ static void schedule_autostart_if_enabled(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
set_multimodal_stop_flag(&s_multimodal_autostart_stop_requested, false);
|
set_multimodal_stop_flag(&s_multimodal_autostart_stop_requested, false);
|
||||||
if (xTaskCreate(multimodal_autostart_task,
|
if (xTaskCreatePinnedToCore(multimodal_autostart_task,
|
||||||
"mm_autostart",
|
"mm_autostart",
|
||||||
6144,
|
6144,
|
||||||
NULL,
|
NULL,
|
||||||
4,
|
4,
|
||||||
&s_multimodal_autostart_task) != pdPASS) {
|
&s_multimodal_autostart_task,
|
||||||
|
CONTROL_PLANE_MULTIMODAL_NETWORK_TASK_CORE) != pdPASS) {
|
||||||
set_multimodal_task_handle(&s_multimodal_autostart_task, NULL);
|
set_multimodal_task_handle(&s_multimodal_autostart_task, NULL);
|
||||||
set_multimodal_start_flag(&s_multimodal_autostart_task_starting, false);
|
set_multimodal_start_flag(&s_multimodal_autostart_task_starting, false);
|
||||||
ESP_LOGW(TAG, "Auto Start task create failed");
|
ESP_LOGW(TAG, "Auto Start task create failed");
|
||||||
@@ -646,12 +657,13 @@ esp_err_t control_plane_start_multimodal_client(void)
|
|||||||
try_begin_multimodal_task_start(&s_multimodal_watchdog_task,
|
try_begin_multimodal_task_start(&s_multimodal_watchdog_task,
|
||||||
&s_multimodal_watchdog_task_starting)) {
|
&s_multimodal_watchdog_task_starting)) {
|
||||||
set_multimodal_stop_flag(&s_multimodal_watchdog_stop_requested, false);
|
set_multimodal_stop_flag(&s_multimodal_watchdog_stop_requested, false);
|
||||||
if (xTaskCreate(multimodal_watchdog_task,
|
if (xTaskCreatePinnedToCore(multimodal_watchdog_task,
|
||||||
"mm_watchdog",
|
"mm_watchdog",
|
||||||
CONTROL_PLANE_WATCHDOG_TASK_STACK_SIZE,
|
CONTROL_PLANE_WATCHDOG_TASK_STACK_SIZE,
|
||||||
NULL,
|
NULL,
|
||||||
4,
|
4,
|
||||||
&s_multimodal_watchdog_task) != pdPASS) {
|
&s_multimodal_watchdog_task,
|
||||||
|
CONTROL_PLANE_MULTIMODAL_NETWORK_TASK_CORE) != pdPASS) {
|
||||||
ESP_LOGE(TAG, "Watchdog task create failed");
|
ESP_LOGE(TAG, "Watchdog task create failed");
|
||||||
set_multimodal_task_handle(&s_multimodal_watchdog_task, NULL);
|
set_multimodal_task_handle(&s_multimodal_watchdog_task, NULL);
|
||||||
set_multimodal_start_flag(&s_multimodal_watchdog_task_starting, false);
|
set_multimodal_start_flag(&s_multimodal_watchdog_task_starting, false);
|
||||||
|
|||||||
@@ -84,6 +84,16 @@
|
|||||||
#define CONTROL_PLANE_LOCAL_RESPONDING_EVENT_QUEUE_LEN 4U
|
#define CONTROL_PLANE_LOCAL_RESPONDING_EVENT_QUEUE_LEN 4U
|
||||||
#define CONTROL_PLANE_MULTIMODAL_BINARY_SUMMARY_INTERVAL 200U
|
#define CONTROL_PLANE_MULTIMODAL_BINARY_SUMMARY_INTERVAL 200U
|
||||||
|
|
||||||
|
#ifndef CONFIG_TQ_LOCAL_TASK_CORE
|
||||||
|
#define CONFIG_TQ_LOCAL_TASK_CORE 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if CONFIG_TQ_LOCAL_TASK_CORE < 0
|
||||||
|
#define CONTROL_PLANE_LOCAL_RESPONDING_TASK_CORE tskNO_AFFINITY
|
||||||
|
#else
|
||||||
|
#define CONTROL_PLANE_LOCAL_RESPONDING_TASK_CORE ((BaseType_t)CONFIG_TQ_LOCAL_TASK_CORE)
|
||||||
|
#endif
|
||||||
|
|
||||||
#if ( configSUPPORT_STATIC_ALLOCATION == 1 ) && \
|
#if ( configSUPPORT_STATIC_ALLOCATION == 1 ) && \
|
||||||
((defined(CONFIG_FREERTOS_TASK_CREATE_ALLOW_EXT_MEM) && CONFIG_FREERTOS_TASK_CREATE_ALLOW_EXT_MEM) || \
|
((defined(CONFIG_FREERTOS_TASK_CREATE_ALLOW_EXT_MEM) && CONFIG_FREERTOS_TASK_CREATE_ALLOW_EXT_MEM) || \
|
||||||
defined(CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY))
|
defined(CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY))
|
||||||
@@ -210,7 +220,7 @@ static BaseType_t create_local_responding_event_task(TaskHandle_t *out_handle)
|
|||||||
NULL,
|
NULL,
|
||||||
CONTROL_PLANE_LOCAL_RESPONDING_EVENT_TASK_PRIORITY,
|
CONTROL_PLANE_LOCAL_RESPONDING_EVENT_TASK_PRIORITY,
|
||||||
out_handle,
|
out_handle,
|
||||||
tskNO_AFFINITY,
|
CONTROL_PLANE_LOCAL_RESPONDING_TASK_CORE,
|
||||||
MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT);
|
MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT);
|
||||||
if (created == pdPASS) {
|
if (created == pdPASS) {
|
||||||
return pdPASS;
|
return pdPASS;
|
||||||
@@ -223,15 +233,16 @@ static BaseType_t create_local_responding_event_task(TaskHandle_t *out_handle)
|
|||||||
NULL,
|
NULL,
|
||||||
CONTROL_PLANE_LOCAL_RESPONDING_EVENT_TASK_PRIORITY,
|
CONTROL_PLANE_LOCAL_RESPONDING_EVENT_TASK_PRIORITY,
|
||||||
out_handle,
|
out_handle,
|
||||||
tskNO_AFFINITY,
|
CONTROL_PLANE_LOCAL_RESPONDING_TASK_CORE,
|
||||||
MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT);
|
MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT);
|
||||||
#else
|
#else
|
||||||
return xTaskCreate(local_responding_event_worker,
|
return xTaskCreatePinnedToCore(local_responding_event_worker,
|
||||||
"mm_local_evt",
|
"mm_local_evt",
|
||||||
CONTROL_PLANE_LOCAL_RESPONDING_EVENT_TASK_STACK_BYTES,
|
CONTROL_PLANE_LOCAL_RESPONDING_EVENT_TASK_STACK_BYTES,
|
||||||
NULL,
|
NULL,
|
||||||
CONTROL_PLANE_LOCAL_RESPONDING_EVENT_TASK_PRIORITY,
|
CONTROL_PLANE_LOCAL_RESPONDING_EVENT_TASK_PRIORITY,
|
||||||
out_handle);
|
out_handle,
|
||||||
|
CONTROL_PLANE_LOCAL_RESPONDING_TASK_CORE);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,16 @@
|
|||||||
#define FACTORY_CLI_START_WAIT_STEP_MS 20
|
#define FACTORY_CLI_START_WAIT_STEP_MS 20
|
||||||
#define FACTORY_CLI_START_GATE_WAIT_MS 5000
|
#define FACTORY_CLI_START_GATE_WAIT_MS 5000
|
||||||
|
|
||||||
|
#ifndef CONFIG_TQ_LOCAL_TASK_CORE
|
||||||
|
#define CONFIG_TQ_LOCAL_TASK_CORE 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if CONFIG_TQ_LOCAL_TASK_CORE < 0
|
||||||
|
#define FACTORY_CLI_TASK_CORE tskNO_AFFINITY
|
||||||
|
#else
|
||||||
|
#define FACTORY_CLI_TASK_CORE ((BaseType_t)CONFIG_TQ_LOCAL_TASK_CORE)
|
||||||
|
#endif
|
||||||
|
|
||||||
static const char *TAG = "cp_factory_cli";
|
static const char *TAG = "cp_factory_cli";
|
||||||
|
|
||||||
static TaskHandle_t s_worker_task;
|
static TaskHandle_t s_worker_task;
|
||||||
@@ -496,12 +506,13 @@ esp_err_t control_plane_factory_cli_start(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
TaskHandle_t worker_task = NULL;
|
TaskHandle_t worker_task = NULL;
|
||||||
BaseType_t ok = xTaskCreate(factory_cli_worker_entry,
|
BaseType_t ok = xTaskCreatePinnedToCore(factory_cli_worker_entry,
|
||||||
"factory_cli",
|
"factory_cli",
|
||||||
FACTORY_CLI_WORKER_STACK_BYTES,
|
FACTORY_CLI_WORKER_STACK_BYTES,
|
||||||
NULL,
|
NULL,
|
||||||
FACTORY_CLI_WORKER_PRIORITY,
|
FACTORY_CLI_WORKER_PRIORITY,
|
||||||
&worker_task);
|
&worker_task,
|
||||||
|
FACTORY_CLI_TASK_CORE);
|
||||||
if (ok != pdPASS) {
|
if (ok != pdPASS) {
|
||||||
factory_cli_finish_start(NULL);
|
factory_cli_finish_start(NULL);
|
||||||
ESP_LOGE(TAG, "Failed to start factory CLI worker");
|
ESP_LOGE(TAG, "Failed to start factory CLI worker");
|
||||||
|
|||||||
@@ -48,6 +48,16 @@
|
|||||||
#define CONFIG_TQ_KEY_INPUT_POLL_MS 20
|
#define CONFIG_TQ_KEY_INPUT_POLL_MS 20
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef CONFIG_TQ_LOCAL_TASK_CORE
|
||||||
|
#define CONFIG_TQ_LOCAL_TASK_CORE 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if CONFIG_TQ_LOCAL_TASK_CORE < 0
|
||||||
|
#define CONTROL_PLANE_KEY_INPUT_TASK_CORE tskNO_AFFINITY
|
||||||
|
#else
|
||||||
|
#define CONTROL_PLANE_KEY_INPUT_TASK_CORE ((BaseType_t)CONFIG_TQ_LOCAL_TASK_CORE)
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef CONFIG_MULTIMODAL_PTT_BUTTON_PULLDOWN
|
#ifndef CONFIG_MULTIMODAL_PTT_BUTTON_PULLDOWN
|
||||||
#define CONFIG_MULTIMODAL_PTT_BUTTON_PULLDOWN 0
|
#define CONFIG_MULTIMODAL_PTT_BUTTON_PULLDOWN 0
|
||||||
#endif
|
#endif
|
||||||
@@ -464,12 +474,13 @@ esp_err_t control_plane_start_key_input_task(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
s_stop_requested = false;
|
s_stop_requested = false;
|
||||||
BaseType_t created = xTaskCreate(control_plane_key_input_task,
|
BaseType_t created = xTaskCreatePinnedToCore(control_plane_key_input_task,
|
||||||
"cp_key_input",
|
"cp_key_input",
|
||||||
CONFIG_TQ_KEY_INPUT_TASK_STACK,
|
CONFIG_TQ_KEY_INPUT_TASK_STACK,
|
||||||
NULL,
|
NULL,
|
||||||
5,
|
5,
|
||||||
&s_key_input_task);
|
&s_key_input_task,
|
||||||
|
CONTROL_PLANE_KEY_INPUT_TASK_CORE);
|
||||||
if (created != pdPASS) {
|
if (created != pdPASS) {
|
||||||
s_key_input_task = NULL;
|
s_key_input_task = NULL;
|
||||||
return ESP_ERR_NO_MEM;
|
return ESP_ERR_NO_MEM;
|
||||||
|
|||||||
@@ -74,6 +74,26 @@
|
|||||||
#define CONFIG_TQ_TASK_MONITOR_MAX_TASKS 64
|
#define CONFIG_TQ_TASK_MONITOR_MAX_TASKS 64
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef CONFIG_TQ_NETWORK_TASK_CORE
|
||||||
|
#define CONFIG_TQ_NETWORK_TASK_CORE 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef CONFIG_TQ_LOCAL_TASK_CORE
|
||||||
|
#define CONFIG_TQ_LOCAL_TASK_CORE 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if CONFIG_TQ_NETWORK_TASK_CORE < 0
|
||||||
|
#define CONTROL_PLANE_NETWORK_TASK_CORE tskNO_AFFINITY
|
||||||
|
#else
|
||||||
|
#define CONTROL_PLANE_NETWORK_TASK_CORE ((BaseType_t)CONFIG_TQ_NETWORK_TASK_CORE)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if CONFIG_TQ_LOCAL_TASK_CORE < 0
|
||||||
|
#define CONTROL_PLANE_LOCAL_TASK_CORE tskNO_AFFINITY
|
||||||
|
#else
|
||||||
|
#define CONTROL_PLANE_LOCAL_TASK_CORE ((BaseType_t)CONFIG_TQ_LOCAL_TASK_CORE)
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef CONFIG_FORTUNE_SNTP_SERVER
|
#ifndef CONFIG_FORTUNE_SNTP_SERVER
|
||||||
#define CONFIG_FORTUNE_SNTP_SERVER "ntp.aliyun.com"
|
#define CONFIG_FORTUNE_SNTP_SERVER "ntp.aliyun.com"
|
||||||
#endif
|
#endif
|
||||||
@@ -358,6 +378,7 @@ static esp_err_t control_plane_create_task(TaskFunction_t task,
|
|||||||
const char *name,
|
const char *name,
|
||||||
uint32_t stack_size,
|
uint32_t stack_size,
|
||||||
UBaseType_t priority,
|
UBaseType_t priority,
|
||||||
|
BaseType_t core_id,
|
||||||
TaskHandle_t *out_handle)
|
TaskHandle_t *out_handle)
|
||||||
{
|
{
|
||||||
if (task == NULL || out_handle == NULL) {
|
if (task == NULL || out_handle == NULL) {
|
||||||
@@ -372,7 +393,13 @@ static esp_err_t control_plane_create_task(TaskFunction_t task,
|
|||||||
ctx->task_with_caps = false;
|
ctx->task_with_caps = false;
|
||||||
|
|
||||||
TaskHandle_t task_handle = NULL;
|
TaskHandle_t task_handle = NULL;
|
||||||
if (xTaskCreate(control_plane_task_start_gate, name, stack_size, ctx, priority, &task_handle) != pdPASS) {
|
if (xTaskCreatePinnedToCore(control_plane_task_start_gate,
|
||||||
|
name,
|
||||||
|
stack_size,
|
||||||
|
ctx,
|
||||||
|
priority,
|
||||||
|
&task_handle,
|
||||||
|
core_id) != pdPASS) {
|
||||||
free(ctx);
|
free(ctx);
|
||||||
ESP_LOGE(TAG, "Task create failed: %s", name);
|
ESP_LOGE(TAG, "Task create failed: %s", name);
|
||||||
return ESP_ERR_NO_MEM;
|
return ESP_ERR_NO_MEM;
|
||||||
@@ -387,6 +414,7 @@ static esp_err_t control_plane_create_task_psram_first(TaskFunction_t task,
|
|||||||
const char *name,
|
const char *name,
|
||||||
uint32_t stack_size,
|
uint32_t stack_size,
|
||||||
UBaseType_t priority,
|
UBaseType_t priority,
|
||||||
|
BaseType_t core_id,
|
||||||
TaskHandle_t *out_handle)
|
TaskHandle_t *out_handle)
|
||||||
{
|
{
|
||||||
if (task == NULL || out_handle == NULL) {
|
if (task == NULL || out_handle == NULL) {
|
||||||
@@ -408,7 +436,7 @@ static esp_err_t control_plane_create_task_psram_first(TaskFunction_t task,
|
|||||||
ctx,
|
ctx,
|
||||||
priority,
|
priority,
|
||||||
&task_handle,
|
&task_handle,
|
||||||
tskNO_AFFINITY,
|
core_id,
|
||||||
MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT);
|
MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT);
|
||||||
if (created != pdPASS) {
|
if (created != pdPASS) {
|
||||||
ESP_LOGW(TAG, "Task create with PSRAM stack failed: %s, fallback to internal stack", name);
|
ESP_LOGW(TAG, "Task create with PSRAM stack failed: %s, fallback to internal stack", name);
|
||||||
@@ -418,17 +446,18 @@ static esp_err_t control_plane_create_task_psram_first(TaskFunction_t task,
|
|||||||
ctx,
|
ctx,
|
||||||
priority,
|
priority,
|
||||||
&task_handle,
|
&task_handle,
|
||||||
tskNO_AFFINITY,
|
core_id,
|
||||||
MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT);
|
MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
ctx->task_with_caps = false;
|
ctx->task_with_caps = false;
|
||||||
BaseType_t created = xTaskCreate(control_plane_task_start_gate,
|
BaseType_t created = xTaskCreatePinnedToCore(control_plane_task_start_gate,
|
||||||
name,
|
name,
|
||||||
stack_size,
|
stack_size,
|
||||||
ctx,
|
ctx,
|
||||||
priority,
|
priority,
|
||||||
&task_handle);
|
&task_handle,
|
||||||
|
core_id);
|
||||||
#endif
|
#endif
|
||||||
if (created != pdPASS) {
|
if (created != pdPASS) {
|
||||||
free(ctx);
|
free(ctx);
|
||||||
@@ -718,6 +747,7 @@ static esp_err_t control_plane_schedule_websocket_wait_task(void)
|
|||||||
"cp_ws_wait",
|
"cp_ws_wait",
|
||||||
CONTROL_PLANE_WS_WAIT_TASK_STACK_SIZE,
|
CONTROL_PLANE_WS_WAIT_TASK_STACK_SIZE,
|
||||||
4,
|
4,
|
||||||
|
CONTROL_PLANE_NETWORK_TASK_CORE,
|
||||||
&s_ws_wait_task);
|
&s_ws_wait_task);
|
||||||
portENTER_CRITICAL(&s_runtime_lock);
|
portENTER_CRITICAL(&s_runtime_lock);
|
||||||
s_ws_wait_task_starting = false;
|
s_ws_wait_task_starting = false;
|
||||||
@@ -1453,6 +1483,7 @@ esp_err_t control_plane_start_runtime_workers(void)
|
|||||||
"cp_model_cmd",
|
"cp_model_cmd",
|
||||||
CONTROL_PLANE_MODEL_CMD_TASK_STACK_SIZE,
|
CONTROL_PLANE_MODEL_CMD_TASK_STACK_SIZE,
|
||||||
5,
|
5,
|
||||||
|
CONTROL_PLANE_LOCAL_TASK_CORE,
|
||||||
&s_model_cmd_task);
|
&s_model_cmd_task);
|
||||||
if (task_err != ESP_OK) {
|
if (task_err != ESP_OK) {
|
||||||
control_plane_stop_runtime_workers();
|
control_plane_stop_runtime_workers();
|
||||||
@@ -1473,6 +1504,7 @@ esp_err_t control_plane_start_runtime_workers(void)
|
|||||||
"cp_direction",
|
"cp_direction",
|
||||||
CONTROL_PLANE_DIRECTION_TASK_STACK_SIZE,
|
CONTROL_PLANE_DIRECTION_TASK_STACK_SIZE,
|
||||||
5,
|
5,
|
||||||
|
CONTROL_PLANE_LOCAL_TASK_CORE,
|
||||||
&s_direction_console_task);
|
&s_direction_console_task);
|
||||||
if (task_err != ESP_OK) {
|
if (task_err != ESP_OK) {
|
||||||
control_plane_stop_runtime_workers();
|
control_plane_stop_runtime_workers();
|
||||||
@@ -1486,6 +1518,7 @@ esp_err_t control_plane_start_runtime_workers(void)
|
|||||||
"cp_lcd_render",
|
"cp_lcd_render",
|
||||||
CONTROL_PLANE_LCD_RENDER_LOOP_TASK_STACK_SIZE,
|
CONTROL_PLANE_LCD_RENDER_LOOP_TASK_STACK_SIZE,
|
||||||
4,
|
4,
|
||||||
|
CONTROL_PLANE_LOCAL_TASK_CORE,
|
||||||
&s_lcd_render_loop_task);
|
&s_lcd_render_loop_task);
|
||||||
if (task_err != ESP_OK) {
|
if (task_err != ESP_OK) {
|
||||||
control_plane_stop_runtime_workers();
|
control_plane_stop_runtime_workers();
|
||||||
@@ -1501,6 +1534,7 @@ esp_err_t control_plane_start_runtime_workers(void)
|
|||||||
"cp_wifi_state",
|
"cp_wifi_state",
|
||||||
CONTROL_PLANE_WIFI_STATE_TASK_STACK_SIZE,
|
CONTROL_PLANE_WIFI_STATE_TASK_STACK_SIZE,
|
||||||
4,
|
4,
|
||||||
|
CONTROL_PLANE_NETWORK_TASK_CORE,
|
||||||
&s_wifi_state_task);
|
&s_wifi_state_task);
|
||||||
if (task_err != ESP_OK) {
|
if (task_err != ESP_OK) {
|
||||||
control_plane_stop_runtime_workers();
|
control_plane_stop_runtime_workers();
|
||||||
@@ -1514,6 +1548,7 @@ esp_err_t control_plane_start_runtime_workers(void)
|
|||||||
"cp_task_monitor",
|
"cp_task_monitor",
|
||||||
CONTROL_PLANE_TASK_MONITOR_TASK_STACK_SIZE,
|
CONTROL_PLANE_TASK_MONITOR_TASK_STACK_SIZE,
|
||||||
3,
|
3,
|
||||||
|
CONTROL_PLANE_LOCAL_TASK_CORE,
|
||||||
&s_task_monitor_task);
|
&s_task_monitor_task);
|
||||||
if (task_err != ESP_OK) {
|
if (task_err != ESP_OK) {
|
||||||
control_plane_stop_runtime_workers();
|
control_plane_stop_runtime_workers();
|
||||||
@@ -1541,6 +1576,7 @@ esp_err_t control_plane_start_runtime_workers(void)
|
|||||||
"cp_fortune",
|
"cp_fortune",
|
||||||
CONTROL_PLANE_FORTUNE_TASK_STACK_SIZE,
|
CONTROL_PLANE_FORTUNE_TASK_STACK_SIZE,
|
||||||
4,
|
4,
|
||||||
|
CONTROL_PLANE_NETWORK_TASK_CORE,
|
||||||
&s_daily_fortune_task);
|
&s_daily_fortune_task);
|
||||||
if (task_err != ESP_OK) {
|
if (task_err != ESP_OK) {
|
||||||
control_plane_stop_runtime_workers();
|
control_plane_stop_runtime_workers();
|
||||||
|
|||||||
@@ -30,6 +30,16 @@
|
|||||||
#define CONFIG_TQ_SYSTEM_EVENT_TASK_STACK 4096
|
#define CONFIG_TQ_SYSTEM_EVENT_TASK_STACK 4096
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef CONFIG_TQ_LOCAL_TASK_CORE
|
||||||
|
#define CONFIG_TQ_LOCAL_TASK_CORE 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if CONFIG_TQ_LOCAL_TASK_CORE < 0
|
||||||
|
#define CONTROL_PLANE_SYSTEM_EVENT_TASK_CORE tskNO_AFFINITY
|
||||||
|
#else
|
||||||
|
#define CONTROL_PLANE_SYSTEM_EVENT_TASK_CORE ((BaseType_t)CONFIG_TQ_LOCAL_TASK_CORE)
|
||||||
|
#endif
|
||||||
|
|
||||||
static const char *TAG = "cp_system_event";
|
static const char *TAG = "cp_system_event";
|
||||||
|
|
||||||
static QueueHandle_t s_system_event_queue;
|
static QueueHandle_t s_system_event_queue;
|
||||||
@@ -192,12 +202,13 @@ esp_err_t control_plane_start_system_event_task(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
s_stop_requested = false;
|
s_stop_requested = false;
|
||||||
BaseType_t created = xTaskCreate(control_plane_system_event_task,
|
BaseType_t created = xTaskCreatePinnedToCore(control_plane_system_event_task,
|
||||||
"cp_system_event",
|
"cp_system_event",
|
||||||
CONFIG_TQ_SYSTEM_EVENT_TASK_STACK,
|
CONFIG_TQ_SYSTEM_EVENT_TASK_STACK,
|
||||||
NULL,
|
NULL,
|
||||||
4,
|
4,
|
||||||
&s_system_event_task);
|
&s_system_event_task,
|
||||||
|
CONTROL_PLANE_SYSTEM_EVENT_TASK_CORE);
|
||||||
if (created != pdPASS) {
|
if (created != pdPASS) {
|
||||||
s_system_event_task = NULL;
|
s_system_event_task = NULL;
|
||||||
return ESP_ERR_NO_MEM;
|
return ESP_ERR_NO_MEM;
|
||||||
|
|||||||
@@ -94,10 +94,14 @@
|
|||||||
#define CONFIG_MULTIMODAL_AUDIO_TASK_CORE 1
|
#define CONFIG_MULTIMODAL_AUDIO_TASK_CORE 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if CONFIG_MULTIMODAL_AUDIO_TASK_CORE < 0
|
#ifndef CONFIG_TQ_NETWORK_TASK_CORE
|
||||||
#define MULTIMODAL_AUDIO_CORE_ID tskNO_AFFINITY
|
#define CONFIG_TQ_NETWORK_TASK_CORE 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if CONFIG_TQ_NETWORK_TASK_CORE < 0
|
||||||
|
#define MULTIMODAL_WS_CORE_ID tskNO_AFFINITY
|
||||||
#else
|
#else
|
||||||
#define MULTIMODAL_AUDIO_CORE_ID ((BaseType_t)CONFIG_MULTIMODAL_AUDIO_TASK_CORE)
|
#define MULTIMODAL_WS_CORE_ID ((BaseType_t)CONFIG_TQ_NETWORK_TASK_CORE)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define WS_OPCODE_TEXT 0x1
|
#define WS_OPCODE_TEXT 0x1
|
||||||
|
|||||||
@@ -368,7 +368,7 @@ static esp_err_t ws_start_async_stop(void)
|
|||||||
5,
|
5,
|
||||||
&task,
|
&task,
|
||||||
true,
|
true,
|
||||||
tskNO_AFFINITY);
|
MULTIMODAL_WS_CORE_ID);
|
||||||
if (ok != pdPASS) {
|
if (ok != pdPASS) {
|
||||||
ws_set_async_stop_task(NULL);
|
ws_set_async_stop_task(NULL);
|
||||||
ESP_LOGE(TAG, "Create WebSocket async stop task failed");
|
ESP_LOGE(TAG, "Create WebSocket async stop task failed");
|
||||||
|
|||||||
@@ -641,7 +641,7 @@ static esp_err_t create_worker_pipeline(void)
|
|||||||
CONFIG_MULTIMODAL_WEBSOCKET_TASK_PRIORITY,
|
CONFIG_MULTIMODAL_WEBSOCKET_TASK_PRIORITY,
|
||||||
&s_ws_dispatch_task,
|
&s_ws_dispatch_task,
|
||||||
true,
|
true,
|
||||||
tskNO_AFFINITY) != pdPASS) {
|
MULTIMODAL_WS_CORE_ID) != pdPASS) {
|
||||||
(void)destroy_worker_pipeline_until(
|
(void)destroy_worker_pipeline_until(
|
||||||
ws_stop_deadline_from_timeout(MULTIMODAL_WS_WORKER_STOP_WAIT_MS));
|
ws_stop_deadline_from_timeout(MULTIMODAL_WS_WORKER_STOP_WAIT_MS));
|
||||||
return ESP_ERR_NO_MEM;
|
return ESP_ERR_NO_MEM;
|
||||||
|
|||||||
@@ -35,6 +35,16 @@
|
|||||||
#define LAN_HTTP_START_TIMEOUT_MS 1500
|
#define LAN_HTTP_START_TIMEOUT_MS 1500
|
||||||
#define LAN_HTTP_STOP_POLL_MS 20
|
#define LAN_HTTP_STOP_POLL_MS 20
|
||||||
|
|
||||||
|
#ifndef CONFIG_TQ_NETWORK_TASK_CORE
|
||||||
|
#define CONFIG_TQ_NETWORK_TASK_CORE 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if CONFIG_TQ_NETWORK_TASK_CORE < 0
|
||||||
|
#define LAN_HTTP_TASK_CORE tskNO_AFFINITY
|
||||||
|
#else
|
||||||
|
#define LAN_HTTP_TASK_CORE ((BaseType_t)CONFIG_TQ_NETWORK_TASK_CORE)
|
||||||
|
#endif
|
||||||
|
|
||||||
#if (configSUPPORT_STATIC_ALLOCATION == 1) && \
|
#if (configSUPPORT_STATIC_ALLOCATION == 1) && \
|
||||||
((defined(CONFIG_FREERTOS_TASK_CREATE_ALLOW_EXT_MEM) && CONFIG_FREERTOS_TASK_CREATE_ALLOW_EXT_MEM) || \
|
((defined(CONFIG_FREERTOS_TASK_CREATE_ALLOW_EXT_MEM) && CONFIG_FREERTOS_TASK_CREATE_ALLOW_EXT_MEM) || \
|
||||||
defined(CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY))
|
defined(CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY))
|
||||||
@@ -111,7 +121,7 @@ static BaseType_t lan_http_create_task(TaskHandle_t *out_handle)
|
|||||||
NULL,
|
NULL,
|
||||||
LAN_HTTP_TASK_PRIORITY,
|
LAN_HTTP_TASK_PRIORITY,
|
||||||
out_handle,
|
out_handle,
|
||||||
tskNO_AFFINITY,
|
LAN_HTTP_TASK_CORE,
|
||||||
MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT);
|
MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT);
|
||||||
if (created == pdPASS) {
|
if (created == pdPASS) {
|
||||||
return pdPASS;
|
return pdPASS;
|
||||||
@@ -124,15 +134,16 @@ static BaseType_t lan_http_create_task(TaskHandle_t *out_handle)
|
|||||||
NULL,
|
NULL,
|
||||||
LAN_HTTP_TASK_PRIORITY,
|
LAN_HTTP_TASK_PRIORITY,
|
||||||
out_handle,
|
out_handle,
|
||||||
tskNO_AFFINITY,
|
LAN_HTTP_TASK_CORE,
|
||||||
MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT);
|
MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT);
|
||||||
#else
|
#else
|
||||||
return xTaskCreate(server_task,
|
return xTaskCreatePinnedToCore(server_task,
|
||||||
"lan_http",
|
"lan_http",
|
||||||
LAN_HTTP_TASK_STACK_SIZE,
|
LAN_HTTP_TASK_STACK_SIZE,
|
||||||
NULL,
|
NULL,
|
||||||
LAN_HTTP_TASK_PRIORITY,
|
LAN_HTTP_TASK_PRIORITY,
|
||||||
out_handle);
|
out_handle,
|
||||||
|
LAN_HTTP_TASK_CORE);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -72,6 +72,22 @@ menu "Example Configuration"
|
|||||||
Optional boot sound file path for the voice prompt backend.
|
Optional boot sound file path for the voice prompt backend.
|
||||||
Leave empty to use the semantic connecting prompt fallback.
|
Leave empty to use the semantic connecting prompt fallback.
|
||||||
|
|
||||||
|
config TQ_NETWORK_TASK_CORE
|
||||||
|
int "Network task core (-1 for no affinity)"
|
||||||
|
default 0
|
||||||
|
range -1 1
|
||||||
|
help
|
||||||
|
Core used for control-plane and platform network workers such
|
||||||
|
as WebSocket wait, Wi-Fi state, LAN HTTP, and fortune refresh.
|
||||||
|
|
||||||
|
config TQ_LOCAL_TASK_CORE
|
||||||
|
int "Local task core (-1 for no affinity)"
|
||||||
|
default 1
|
||||||
|
range -1 1
|
||||||
|
help
|
||||||
|
Core used for local device workers such as LCD rendering,
|
||||||
|
key input, system events, direction console, and diagnostics.
|
||||||
|
|
||||||
config TQ_TASK_MONITOR_ENABLE
|
config TQ_TASK_MONITOR_ENABLE
|
||||||
bool "Enable periodic FreeRTOS task monitor log"
|
bool "Enable periodic FreeRTOS task monitor log"
|
||||||
default y
|
default y
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ CONFIG_TQ_TASK_MONITOR_ENABLE=y
|
|||||||
# CONFIG_TQ_BOOT_SEQUENCE_DRY_RUN is not set
|
# CONFIG_TQ_BOOT_SEQUENCE_DRY_RUN is not set
|
||||||
CONFIG_TQ_BOOT_SOUND_TIMEOUT_MS=3000
|
CONFIG_TQ_BOOT_SOUND_TIMEOUT_MS=3000
|
||||||
CONFIG_TQ_BOOT_SOUND_FILE=""
|
CONFIG_TQ_BOOT_SOUND_FILE=""
|
||||||
|
CONFIG_TQ_NETWORK_TASK_CORE=0
|
||||||
|
CONFIG_TQ_LOCAL_TASK_CORE=1
|
||||||
CONFIG_TQ_TASK_MONITOR_INTERVAL_MS=10000
|
CONFIG_TQ_TASK_MONITOR_INTERVAL_MS=10000
|
||||||
CONFIG_TQ_TASK_MONITOR_MAX_TASKS=64
|
CONFIG_TQ_TASK_MONITOR_MAX_TASKS=64
|
||||||
CONFIG_TQ_SYSTEM_EVENT_ENABLE=y
|
CONFIG_TQ_SYSTEM_EVENT_ENABLE=y
|
||||||
|
|||||||
Reference in New Issue
Block a user