You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/Usage_tips.md
+27Lines changed: 27 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,33 @@
5
5
When commands are sent to the stack from a different core they can experience delays in execution.
6
6
This library detects this and invokes the esp32 IPC to reroute these commands through the correct core but this also increases overhead.
7
7
Therefore it is highly recommended to create tasks for BLE to run on the same core, the macro `CONFIG_BT_NIMBLE_PINNED_TO_CORE` can be used to set the core.
8
+
9
+
Here is an example of how to do this:
10
+
```
11
+
void BLETask(void* param) {
12
+
for(;;) {
13
+
..BLE STUFF GOES HERE..
14
+
delay(1); // always delay in the loop to allow other tasks to run
15
+
}
16
+
vTaskDelete(NULL); // should never get here
17
+
}
18
+
19
+
void setup() {
20
+
...YOUR INIT CODE...
21
+
xTaskCreatePinnedToCore(
22
+
BLETask, /* Function to implement the task */
23
+
"BLETask", /* Name of the task */
24
+
4096, /* Stack size in bytes */
25
+
NULL, /* Task input parameter */
26
+
2, /* Priority of the task (set higher than loop) */
27
+
nullptr, /* Task handle. */
28
+
CONFIG_BT_NIMBLE_PINNED_TO_CORE); /* Core where main nimble task runs */
29
+
}
30
+
31
+
void loop() {
32
+
delay(1);
33
+
}
34
+
```
8
35
<br/>
9
36
10
37
## Do not delete client instances unless necessary or unused
0 commit comments