microbit: Added explicit BLE disconnection requests on DFU and soft reset

master
Joe Finney 2015-12-11 00:55:33 +00:00
parent 1e5d5c8dcf
commit b6ca1365f7
2 changed files with 6 additions and 0 deletions

View File

@ -14,6 +14,9 @@ void panic(int statusCode)
void
microbit_reset()
{
if (uBit.ble)
uBit.ble->disconnect(Gap::LOCAL_HOST_TERMINATED_CONNECTION);
NVIC_SystemReset();
}

View File

@ -79,6 +79,9 @@ void MicroBitDFUService::onDataWritten(const GattWriteCallbackParams *params)
uBit.serial.printf(" ACTIVATING BOOTLOADER.\n");
#endif
// Perform an explicit disconnection to assist our peer to reconnect to the DFU service
ble.disconnect(Gap::LOCAL_HOST_TERMINATED_CONNECTION);
// Call bootloader_start implicitly trough a event handler call
// it is a work around for bootloader_start not being public in sdk 8.1
ble_dfu_t p_dfu;