Skip to content

Commit

Permalink
esp_websocket: core selection parameter added to config espressif#2
Browse files Browse the repository at this point in the history
  • Loading branch information
Andste82 committed Nov 15, 2023
1 parent 38c9ba2 commit 26b7da0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion components/esp_websocket_client/esp_websocket_client.c
Expand Up @@ -71,6 +71,7 @@ ESP_EVENT_DEFINE_BASE(WEBSOCKET_EVENTS);
typedef struct {
int task_stack;
int task_prio;
BaseType_t core_id;
char *uri;
char *host;
char *path;
Expand Down Expand Up @@ -197,6 +198,8 @@ static esp_err_t esp_websocket_client_set_config(esp_websocket_client_handle_t c
cfg->task_stack = WEBSOCKET_TASK_STACK;
}

cfg->core_id = config->core_id;

if (config->host) {
cfg->host = strdup(config->host);
ESP_WS_CLIENT_MEM_CHECK(TAG, cfg->host, return ESP_ERR_NO_MEM);
Expand Down Expand Up @@ -765,7 +768,7 @@ esp_err_t esp_websocket_client_start(esp_websocket_client_handle_t client)
ESP_LOGE(TAG, "The client has started");
return ESP_FAIL;
}
if (xTaskCreate(esp_websocket_client_task, "websocket_task", client->config->task_stack, client, client->config->task_prio, &client->task_handle) != pdTRUE) {
if (xTaskCreatePinnedToCore(esp_websocket_client_task, "websocket_task", client->config->task_stack, client, client->config->task_prio, &client->task_handle, client->config->core_id) != pdTRUE) {
ESP_LOGE(TAG, "Error create websocket task");
return ESP_FAIL;
}
Expand Down
2 changes: 1 addition & 1 deletion components/soc/esp32/include/soc/soc.h
Expand Up @@ -220,7 +220,7 @@
#define CPU_CLK_FREQ_ROM APB_CLK_FREQ_ROM
#define CPU_CLK_FREQ APB_CLK_FREQ //this may be incorrect, please refer to ESP32_DEFAULT_CPU_FREQ_MHZ
#define APB_CLK_FREQ ( 80*1000000 ) //unit: Hz
#define REF_CLK_FREQ ( 2000000 )
#define REF_CLK_FREQ ( 1000000 )
#define UART_CLK_FREQ APB_CLK_FREQ
#define WDT_CLK_FREQ APB_CLK_FREQ
#define TIMER_CLK_FREQ (80000000>>4) //80MHz divided by 16
Expand Down

0 comments on commit 26b7da0

Please sign in to comment.