Skip to content

Commit 7363a4f

Browse files
Few adjustments after testing.
1 parent 963556f commit 7363a4f

File tree

1 file changed

+5
-25
lines changed

1 file changed

+5
-25
lines changed

src/helpers/nrf52/SerialBLEInterface.cpp

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -25,28 +25,14 @@ void SerialBLEInterface::begin(const char* device_name, uint32_t pin_code) {
2525
char charpin[20];
2626
sprintf(charpin, "%d", pin_code);
2727

28-
Bluefruit.configPrphBandwidth(
28+
Bluefruit.configPrphBandwidth(BANDWIDTH_MAX);
29+
Bluefruit.configPrphConn(250, BLE_GAP_EVENT_LENGTH_MIN, 16, 16); // increase MTU
2930
#ifdef BLE_LOW_POWER
30-
BANDWIDTH_NORMAL
31+
Bluefruit.setTxPower(0);
3132
#else
32-
BANDWIDTH_MAX
33+
Bluefruit.setTxPower(4);
3334
#endif
34-
);
35-
Bluefruit.configPrphConn(
36-
#ifdef BLE_LOW_POWER
37-
400, BLE_GAP_EVENT_LENGTH_MIN, 8, 8
38-
#else
39-
250, BLE_GAP_EVENT_LENGTH_MIN, 16, 16 // increase MTU
40-
#endif
41-
);
4235
Bluefruit.begin();
43-
Bluefruit.setTxPower(
44-
#ifdef BLE_LOW_POWER
45-
0
46-
#else
47-
4
48-
#endif
49-
); // Check bluefruit.h for supported values
5036
Bluefruit.setName(device_name);
5137

5238
Bluefruit.Security.setMITM(true);
@@ -98,13 +84,7 @@ void SerialBLEInterface::startAdv() {
9884
* https://developer.apple.com/library/content/qa/qa1931/_index.html
9985
*/
10086
Bluefruit.Advertising.restartOnDisconnect(false); // don't restart automatically as we handle it in onDisconnect
101-
Bluefruit.Advertising.setInterval(
102-
#ifdef BLE_LOW_POWER
103-
160, 1600
104-
#else
105-
32, 244
106-
#endif
107-
); // in unit of 0.625 ms
87+
Bluefruit.Advertising.setInterval(32, 1600);
10888
Bluefruit.Advertising.setFastTimeout(30); // number of seconds in fast mode
10989
Bluefruit.Advertising.start(0); // 0 = Don't stop advertising after n seconds
11090

0 commit comments

Comments
 (0)