From ebe18daaea8b1cea0826bbeae893402d12b73f2c Mon Sep 17 00:00:00 2001 From: Roberto Date: Tue, 18 Jan 2022 16:51:55 +0100 Subject: [PATCH] Bug fixed of https://github.com/RobertoHE/Arduino-BLE-MIDI/commit/dad42b4dde4b7edc1880f4b5ea727397d8a6794e#diff-bf9bc149421b933caf483239631a8722a328bfd41cd331fa986737433b42fcd7. --- src/hardware/BLEMIDI_Client_ESP32.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/hardware/BLEMIDI_Client_ESP32.h b/src/hardware/BLEMIDI_Client_ESP32.h index 94eb4f5..d1642fc 100644 --- a/src/hardware/BLEMIDI_Client_ESP32.h +++ b/src/hardware/BLEMIDI_Client_ESP32.h @@ -75,6 +75,7 @@ * * Uncomment what you need * These are the default values. + * You can select some simultaneously. */ #define BLEMIDI_CLIENT_BOND //#define BLEMIDI_CLIENT_MITM @@ -86,7 +87,7 @@ */ static uint32_t userOnPassKeyRequest() { - //FILL WITH YOUR CUSTOM AUTH METHOD or PASSKEY + //FILL WITH YOUR CUSTOM AUTH METHOD CODE or PASSKEY //FOR EXAMPLE: uint32_t passkey = 123456; @@ -96,7 +97,7 @@ static uint32_t userOnPassKeyRequest() return passkey; }; -/* + /* ###### BLE COMMUNICATION PARAMS ###### */ /** Set connection parameters: @@ -128,7 +129,7 @@ static uint32_t userOnPassKeyRequest() * Uncomment this define if your device doesn't work propertily after a reconnection. * */ -#define BLEMIDI_FORCE_NEW_CONNECTION +//#define BLEMIDI_FORCE_NEW_CONNECTION /** * @@ -355,12 +356,16 @@ protected: if (_bluetoothEsp32) { _bluetoothEsp32->disconnected(); +#ifdef BLEMIDI_FORCE_NEW_CONNECTION + // Try reconnection or search a new one + _bluetoothEsp32->scan(); +#endif // BLEMIDI_FORCE_NEW_CONNECTION } #ifdef BLEMIDI_FORCE_NEW_CONNECTION // Renew Client NimBLEDevice::deleteClient(pClient); - //NimBLEDevice::createClient(); + NimBLEDevice::createClient(); pClient = nullptr; #endif // BLEMIDI_FORCE_NEW_CONNECTION