From 2a8df7489dc10e4aaf9876ba6683967c4856eb02 Mon Sep 17 00:00:00 2001 From: martinwork Date: Sun, 10 Mar 2019 18:40:05 +0000 Subject: [PATCH] MicroBitUARTService - wake up send() on disconnection - version 2! From MicroBitBLEManager's bleDisconnectionCallback, trigger the same event as MicroBitUARTService's on_confirmation to wake up send() if it's sleeping. Fixes #407. --- source/bluetooth/MicroBitBLEManager.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/bluetooth/MicroBitBLEManager.cpp b/source/bluetooth/MicroBitBLEManager.cpp index 07a517f1..ea339180 100644 --- a/source/bluetooth/MicroBitBLEManager.cpp +++ b/source/bluetooth/MicroBitBLEManager.cpp @@ -29,6 +29,7 @@ DEALINGS IN THE SOFTWARE. #include "MicroBitStorage.h" #include "MicroBitFiber.h" #include "MicroBitSystemTimer.h" +#include "NotifyEvents.h" /* The underlying Nordic libraries that support BLE do not compile cleanly with the stringent GCC settings we employ. * If we're compiling under GCC, then we suppress any warnings generated from this code (but not the rest of the DAL) @@ -126,6 +127,7 @@ static void storeSystemAttributes(Gap::Handle_t handle) static void bleDisconnectionCallback(const Gap::DisconnectionCallbackParams_t *reason) { MicroBitEvent(MICROBIT_ID_BLE, MICROBIT_BLE_EVT_DISCONNECTED); + MicroBitEvent(MICROBIT_ID_NOTIFY, MICROBIT_UART_S_EVT_TX_EMPTY); if (MicroBitBLEManager::manager) {