Skip to content

Commit 65300ca

Browse files
committed
Hacked in reset HCI._pendingPkt
1 parent 79e3ac3 commit 65300ca

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,7 @@ The user can include the file `app_conf_custom.h` to customize the ble applicati
4444
By default the data length (max payload per BLE packet) is set to 27 bytes. This can cause fragmentation when transmitting large characteristics using a large ATT_MTU.
4545
To increase the data length user must define `CFG_BLE_ENABLE_SET_DATA_LENGTH` (in `app_conf_default.h`). Further more, the wanted data length must bbe set in same define - eg: `#define CFG_BLE_ENABLE_SET_DATA_LENGTH 251`. Valid range: 27 --> 251.
4646
**Note: if this is enabled the pheripheral will attempt to increase the HCI data length with every connected device! There is no guarantee all BLE devices support all sizes!**
47+
### HCI pending packet hack
48+
An error that occurs frequently is HCI._pendingPkt not being set to 0 before a new connection, which results in tanking the BLE.
49+
To hack around this the function `HCI::resetPendingPkt()` is added as public.
50+
**THIS FUNCTION SHOULD ONLY BE CALLED IN DISCONNECT CALLBACK!!!**

src/utility/HCI.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ class HCIClass {
103103
int hciSetDataLength(uint16_t connectionHandle, uint16_t txOctects, uint16_t txTime);
104104
#endif // CFG_BLE_ENABLE_SET_DATA_LENGTH
105105

106+
void resetPendingPacket() { _pendingPkt = 0; }
107+
106108
private:
107109
virtual int sendCommand(uint16_t opcode, uint8_t plen = 0, void* parameters = NULL);
108110

0 commit comments

Comments
 (0)