mirror of
https://github.com/meshtastic/firmware.git
synced 2025-10-28 23:34:03 +00:00
Add check for connected state in NimBLE onRead()
This commit is contained in:
parent
ab21e2b50d
commit
099ab06b92
@ -466,6 +466,10 @@ class NimbleBluetoothFromRadioCallback : public NimBLECharacteristicCallbacks
|
|||||||
virtual void onRead(NimBLECharacteristic *pCharacteristic)
|
virtual void onRead(NimBLECharacteristic *pCharacteristic)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
// In some cases, it seems a new connection starts with a read.
|
||||||
|
// The API has no bytes to send, leading to a timeout. This short-circuits this problem.
|
||||||
|
if (!bluetoothPhoneAPI->isConnected())
|
||||||
|
return;
|
||||||
// CAUTION: This callback runs in the NimBLE task!!! Don't do anything except communicate with the main task's runOnce.
|
// CAUTION: This callback runs in the NimBLE task!!! Don't do anything except communicate with the main task's runOnce.
|
||||||
|
|
||||||
int currentReadCount = bluetoothPhoneAPI->readCount.fetch_add(1);
|
int currentReadCount = bluetoothPhoneAPI->readCount.fetch_add(1);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user