Skip to content

Commit a6d3812

Browse files
committed
Allow setting queue and stack size via user defines
[pull request 89](me-no-dev#89)
1 parent 5b26fe9 commit a6d3812

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

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
@@ -95,7 +95,7 @@ static uint32_t _closed_index = []() {
9595

9696
static inline bool _init_async_event_queue(){
9797
if(!_async_queue){
98-
_async_queue = xQueueCreate(32, sizeof(lwip_event_packet_t *));
98+
_async_queue = xQueueCreate(CONFIG_ASYNC_TCP_QUEUE_SIZE, sizeof(lwip_event_packet_t *));
9999
if(!_async_queue){
100100
return false;
101101
}
@@ -218,7 +218,7 @@ static bool _start_async_task(){
218218
return false;
219219
}
220220
if(!_async_service_task_handle){
221-
xTaskCreateUniversal(_async_service_task, "async_tcp", 8192 * 2, NULL, 3, &_async_service_task_handle, CONFIG_ASYNC_TCP_RUNNING_CORE);
221+
xTaskCreateUniversal(_async_service_task, "async_tcp", CONFIG_ASYNC_TCP_STACK, NULL, 3, &_async_service_task_handle, CONFIG_ASYNC_TCP_RUNNING_CORE);
222222
if(!_async_service_task_handle){
223223
return false;
224224
}

src/AsyncTCP.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ extern "C" {
3535
#define CONFIG_ASYNC_TCP_RUNNING_CORE -1 //any available core
3636
#define CONFIG_ASYNC_TCP_USE_WDT 1 //if enabled, adds between 33us and 200us per event
3737
#endif
38+
#ifndef CONFIG_ASYNC_TCP_STACK
39+
#define CONFIG_ASYNC_TCP_STACK 8192 * 2
40+
#endif
41+
#ifndef CONFIG_ASYNC_TCP_QUEUE_SIZE
42+
#define CONFIG_ASYNC_TCP_QUEUE_SIZE 32
43+
#endif
3844

3945
class AsyncClient;
4046

0 commit comments

Comments
 (0)