Skip to content

Commit 2d5b64e

Browse files
committed
Allow setting queue and stack size via user defines
1 parent ae10c69 commit 2d5b64e

3 files changed

Lines changed: 17 additions & 2 deletions

File tree

Kconfig.projbuild

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,12 @@ config ASYNC_TCP_USE_WDT
2727
help
2828
Enable WDT for the AsyncTCP task, so it will trigger if a handler is locking the thread.
2929

30+
config ASYNC_TCP_STACK
31+
int "Stack size for the AsyncTCP task"
32+
default 16384
33+
34+
config ASYNC_TCP_QUEUE_SIZE
35+
int "Events queue size"
36+
default 32
37+
3038
endmenu

src/AsyncTCP.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ static inline bool _init_async_event_queue()
117117
{
118118
if (!_async_queue)
119119
{
120-
_async_queue = xQueueCreate(32, sizeof(lwip_event_packet_t *));
120+
_async_queue = xQueueCreate(CONFIG_ASYNC_TCP_QUEUE_SIZE, sizeof(lwip_event_packet_t *));
121121
if (!_async_queue)
122122
{
123123
return false;
@@ -284,7 +284,7 @@ static bool _start_async_task()
284284
}
285285
if (!_async_service_task_handle)
286286
{
287-
xTaskCreateUniversal(_async_service_task, "async_tcp", 8192 * 2, NULL, 3, &_async_service_task_handle, CONFIG_ASYNC_TCP_RUNNING_CORE);
287+
xTaskCreateUniversal(_async_service_task, "async_tcp", CONFIG_ASYNC_TCP_STACK, NULL, 3, &_async_service_task_handle, CONFIG_ASYNC_TCP_RUNNING_CORE);
288288
if (!_async_service_task_handle)
289289
{
290290
return false;

src/AsyncTCP.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@ extern "C"
3737
#define CONFIG_ASYNC_TCP_USE_WDT 1 // if enabled, adds between 33us and 200us per event
3838
#endif
3939

40+
#ifndef CONFIG_ASYNC_TCP_STACK
41+
#define CONFIG_ASYNC_TCP_STACK 8192 * 2
42+
#endif
43+
#ifndef CONFIG_ASYNC_TCP_QUEUE_SIZE
44+
#define CONFIG_ASYNC_TCP_QUEUE_SIZE 32
45+
#endif
46+
4047
class AsyncClient;
4148

4249
#define ASYNC_MAX_ACK_TIME 5000

0 commit comments

Comments
 (0)