sandeepmistry / arduino-BLEPeripheral

An Arduino library for creating custom BLE peripherals with Nordic Semiconductor's nRF8001 or nR51822.
MIT License
462 stars 179 forks source link

BLESerial does not execute BLEPeripheral.poll() #276

Open pixmix opened 4 years ago

pixmix commented 4 years ago

I spent some time to figure out a problem in the BLESerial Example. I developed an application that has a long setup sequence. The first cycle of BLESerial.poll() happens past 100 ms from initialisation. When this happen BLESerial.poll() does not call BLEPeripheral.poll() but only flush() When flush is called but there is no any pending TX character then it does not update the timestamp but simply returns. This seems to produce a deadlock when the delay between initialisation of begin() and the first poll() exceeds 100 ms. I have changed BLESerial.poll() to execute anyway a BLEPeriperal.poll() and all works just fine. I hope this is useful. Thank you for the nice library