Skip to content

Commit

Permalink
Allow setting queue and stack size via user defines
Browse files Browse the repository at this point in the history
[pull request 89](me-no-dev#89)
  • Loading branch information
serek4 committed Oct 23, 2023
1 parent 5b26fe9 commit a6d3812
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
8 changes: 8 additions & 0 deletions Kconfig.projbuild
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,12 @@ config ASYNC_TCP_USE_WDT
help
Enable WDT for the AsyncTCP task, so it will trigger if a handler is locking the thread.

config ASYNC_TCP_STACK
int "Stack size for the AsyncTCP task"
default 16384

config ASYNC_TCP_QUEUE_SIZE
int "Events queue size"
default 32

endmenu
4 changes: 2 additions & 2 deletions src/AsyncTCP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ static uint32_t _closed_index = []() {

static inline bool _init_async_event_queue(){
if(!_async_queue){
_async_queue = xQueueCreate(32, sizeof(lwip_event_packet_t *));
_async_queue = xQueueCreate(CONFIG_ASYNC_TCP_QUEUE_SIZE, sizeof(lwip_event_packet_t *));
if(!_async_queue){
return false;
}
Expand Down Expand Up @@ -218,7 +218,7 @@ static bool _start_async_task(){
return false;
}
if(!_async_service_task_handle){
xTaskCreateUniversal(_async_service_task, "async_tcp", 8192 * 2, NULL, 3, &_async_service_task_handle, CONFIG_ASYNC_TCP_RUNNING_CORE);
xTaskCreateUniversal(_async_service_task, "async_tcp", CONFIG_ASYNC_TCP_STACK, NULL, 3, &_async_service_task_handle, CONFIG_ASYNC_TCP_RUNNING_CORE);
if(!_async_service_task_handle){
return false;
}
Expand Down
6 changes: 6 additions & 0 deletions src/AsyncTCP.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ extern "C" {
#define CONFIG_ASYNC_TCP_RUNNING_CORE -1 //any available core
#define CONFIG_ASYNC_TCP_USE_WDT 1 //if enabled, adds between 33us and 200us per event
#endif
#ifndef CONFIG_ASYNC_TCP_STACK
#define CONFIG_ASYNC_TCP_STACK 8192 * 2
#endif
#ifndef CONFIG_ASYNC_TCP_QUEUE_SIZE
#define CONFIG_ASYNC_TCP_QUEUE_SIZE 32
#endif

class AsyncClient;

Expand Down

0 comments on commit a6d3812

Please sign in to comment.