diff --git a/ports/esp32/mpconfigport.h b/ports/esp32/mpconfigport.h index 866b1bc25c..723310b231 100644 --- a/ports/esp32/mpconfigport.h +++ b/ports/esp32/mpconfigport.h @@ -101,7 +101,10 @@ #define MICROPY_PY_BLUETOOTH (1) #define MICROPY_PY_BLUETOOTH_USE_SYNC_EVENTS (1) #define MICROPY_PY_BLUETOOTH_USE_SYNC_EVENTS_WITH_INTERLOCK (1) -#define MICROPY_PY_BLUETOOTH_SYNC_EVENT_STACK_SIZE (CONFIG_BT_NIMBLE_TASK_STACK_SIZE - 2048) +// Event stack size is the RTOS stack size minus an allowance for the stack used +// by the NimBLE functions that call into invoke_irq_handler(). +// MICROPY_STACK_CHECK_MARGIN is further subtracted from this value to set the stack limit. +#define MICROPY_PY_BLUETOOTH_SYNC_EVENT_STACK_SIZE (CONFIG_BT_NIMBLE_TASK_STACK_SIZE - 1024) #define MICROPY_PY_BLUETOOTH_ENABLE_CENTRAL_MODE (1) #define MICROPY_PY_BLUETOOTH_ENABLE_PAIRING_BONDING (1) #define MICROPY_BLUETOOTH_NIMBLE (1)