QUERY · ISSUE
docs: BLE Event handling seems to contradict general guidelines for IRQ handling
docs
Documentation URL
https://docs.micropython.org/en/latest/library/bluetooth.html#event-handling
Description
In BLE event handling a suggestion is given to create copies of the ringbuffer parameters. This however, would violate the general guidelines given for interrupt routines which specifically warn against instantiating objects.
https://github.com/micropython/micropython/blob/99ac8193ea299e6d836b076149f561e58226ede6/docs/reference/isr_rules.rst?plain=1#L102
Code of Conduct
Yes, I agree
CANDIDATE · PULL REQUEST
extmod/modbluetooth: Misc fixes and improvements
extmod
- Avoid confusing
ENOMEMraised from gap_advertise if there is currently an active connection. This refers to the static connection buffer pre-allocated by Nimble (nothing to do with MicroPython heap memory). Fixed by increasing the max number of connections from 1 to 4 (which is a worthwhile fix anyway). - Clarify behaviour of
adv_dataandresp_dataparams to gap_advertise. - Fix IRQ_GATTS_WRITE having
conn_handleand value_handle the wrong way around in the data tuple. - Address some issues with the ringbuf handling avoiding a potential overflow.
- Pin the NimBLE task on ESP32 to the app core (see commit for more info).
- Misc documentation fixes.
- Make
gap_connectreturnboolrather than raisingOSError(MP_ENOTCONN)when already disconnected.